<div dir="auto"><div dir="ltr">Hello.<br><br>Some parameters of the function would be changed according to ABI rules by compiler<br>I would like to mapping from coerced parameters of the function(by compiler(clang)) to C code.<br><br>For example,<div><br>In C<br>typedef struct data_info<br>{<br>    char *buf;<br>    size_t size;<br>} data_info;<br><br>data_info foo(data_info src, int result)<br>{<br>    data_info dst;<br>    dst.buf = (char *)malloc(src.size);<br>    memcpy((dst.buf, src.buf, src.size);<br>    return dst;<br>}<br><br>In IR (with reg2mem, no opt)</div><div><br>define {i8 *, i64} @foo(i8*, i64, i32*) #0 {<br>    %4 = alloc %struct.dat_info, align 8<br>    %5 = alloc %struct.dat_info, align 8<br>    %6 = bitcast %struct.data_info* %6 to {i8 *, i64}<br>    %7 = getelementptr inbounds {i8 *, i64}, {i8 *, i64}* %6, i32 0, i32 0<br>    %8 = getelementptr inbounds {i8 *, i64}, {i8 *, i64}* %6, i32 0, i32 1<br> .....<br>}<br><br>The foo function has 2 parameter in C code, but IR code has 3 parameters.<br>There is mismatch between C code and IR code.<br><br><div>I want to mapping parameters from IR to C code like in the below<br><br>1st parameter (i8 *) in IR code-> 1st field of the first parameter of the function in C<br>2nd (i64) -> 2nd field of the 1st parameter of the function in C.<br>3rd (i32 *) -> 2nd parameter of the function in C.<br><br>Is there any class or tools for it in LLVM.<br>Please advise the way/idea to map between original parameter in C code and coerced parameter in IR code<br></div></div></div></div>