[LLVMdev] Extracting all BasicBlocks of a Function into new Function

Chris Lattner sabre at nondot.org
Tue Oct 3 11:48:38 PDT 2006


On Mon, 2 Oct 2006, Bram Adams wrote:
> So, I wonder what problems may show up in this algorithm (steps 4, 5
> and 6 seem to be crucial). The vararg-case could be a problem in step
> 5, although the va_start intrinsic isn't tied to the surrounding
> Function at first sight.

There is an implicit dependency between vastart and the function it 
lives in.  Specifically, if you have:

void foo(int X, ...) {
   P = va_start();
   use(P);
}

You can't change this to:

void foo(int X, ...) {
   bar(X);
}

void bar(int X, ...) {
   P = va_start();
   use(P);
}

You'd have to change it to something like:

void foo(int X, ...) {
   P = va_start();
   bar(X, P);
}

void bar(int X, valist P) {
   use(P);
}


-Chris

-- 
http://nondot.org/sabre/
http://llvm.org/



More information about the llvm-dev mailing list