[LLVMdev] Legalizing FrameIndex
Duncan Sands
baldrick at free.fr
Fri Feb 8 04:03:48 PST 2013
Hi Amogh,
> I am trying to implement a subtarget for the X86 architecture that only has 64
> bit Registers. While running LLC on the IR for a very simple program, llc fails
> on an assertion that says it doesn't know how to promote ISD::FRAMEINDEX. I've
> tried to look for why how to promote the frameindex which is stored in a i32
> variable to an i64 variable but can't seem to find where this is done. Can
> anyone help me with this?
probably the easiest way to solve this is to not generate FrameIndex with a
32 bit argument in the first place. That said, in LegalizeIntegerTypes.cpp,
in DAGTypeLegalizer::PromoteIntegerOperand, you can add support for FrameIndex.
The following would probably work:
(1) get the 64 bit version of the argument using ZExtPromotedInteger or
SExtPromotedInteger (depending on whether indices are unsigned or signed);
(2) use UpdateNodeOperands to replace the old operand with this one.
There are many examples of similar logic in that file, for example
DAGTypeLegalizer::PromoteIntOp_Shift (though there it is promoting operand
1 and leaving operand 0 alone, while it is the other way round in your case
I think).
Ciao, Duncan.
More information about the llvm-dev
mailing list