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

Bram Adams bram.adams at ugent.be
Thu Oct 5 13:54:12 PDT 2006


Hi,


Op 5-okt-06, om 16:05 heeft Ryan Brown het volgende geschreven:
> I don't know if that's valid but what about something like this:
> int va_double_sum(int count,...){
>  /*declare va_list for each original va_start*/
>  /*llvm.va_start for each va_list*/
>  /*call extracted_sum(count,va_list1, va_list2, ...)*/
> }

That should work, I think, ...

Op 5-okt-06, om 20:51 heeft Chris Lattner het volgende geschreven:

> Why not va_copy the input valist?

... and so would this. The only problem left is that both require an  
easy way to replace each use of the original va_list situated AFTER a  
(to be removed) va_end with the second va_list. This seems a task for  
a control flow graph based function checking the (possibly partial)  
order between two Instructions, i.e. to check whether a Use is  
situated after a CallInst to va_end.

Does such a method already exist in one of the transform or analysis  
passes? Or does a replaceAllUsesAfterThisInstruction() method exist?

A related question: What's the easiest way to replace all uses of a  
Value, but only within, say, a Function?

Kind regards,

Bram Adams
GH-SEL, INTEC, Ghent University (Belgium)



More information about the llvm-dev mailing list