[LLVMdev] insertion points for newly created instructions

Nuno Lopes nunoplopes at sapo.pt
Wed Mar 24 16:16:55 PDT 2010


Hi,

I've been scratching my head with a little problem: how to determine the 
insertion point for a newly created instruction?
The operands of these instructions can be defined in different BBs, and they 
may have several users. Thereby determining where to put those instructions 
is not obvious. In my case, these instructions don't have side-effects, and 
so they could be placed anywhere after the definition of the 
"more-recently-defined" operand, but before the last dominator of all the 
users.

Does LLVM already has any function that will do this (i.e., magically insert 
an instruction in a valid point)?  If not, is there any way I can implement 
this without transversing all the instructions in the enclosing function?

Thanks,
Nuno 




More information about the llvm-dev mailing list