Shruti Patil
2013-May-23 01:10 UTC
[LLVMdev] Variable names of arguments to call functions
Hi, I am trying to get arguments of call functions in instructions such as these: call @func(i32 %arg1, i32 %arg2). I want to get the declared variable names for arg1 and arg2. Most of these arguments are arrays, and I need to get the index of the array as well. Currently, I read arguments of the called function using getArgOperands(), and backtrace the Value* until I find an alloca instruction to get the variable name. For the array index, I backtrace until I find a getelementptr instruction. I am wondering if the information I need is captured in the metadata. I see explicit calls to llvm.dbg.value and llvm.dbg.declare when I compile with the -g option, but I can't figure out how to retrieve the metadata for the arguments of the call at func instruction. Here is a sample LLVM IR excerpt: %a = alloca [4 x i32], align 2 %arrayidx = getelementptr inbounds i32* %a, i64 2, !dbg !42 %0 = load i32* %arrayidx, align 2, !dbg !42 call void @func(i32 %0), !dbg !42 Thank you!! Regards, shruti -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130522/0294a588/attachment.html>