Antonio Martínez Álvarez
2012-Oct-31 15:49 UTC
[LLVMdev] Lifetime analysis of variables within a module
Hi all, I'm looking for a LLVM method/class/strategy to know the lifetime of every variable/value used in a given Module. I want to know the variables that must be alive at the input and at the end of every function call (and every BasicBlock). By creating a pass inheriting from ModulePass I can reach up to here: virtual bool runOnFunction(Function &F) { ... for (Function::iterator bbi = F.begin(), bbf = F.end(); bbi != bbf; bbi++) { ... for (BasicBlock::iterator insi = bbi->begin(), insf = bbi->end(); insi != insf; insi++) { ... for (User::op_iterator opi = insi->op_begin(), opf = insi->op_end(); opi != opf; opi++) { if(isa<Instruction>(opi) || isa<Argument>(opi)) { // Here I am <============== } How can I use LiveIntervals/LiveVariables/LiveRange to obtain the live range for a given variable of interest? BTW, do you know any working example of using MachineFunctionPass or LiveIntervals LLVM passes? Every time I use it, opt generates output such as: opt: PassManager.cpp:597: void llvm::PMTopLevelManager::schedulePass(llvm::Pass*): Assertion `PI && "Expected required passes to be initialized"' failed. 0 libLLVM-3.1.so 0x00007f42eb6469ef ... 7 libLLVM-3.1.so 0x00007f42eb1ccafa llvm::PMTopLevelManager::schedulePass(llvm::Pass*) + 1226 Thank you in advance !!!!
Krzysztof Parzyszek
2012-Nov-02 19:19 UTC
[LLVMdev] Lifetime analysis of variables within a module
On 10/31/2012 10:49 AM, Antonio Martínez Álvarez wrote:> > How can I use LiveIntervals/LiveVariables/LiveRange to obtain the live > range for a given variable of interest?These passes operate on machine instructions (registers). You are trying to run them on bitcode. -Krzysztof -- Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation