[LLVMdev] Setting the set of implicit defs dynamically

Roman Levenstein romixlev at yahoo.com
Sat Oct 14 15:04:36 PDT 2006


Is it possible to dynamically define implicit defs for some
And if possible, already in the target lowering pass, e.g. in

Concretely, I'd like to define a register for a return value of a call
in a dynamic way, instead of using current static approach looking
 let Defs = [R0] in 
 def CALLimm :  I<...>;

The reason for this wish is that some of the calling conventions on my
target use different sets of physical registers for their return
values. Therefore I cannot describe it by one static set of regs, as
shown above.

By looking into the LLVM code, in particular inside LowerCALL() and the
like, I've found how to force some arguments of calls to be placed on
required registers and how to copy the result of the call from certain
(return) registers. But if I try to copy from a return register that is
not in the static Defs set of the CALL machine instruction, then
register allocator complains that the interval for a return value of a
CALL does not exist. Which means that the register allocator does not
understand that this register is implicitly defined by the CALL insn.

One obvious solution is to define several machine instructions for a
CALL, each defining its own set of implicitly defined registers. But it
is not very elegent in my opinion. Are there any other ways to achieve
the same result? May be it can be solved simpler?


Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 

More information about the llvm-dev mailing list