[LLVMdev] eliminateFrameIndex (original) (raw)

Boris Boesler baembel at gmx.de
Fri Oct 10 08:03:46 PDT 2014


Hi!

I started writing a LLVM backend for a custom architecture. I have some register and instruction .td files and some other files/classes like a MCStreamer for assembler output. At the moment I can compile some empty programs so far.

I implemented the method ::eliminateFrameIndex() similar to the Sparc and ARM backend. The method looks like this:

// frame pointer is in reg of class mytarget::ARegsRegClass unsigned ScratchReg = MF.getRegInfo().createVirtualRegister(&mytarget::ARegsRegClass); const TargetInstrInfo &TII = *MF.getTarget().getInstrInfo(); BuildMI(*MI.getParent(), II, dl, TII.get(mytarget::ADD_AReg), ScratchReg).addReg(FramePtr).addImm(Offset); // Update the original instruction to use the scratch register. MI.getOperand(FIOperandNum).ChangeToRegister(ScratchReg, false);

But for the test case

int foo(void) { int a = 43; return(41); }

I get the error message "Remaining virtual register operands".

Is something wrong with my method? Did I miss to implement some more methods?

Thanks in advance, Boris



More information about the llvm-dev mailing list