Re: [cfe-users] Get Source Location details from IR code (Function Pass)

2021-01-12 Thread Bella V via cfe-users
Do we have to initially attach some metadata to the Value? Because in function pass, when I do F.getAllMetadata(MDs), i do not see any metadata appending to MDS. F.hasMetadata() also returns false. What would be the way to get debugLoc in these scenario? Thanks and Regards. On Mon, Jan 11, 2021 a

Re: [cfe-users] Get Source Location details from IR code (Function Pass)

2021-01-15 Thread Bella V via cfe-users
Thank you. Also Is there a pragmatically way to access the metadata info for local variables within the llvm.dbg.declare. ( llvm::Value does not have local variables). On Tue, Jan 12, 2021 at 1:55 PM David Blaikie wrote: > You'd have to get IR from somewhere that has attached debug info - such a

Re: [cfe-users] Get Source Location details from IR code (Function Pass)

2021-01-26 Thread Bella V via cfe-users
Thanks for the answer. struct Foo {int x;}; Void bar() { struct Foo f; f.x = 1; } I'm trying to access the DILocation for DICompositeType (Foo), that is the Source Location for struct Foo and struct members. Any pointers. Regards. On Sun, Jan 17, 2021 at 11:20 AM David Blaikie wrote: > Not su

Re: [cfe-users] Get Source Location details from IR code (Function Pass)

2021-01-26 Thread Bella V via cfe-users
Thank you for the clarification. How do we access DICompositeType: line numbers from Function &F or Module &M. On Tue, Jan 26, 2021 at 9:43 PM David Blaikie wrote: > the location of composite types isn't stored in a DILocation - it's stored > in the 'file'/'line' attributes of the DICompositeTyp

[cfe-users] How to get llvm Location of Used Variables

2021-02-23 Thread Bella V via cfe-users
Hello Experts, I'm trying to get the location of used variables inside the function pass. For example the output should be: variable name = [line numbers where they are used] Output: a = [5,7] b= [6,8] C code void bar() { int a = 10; //line 2 int b = 20; //line 3 a = a +

[cfe-users] How to get llvm Location of Used Variables

2021-02-23 Thread Bella V via cfe-users
Hello LLVM Experts, Please ignore the last email. I'm trying to get the location of used variables inside the function pass. For example: *Symbol a = [4, 4, 6] linesSymbol b= [5, 5, 7] lines* *C code:* void bar() { int a = 10; //line 2 int b = 20; //line 3 a = a + 5;//line 4

[cfe-users] fetch variable names through debugInfo attached to load instructors

2021-05-20 Thread Bella V via cfe-users
Hello All, I read the documentation and I was able to fetch the variable names and source locations attached to metadata for call instructions (@llvm.dbg.declare) using dyn_cast. I wanted to check if we could fetch the variable names in the load/gep instructors using debugInfo. I want to collect t

Re: [cfe-users] fetch variable names through debugInfo attached to load instructors

2021-05-25 Thread Bella V via cfe-users
s) you can follow those to find the variables they refer to. > > On Thu, May 20, 2021 at 12:18 PM Bella V via cfe-users < > cfe-users@lists.llvm.org> wrote: > >> Hello All, >> >> I read the documentation and I was able to fetch the variable names and >

[cfe-users] getelementptr global type query

2021-05-26 Thread Bella V via cfe-users
Hello All, I'm not able to extract f1 from a getelementptr inbounds Instruction. struct foo { int num; }; extern struct foo f1; void hello () { if (f1.num){ } } @f1 = external dso_local global %struct.foo, align 4 define dso_local void @hello() #0 !dbg !9 { %1 = load i32, i32* getelementptr inbou

[cfe-users] No macros in DI metadata

2021-07-13 Thread Bella V via cfe-users
Hello All, I'm trying to build a list of macros in a compilation unit using CU-> getMacros (). I do not see the macros field in DICompileUnit output. *https://godbolt.org/z/b8cM1Yf7v

Re: [cfe-users] No macros in DI metadata

2021-07-13 Thread Bella V via cfe-users
ast(MN)) { outs()<< M->getName(); } } On Tue, Jul 13, 2021 at 4:13 PM David Blaikie wrote: > Add -fdebug-macro > > On Tue, Jul 13, 2021 at 4:05 PM Bella V via cfe-users > wrote: > > > > Hello All, > > > > I'm trying to build a list

Re: [cfe-users] No macros in DI metadata

2021-07-14 Thread Bella V via cfe-users
for (auto *MN : Macros) { > > if (auto *M = dyn_cast(MN)) { > > outs()<< M->getName(); > > } > > } > > > > > > On Tue, Jul 13, 2021 at 4:13 PM David Blaikie > wrote: > >> > >> Add -fdebug-macro > >> > >> O

[cfe-users] detect default in SwitchInst

2021-07-16 Thread Bella V via cfe-users
Hello All, I'm trying to find whether SwitchInst has a default statement. I'm able to iterate through the case values using case_begin and case_end. If I try to detect default using case_default which returns an iterator which points to the default case. Code Example: case_default()->getCaseIn

Re: [cfe-users] detect default in SwitchInst

2021-07-16 Thread Bella V via cfe-users
e statements would jump > over that default block) > > On Fri, Jul 16, 2021 at 12:34 PM Bella V via cfe-users < > cfe-users@lists.llvm.org> wrote: > >> Hello All, >> >> >> >> I'm trying to find whether SwitchInst has a default statement.

[cfe-users] visit all constantExpr directly for a Function/Module Pass

2021-07-29 Thread Bella V via cfe-users
Hello All, Is there a way to get all constantExpr as a batch similar to InstVisitor, which has a visitor for each type of instruction. https://llvm.org/doxygen/classllvm_1_1InstVisitor.html Regards. ___ cfe-users mailing list cfe-users@lists.llvm.org h

[cfe-users] read an external file in a function/module pass

2021-12-06 Thread Bella V via cfe-users
Hello All, I have a custom function & module pass. I'm invoking these passes using OPT. I would like to read an external YAML file inside the pass. I could pass the file as a command-line argument to the OPT, I could not find the options available. Are there any options or is there another way

[cfe-users] find external function from other module within module pass

2022-01-18 Thread Bella V via cfe-users
Hello, I have a module pass as well as a function pass which I'm invoking on shared library LLVM IR .so (which has multiple C source files). The library has linked external functions from another module (shared library), how do I identify those functions which are not defined in the current module.