search for: runonfunction

Displaying 20 results from an estimated 819 matches for "runonfunction".

2011 Jun 29
2
[LLVMdev] How to disable pass grouping(scheduling)
...list passes. I want to do some experiment to see the difference between grouping and non-grouping execution. Considering the following example, if I want to apply transformation A, B and C. The execution order is: A.doInitialization(); B.doInitialization(); C.doInitialization(); A.runOnFunction(); B.runOnFunction(); C.runOnFunction(); A.doInitialization(); B.doInitialization(); C.doInitialization(); Is it possible to disable the grouping? Make it execute as: A.doInitialization(); A.runOnFunction(); A.doInitialization(); B.doInitialization(); B.runOnFunction...
2011 Jun 29
2
[LLVMdev] How to disable pass grouping(scheduling)
...erence between grouping and non-grouping >> execution. >> Considering the following example, if I want to apply transformation >> A, B and C. The execution order is: >> A.doInitialization(); >> B.doInitialization(); >> C.doInitialization(); >> A.runOnFunction(); >> B.runOnFunction(); >> C.runOnFunction(); >> A.doInitialization(); >> B.doInitialization(); >> C.doInitialization(); >> >> Is it possible to disable the grouping? Make it execute as: >> >> A.doInitialization(); >>...
2010 Apr 01
2
[LLVMdev] AnalysisUsage: addRequired vs. addRequiredTransitive
On Mar 31, 2010, at 3:13 PM, Owen Anderson wrote: > Some analyses, like Andersen's AA, do all their computation in their > runOnFunction(). Therefore, anything they depended on can be > destroyed after the runOnFunction() returns. What about AA itself? Would addRequired<AliasAnalysis> keep AliasAnalysis alive (but allow AliasAnalysis's dependencies to die)? > Others, like MemoryDependenceAnalysis, are "l...
2011 Jun 29
0
[LLVMdev] How to disable pass grouping(scheduling)
...periment to see the difference between grouping and non-grouping > execution. > Considering the following example, if I want to apply transformation > A, B and C. The execution order is: > A.doInitialization(); > B.doInitialization(); > C.doInitialization(); > A.runOnFunction(); > B.runOnFunction(); > C.runOnFunction(); > A.doInitialization(); > B.doInitialization(); > C.doInitialization(); > > Is it possible to disable the grouping? Make it execute as: > > A.doInitialization(); > A.runOnFunction(); > A.do...
2010 Apr 01
0
[LLVMdev] AnalysisUsage: addRequired vs. addRequiredTransitive
On Fri Apr 02 00:37:03 +0200 2010, Trevor Harmon wrote: > On Mar 31, 2010, at 3:13 PM, Owen Anderson wrote: > > Others, like MemoryDependenceAnalysis, are "lazy." MDA > > specifically does NOT compute results in its runOnFunction(), > > instead computing results on-demand when a user queries it. Because > > MDA depends on AA, we must ensure that, as long as MDA is alive and > > responding to queries, AA is alive as well. That is what > > addRequiredTransitive does. > > I'm not sure if I f...
2010 Apr 20
1
[LLVMdev] iterate over loops inside the runOnFunction
Hello I'm wandring to write a Function parser that iterates over loops inside each function and inside each loop iterates over instructions So I found a way to do the Function parser that iterates over BasicBlocks (using the runOnfunction Pass) but I no know how make it iterates over loops ? So my question is there any way to make a loop inside the runOnfunction to iterate over "loops" (just like with the Basicblock loop "for (BasicBlock::iterator i = b->begin(), ie = b->end(); i != ie; ++i) " ) ? Than...
2019 Dec 26
2
Calling LowerSwitchPass causing crash in llvm 9
Hi, I am trying to call LowerSwitchPass directly in my custom pass in this way: FunctionPass *lower = createLowerSwitchPass(); lower->runOnFunction(*f); But it will crash when running lower->runOnFunction(*f) in llvm-9. I was using this method in llvm-8 and it worked fine. It seems the crash happens at the first line of the LowerSwitch::runOnFunction(Function &F) in the newer llvm: LazyValueInfo *LVI = &getAnalysis<LazyValueInf...
2010 Mar 31
2
[LLVMdev] AnalysisUsage: addRequired vs. addRequiredTransitive
...of the pass". For example, if a pass is "available" when my pass runs, then I should be able to use it when my pass is running, correct? For instance: void MyPass::getAnalysisUsage(AnalysisUsage &AU) const { AU.addRequired<UnifyFunctionExitNodes>(); } bool MyPass::runOnFunction(Function &function) { UnifyFunctionExitNodes &pass = getAnalysis<UnifyFunctionExitNodes>(); // ... use the pass ... } But if the above is okay, then why would addRequiredTransitive be necessary? I suspect that the REQUIRES definition is simply not worded well. Perhaps...
2011 Oct 14
2
[LLVMdev] pass utilizing MemoryDependenceAnalysis?
...ModulePass(ID) { ;; } virtual void getAnalysisUsage(AnalysisUsage &AU) const { AU.addRequired<MemoryDependenceAnalysis>(); errs() << "addRequired called\n"; } virtual bool runOnModule(Module &M) { for(Module::iterator f = M.begin(); f != M.end(); ++f) runOnFunction(*f, M); return false; } private: bool runOnFunction(Function &F, Module &M) { MD = &getAnalysis<MemoryDependenceAnalysis>(F); for(Function::iterator i = F.begin(); i != F.end(); ++i) { for(BasicBlock::iterator j = i->begin(); j != i->end(); ++j) { ;; }...
2018 Aug 11
3
ScalarEvolution in a ModulePass
...s. After some debugging, it looks to me like ScalarEvolutionWrapperPass does not handle memory correctly for this case. Here's my current understanding of the problem. ScalarEvolutionWrapperPass maintains a unique_ptr to a ScalarEvolution. Calling getSE() dereferences this pointer. Meanwhile runOnFunction() resets the pointer to point to a new ScalarEvolution. As a result, runOnFunction destructs and frees any ScalarEvolution the unique_ptr pointed to before. The ModulePass I'm working on uses ScalarEvolution and several other analysis FunctionPasses, including DominatorTree, LoopInfo, Optimiz...
2010 Mar 31
0
[LLVMdev] AnalysisUsage: addRequired vs. addRequiredTransitive
...e pass". For example, if a pass is > "available" when my pass runs, then I should be able to use it when my > pass is running, correct? For instance: > Consider passes like AliasAnalysis or MemoryDependenceAnalysis. These passes has two phases of existence: when their runOnFunction is called, and when later passes (which requested them via their own AnalysisUsage's) call methods on them to query that information. Some analyses, like Andersen's AA, do all their computation in their runOnFunction(). Therefore, anything they depended on can be destroyed after the runOn...
2019 Dec 27
2
Calling LowerSwitchPass causing crash in llvm 9
...> >> On Thu, Dec 26, 2019 at 6:36 PM n3v3rm03 <n3v3rm03 at gmail.com> wrote: >> Hi, >> >> I am trying to call LowerSwitchPass directly in my custom pass in this way: >> >> >> FunctionPass *lower = createLowerSwitchPass(); >> lower->runOnFunction(*f); >> >> But it will crash when running lower->runOnFunction(*f) in llvm-9. >> I was using this method in llvm-8 and it worked fine. It seems the crash happens at the first line of the LowerSwitch::runOnFunction(Function &F) in the newer llvm: >> >> LazyVal...
2009 Aug 21
0
[LLVMdev] How to force MemoryDependenceAnalysis to run on original module
...gt; the > code. Unfortunately, non-local dependencies of MemDep might point to > code changed by Pass2. Therefore, Pass1 might see changes applied by > Pass2. This breaks encapsulation. > > So I want to make sure the PassManager runs Pass1 on the whole module, > before Pass2's runOnFunction is called the first time. Not impossible at all. I assume that Pass1 is your pass, just make the "Pass1::runOnFunction" method do everything you need. If Pass2 ends up calling pass1 in various ways that require it to do things after its runonfunciton is complete, just make pass1...
2009 Aug 21
2
[LLVMdev] How to force MemoryDependenceAnalysis to run on original module
...1. Eventually, Pass2 changes the code. Unfortunately, non-local dependencies of MemDep might point to code changed by Pass2. Therefore, Pass1 might see changes applied by Pass2. This breaks encapsulation. So I want to make sure the PassManager runs Pass1 on the whole module, before Pass2's runOnFunction is called the first time. Still impossible? Thanks Marc
2011 Oct 14
0
[LLVMdev] pass utilizing MemoryDependenceAnalysis?
In runOnFunction(), you should check to see if the function F is a declaration before calling getAnalysis(F). Calling getAnalysis<FunctionPass>() on a function that is a declaration will trigger an assertion if the function is just a declaration. To see if a function is a declaration, call its isDeclarat...
2011 Oct 15
1
[LLVMdev] pass utilizing MemoryDependenceAnalysis?
...espace llvm; struct Hello: public FunctionPass { public: static char ID; Hello(): FunctionPass(ID) { ;; } virtual void getAnalysisUsage(AnalysisUsage &AU) const { AU.addRequired<MemoryDependenceAnalysis>(); errs() << "addRequired called\n"; } virtual bool runOnFunction(Function &F) { if(F.isDeclaration() == true) return false; MemoryDependenceAnalysis *MD = &getAnalysis<MemoryDependenceAnalysis>(F); for(Function::iterator i = F.begin(); i != F.end(); ++i) { for(BasicBlock::iterator j = i->begin(); j != i->end(); ++j) { i-&gt...
2013 Apr 12
2
[LLVMdev] Runtime exception in DominatorTree.getRootNode()
Hi all, I am trying to traverse a dominator tree and have encountered a weird runtime exception: Here's my simple code: virtual bool runOnFunction(Function &F) { DominatorTree& DT = getAnalysis<DominatorTree>(); * DomTreeNode* rootNode = DT.getRootNode();* return false. } Here's the documentation page: http://llvm.org/docs/doxygen/html/classllvm_1_1DominatorTree.html And here's my runtime exception: d...
2008 Aug 27
2
[LLVMdev] IntervalPartition and Intervals per function
Hi, I wrote a Function pass that requires the IntervalPartition pass in order to obtain the set of intervals for every function: virtual void getAnalysisUsage(AnalysisUsage &AU) const { AU.addRequired<IntervalPartition>(); } and get a handle to it in the runOnFunction method of my CustomPass: bool CustomPass::runOnFunction(Function& F) { IntervalPartition& iPart = getAnalysis<IntervalPartition>(); const std::vector<Interval*>& intervals = iPart.getIntervals(); ... } However when i access the intervals vector for a parti...
2010 Jul 22
2
[LLVMdev] Controlling the order of a FunctionPass
...der (callees before callers). However, "Writing an LLVM Pass" notes that "FunctionPass's do not require that they are executed in a particular order." Is there any way at all to specify an ordering? If this is not possible, I'm thinking of a workaround in which my runOnFunction method does not actually process the function but instead copies the Function object to a "work set". When runOnFunction has been invoked for all functions, I would then perform the analysis on each saved function in the order that I desire. Does this sound like the right approach...
2013 Apr 12
2
[LLVMdev] Runtime exception in DominatorTree.getRootNode()
...uot;llvm/Analysis/Dominators.h" using namespace llvm; namespace { struct Hello : public FunctionPass { static char ID; Hello() : FunctionPass(ID) { } virtual void getAnalysisUsage(AnalysisUsage &AU) const { AU.addRequired<DominatorTree>(); } virtual bool runOnFunction(Function &F) { DominatorTree& DT = getAnalysis<DominatorTree>(); BasicBlock* BB = DT.getRoot(); return false; } }; } char Hello::ID = 0; static RegisterPass<Hello> Z("hello", "My test analysis", true, true); On Fri, Apr 12, 2013 at 9...