[LLVMdev] Mapping bytecode to X86

Chris Lattner sabre at nondot.org
Mon Jun 26 14:32:14 PDT 2006


On Mon, 26 Jun 2006, Fernando Magno Quintao Pereira wrote:
> The problem is that, after the TwoAddressInstructionPass is used, the
> code is no longer in SSA form, and my register allocator rely on
> some SSA properties. I am using the Spiller in VirtRegMap.* to generate
> the code, but the incorrect mapping still happens when I invoke the
> setReg() method directly on machine operands. Any of you guys has some
> hints to help me to produce correct mapping without using the Two
> address pass?

You're missing one critical piece.  Currently, the register allocator is 
in charge of removing one of the operands of a two address instruction. 
Whether you choose to use the two-address pass or not (your choice), you 
should make sure that the first two operands of the instructions are 
assigned to the same register, and then you delete one.  For example, 
before RA you might have:

vreg1024 = ADDxxx vreg1025, 123

after, you should have:

ADDxxx EAX, 123

Where the "EAX" operand is marked as a def&use operand.

-Chris

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



More information about the llvm-dev mailing list