search for: extractcoderegion

Displaying 20 results from an estimated 23 matches for "extractcoderegion".

2010 Sep 10
0
[LLVMdev] parameters sent by llvm::ExtractCodeRegion
Hello, I use llvm::ExtractCodeRegion to extract a region of code into a new function and everything seems to be OK. But I need to write the new function into a separate file for further processing. Therefore, I copy in the new file the new function together with all globals and declarations of the module, to make them visible for my f...
2011 Mar 12
0
[LLVMdev] problems when the llvm::ExtractCodeRegion updates the Phi nodes in successors ... is there a method to eliminate phi nodes ?
Hi, I use the llvm::ExtractCodeRegion to extract each loop into a separate function, but I have a problem when I run this on the SPEC CPU 2006 on the 401.bzip2 benchmark. First I use clang -O3 to generate optimized llvm code and then I extract some loops from the module built from blocksort.c source file. The problem is that the...
2010 Oct 20
5
[LLVMdev] Pass Incompatibility
I have a transformation where I'd like to use both DominatorTree (for ExtractCodeRegion), and DemoteRegisterToMemory (i.e., reg2mem). The transformation is phased, so all occurrences of getAnalysis<DominatorTree>(Function) happen before any occurrence of getAnalysisID<FunctionPass>(&DemoteRegisterToMemoryID, Function). If I register these two passes with DominatorTree...
2010 Oct 20
0
[LLVMdev] Pass Incompatibility
On Oct 20, 2010, at 4:05 AM, Luke Dalessandro wrote: > If I register DemoteRegisterToMemoryID first I'd expect this to work. > then I get this assert during code extraction. > > CodeExtractor.cpp:681: llvm::Function*<unnamed>::CodeExtractor::ExtractCodeRegion(const std::vector<llvm::BasicBlock*, std::allocator<llvm::BasicBlock*> >&): Assertion `BlocksToExtract.count(*PI) && "No blocks in this region may have entries from outside the region" " except for the first block!"' failed. AFAIU, this assertion is...
2011 Jan 25
2
[LLVMdev] Update PHINode after extracting code
Hi all, I have problem with ExtractCodeRegion (CodeExtractor.cpp). My original program is as follows. bb: ... %tmp.15 = load %struct.MYSQL_ROWS** %3, align 4 ... bb1: ... %tmp.1 = load %struct.MYSQL_ROWS** %6, align 4 ... bb4: ; preds = %bb1, %bb, %entry %tmp.0 = phi %struct.MYSQL_ROWS...
2011 Jan 27
0
[LLVMdev] Update PHINode after extracting code
I guess I didn't have a clear question. Suppose we have BB1 and BB2 both point to BB3. BB1 has variable x. BB2 also as variable x. BB3 will have PHINode for x with 2 value from BB1 and BB2. BB1 BB2 \ / BB3 Now if BB1 and BB2 is extracted into a function (using ExtractCodeRegion), they will be replaced by a basic block called codeRepl (which has a call to the extracted function). codeRepl | BB3 The problem is that the PHINode in BB3 still has 2 values x, both from codeRepl. That's wrong because BB3 has only 1 successors, which is codeRepl. In fact, there is N...
2012 Apr 03
1
[LLVMdev] Extracting loop body
Hi, I've seen this question asked before but I haven't seen an answer.. I would like to extract the body of a (for) loop into a new function so I can do some transformations. The function ExtractCodeRegion seemed like a good candidate and I've got it to sort of work. My problem is that ExtractCodeRegion creates a function that still contains a loop. I was able to eliminate the loop by manually splitting the blocks of the original loop body after and before induction variable uses (hard code the...
2005 Apr 20
0
[LLVMdev] "Refactoring" Basic Blocks into a new function
...imately) convert it into: > > function foo: > code A > call label > code C > > function label: > code B > > I think I have a pretty good idea of how to do this (BasicBlock::split > really helps!), but I have a few specific questions: Evan, Have you looked at ExtractCodeRegion() and its siblings in include/llvm/Transform/Utils/FunctionUtils.h? It seems to be what you need. --Vikram http://www.cs.uiuc.edu/~vadve http://llvm.cs.uiuc.edu/
2011 Jan 27
2
[LLVMdev] Update PHINode after extracting code
...question. > > Suppose we have BB1 and BB2 both point to BB3. > BB1 has variable x. BB2 also as variable x. > BB3 will have PHINode for x with 2 value from BB1 and BB2. > BB1 BB2 > \ / > BB3 > > Now if BB1 and BB2 is extracted into a function > (using ExtractCodeRegion), they will be replaced by > a basic block called codeRepl (which has a call to the extracted > function). > codeRepl > | > BB3 > > The problem is that the PHINode in BB3 still has 2 values x, > both from codeRepl. That's wrong because BB3 has only 1 successor...
2010 Oct 20
0
[LLVMdev] Pass Incompatibility
On 10/20/10 6:05 AM, Luke Dalessandro wrote: > I have a transformation where I'd like to use both DominatorTree (for ExtractCodeRegion), and DemoteRegisterToMemory (i.e., reg2mem). The transformation is phased, so all occurrences of getAnalysis<DominatorTree>(Function) happen before any occurrence of getAnalysisID<FunctionPass>(&DemoteRegisterToMemoryID, Function). I believe that reg2mem is a transform pass, corre...
2005 Apr 20
3
[LLVMdev] "Refactoring" Basic Blocks into a new function
On Apr 19, 2005, at 22:10, Evan Jones wrote: > I just found the Interval class, and it looks like it could help me > out here. I want to locate the Interval that begins with the call to > the "magic" begin(), and ends with the call to the "magic" end(), if > it exists. If there is no such valid interval, then I want to detect > that and return an error. Can I
2005 Apr 20
2
[LLVMdev] "Refactoring" Basic Blocks into a new function
On Apr 19, 2005, at 23:17, Vikram Adve wrote: > Have you looked at ExtractCodeRegion() and its siblings in > include/llvm/Transform/Utils/FunctionUtils.h? It seems to be what you > need. This is brilliant. In fact, it is nearly *exactly* what I need. On Apr 19, 2005, at 23:59, Chris Lattner wrote: > An Interval (and an Interval partition) is a concept with a lot of...
2011 Feb 10
0
[LLVMdev] create function
I think you might be interested in ExtractCodeRegion() function. - Jakub On Mon, Feb 7, 2011 at 2:40 PM, Jakub Staszak <kubastaszak at gmail.com> wrote: > I think you might be interested in ExtractCodeRegion() function. > > - Jakub > > On Sat, Feb 5, 2011 at 7:40 AM, neda 8664 <neda8664 at gmail.com> wrote: >> i nee...
2008 Feb 01
1
[LLVMdev] Code Extractor Issue
...8] lli((anonymous namespace)::SignalHandler(int)+0x110)[0x87f7f7c] /lib/tls/libc.so.6[0x59fa48] /lib/tls/libc.so.6(abort+0x129)[0x5a1319] /lib/tls/libc.so.6(__assert_fail+0x101)[0x598f41] lli(llvm::DominatorTree::splitBlock(llvm::BasicBlock*)+0xb7)[0x874edff] lli[0x86b2672] lli[0x86b2b15] lli(llvm::ExtractCodeRegion(llvm::DominatorTree&, std::vector<llvm::BasicBlock*, std::allocator<llvm::BasicBlock*> > const&, bool)+0x39)[0x86b321d] I just updated to llvm-2.1 from llvm-1.9 where I was never having this problem. I don't understand exactly what it's complaining about (maybe the fac...
2011 Jan 27
0
[LLVMdev] Update PHINode after extracting code
...e have BB1 and BB2 both point to BB3. >> BB1 has variable x. BB2 also as variable x. >> BB3 will have PHINode for x with 2 value from BB1 and BB2. >> BB1 BB2 >> \ / >> BB3 >> >> Now if BB1 and BB2 is extracted into a function >> (using ExtractCodeRegion), they will be replaced by >> a basic block called codeRepl (which has a call to the extracted >> function). >> codeRepl >> | >> BB3 >> >> The problem is that the PHINode in BB3 still has 2 values x, >> both from codeRepl. That's wrong be...
2006 Oct 01
2
[LLVMdev] Extracting all BasicBlocks of a Function into new Function
Hi, I need to find a way to extract all BasicBlocks of a Function (no clones!) into a new Function that has the exact same signature, and adding a call to the new Function in the old one. I tried out lib/ Transforms/Utils/CodeExtractor::ExtractCodeRegion(...), but this one unfortunately checks first to see whether there are any allocas and/ or va_starts and returns a null pointer in that case. Could this check be omitted? If not, is there another way to do the extraction? One of the obstacles I face when trying to do the complement (creatin...
2009 Jul 29
1
[LLVMdev] Moving instructions from functions
Dear all, I want to move a block of instructions from its original function, form a new function, and place these instructions in the new function. these blocks of instructions are not bound by Basic Blocks, i mean i can cut Basic Blocks and move only part of it to the new function. I guess the solution can be either clone the whole function and start deleting instructions from the two
2010 Dec 22
0
[LLVMdev] Extracting Single-entry single-exit Regions into functions
Hi, I want to write a pass that pulls single-entry a single-exit (SESE) region into a function. The idea is similar to extracting a loop in LoopExtractor.cpp. Basically, for each region that meet our criteria, 1. Find all basic blocks in that regions 2. Call llvm::ExtractCodeRegion() to replace that region by a call to the extracted function. 3. Delete the region from the RegionPassManager queue 4. Update the RegionInfo to reflect the change To find all basic blocks (step 1), I use Region::block_iterator(). However, after changing the CFG, that block_iterator does not seem t...
2006 Oct 02
0
[LLVMdev] Extracting all BasicBlocks of a Function into new Function
On Sun, 1 Oct 2006, Bram Adams wrote: > One of the obstacles I face when trying to do the complement > (creating new Function and adding call to original in it), is to find > out how to pass the varargs argument of the new Function into the > call to the old Function. Will passing the sbyte** passed to > llvm.va_start do the trick? I think this is the better way to go. If
2006 Oct 02
3
[LLVMdev] Extracting all BasicBlocks of a Function into new Function
...t' as you > describe, but specially handle the varargs case. Basically you > need to > call va_start in the original function, and pass the valist pointer > down. > This shouldn't be too hard. OK. I've been rethinking my use of lib/Transforms/Utils/ CodeExtractor::ExtractCodeRegion(...) to obtain my first goal, but I don't think I need such a complex algorithm after all. Basically, I only need to clone a Function's signature, move the full body to the clone and call the clone from the original Function instead. Determining in- and outgoing variables is unneces...