Hello,<div><br></div><div><div>I want to find out the member variable of the structure (.omp_data_i) being accessed but the metadata and the use don't seem to be linked.</div><div><br></div></div><div>Here's is a portion of the IR generated for a function containing an OpenMP pragma:</div>
<blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div><div>define internal void @bpnn_adjust_weights.omp_fn.0(i8* nocapture %.omp_data_i) nounwind uwtable {</div></div><div><div>entry:</div></div><div><div>  %0 = getelementptr inbounds i8* %.omp_data_i, i64 36, !dbg !535</div>
</div><div><div>  %1 = bitcast i8* %0 to i32*, !dbg !535</div></div><div><div>  %2 = load i32* %1, align 4, !dbg !535, !tbaa !348</div></div></blockquote><div><br></div><div>Here's the debug metadata:</div><blockquote style="margin:0 0 0 40px;border:none;padding:0px">
<div><div>!236 = metadata !{i32 655617, metadata !52, metadata !".omp_data_i", metadata !1, i32 316, metadata !237, i32 0, i32 0}</div></div><div><div>!237 = metadata !{i32 655375, metadata !1, metadata !"", metadata !1, i32 0, i64 64, i64 64, i64 0, i32 64, metadata !238}</div>
</div><div><div>!238 = metadata !{i32 655379, metadata !1, metadata !".omp_data_s.18", metadata !1, i32 0, i64 320, i64 64, i64 0, i32 0, null, metadata !239, i32 0, null}</div></div><div><div>!239 = metadata !{metadata !240, metadata !241, metadata !242, metadata !243, metadata !244, metadata !245}</div>
</div><div><div>!240 = metadata !{i32 655373, metadata !238, metadata !"ly", metadata !1, i32 306, i64 64, i64 64, i64 0, i32 0, metadata !11}</div></div><div>...</div></blockquote><br>
<div>The problem is that there is no llvm.dbg.declare() or llvm.dbg.value() call that links the use of .omp_data_i to the debug metadata. Instead, the following statement is present (as I understand, to list the local variables of the function).</div>
<blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div>!llvm.dbg.lv.bpnn_adjust_weights.omp_fn.0 = !{!236, !246, !247, !248, !249, !250}</div></blockquote><div><br></div><div>Is there any API call to find out the local variables of the function? I would like to know which member variable is being accessed in the `load' statement but there appears to be no way to relate the %.omp_data_i to {!236}.</div>
<div><br></div><div>I am using LLVM 3.1 with dragonegg 3.1. The file is being compiled with the following line:</div><div>gcc -fplugin=dragonegg.so -flto -emit-llvm -g -S backprop.c -g -O2 -fopenmp -o backprop.o.bc</div><div>
<br></div><div>Ashay</div><div><br></div>