LLVM code snippet:
call <2 x i64> @read128(<2 x i64>* %1)
at above code snippet we are mapping vector to api parameters to map it accordningly in c, we need to create datatype through attribute option as below:
typedef long long test_uint128_t __attribute__((__vector_size__(16), __aligned__(1)));
To list the passes an API main() in a file hello.c goes through:
clang -c -mllvm -print-before-all -mllvm -print-after-all hello.c -mllvm -filter-print-funcs=main
Tell clang to emit debug info by adding the -g flag:
clang -Os -S -emit-llvm -g addition.c
if you are interested where this line came from:
%cmp = icmp sgt i32 %x, 10, !dbg !21
You have to look for the debug entry !21:
!21 = !DILocation(line: 4, column: 9, scope: !22)
line 9 is source line numbe.
reference:
https://stackoverflow.com/questions/45142289/how-to-map-c-function-to-llvm-ir