Hello,
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.
Here’s is a portion of the IR generated for a function containing an OpenMP pragma:
define internal void @bpnn_adjust_weights.omp_fn.0(i8* nocapture %.omp_data_i) nounwind uwtable {
entry:
%0 = getelementptr inbounds i8* %.omp_data_i, i64 36, !dbg !535
%1 = bitcast i8* %0 to i32*, !dbg !535
%2 = load i32* %1, align 4, !dbg !535, !tbaa !348
Here’s the debug metadata:
!236 = metadata !{i32 655617, metadata !52, metadata !".omp_data_i", metadata !1, i32 316, metadata !237, i32 0, i32 0}
!237 = metadata !{i32 655375, metadata !1, metadata !"", metadata !1, i32 0, i64 64, i64 64, i64 0, i32 64, metadata !238}
!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}
!239 = metadata !{metadata !240, metadata !241, metadata !242, metadata !243, metadata !244, metadata !245}
!240 = metadata !{i32 655373, metadata !238, metadata !“ly”, metadata !1, i32 306, i64 64, i64 64, i64 0, i32 0, metadata !11}
…
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).
!llvm.dbg.lv.bpnn_adjust_weights.omp_fn.0 = !{!236, !246, !247, !248, !249, !250}
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}.
I am using LLVM 3.1 with dragonegg 3.1. The file is being compiled with the following line:
gcc -fplugin=dragonegg.so -flto -emit-llvm -g -S backprop.c -g -O2 -fopenmp -o backprop.o.bc
Ashay