[llvm-commits] [llvm] r114098 - in /llvm/trunk/lib/Target/ARM: ARMAsmPrinter.cpp AsmPrinter/ARMInstPrinter.cpp
Jim Grosbach
grosbach at apple.com
Thu Sep 16 10:43:25 PDT 2010
Author: grosbach
Date: Thu Sep 16 12:43:25 2010
New Revision: 114098
URL: http://llvm.org/viewvc/llvm-project?rev=114098&view=rev
Log:
MC-ization of the PICLDR pseudo. Next up, adding the other variants
(PICLDRB, et. al.) and PICSTR*
Modified:
llvm/trunk/lib/Target/ARM/ARMAsmPrinter.cpp
llvm/trunk/lib/Target/ARM/AsmPrinter/ARMInstPrinter.cpp
Modified: llvm/trunk/lib/Target/ARM/ARMAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMAsmPrinter.cpp?rev=114098&r1=114097&r2=114098&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/ARMAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/ARM/ARMAsmPrinter.cpp Thu Sep 16 12:43:25 2010
@@ -1351,6 +1351,35 @@
OutStreamer.EmitInstruction(AddInst);
return;
}
+ case ARM::PICLDR: {
+ // This is a pseudo op for a label + instruction sequence, which looks like:
+ // LPC0:
+ // ldr r0, [pc, r0]
+ // The LCP0 label is referenced by a constant pool entry in order to get
+ // a PC-relative address at the ldr instruction.
+
+ // Emit the label.
+ // FIXME: MOVE TO SHARED PLACE.
+ unsigned Id = (unsigned)MI->getOperand(2).getImm();
+ const char *Prefix = MAI->getPrivateGlobalPrefix();
+ MCSymbol *Label =OutContext.GetOrCreateSymbol(Twine(Prefix)
+ + "PC" + Twine(getFunctionNumber()) + "_" + Twine(Id));
+ OutStreamer.EmitLabel(Label);
+
+ // Form and emit the load
+ MCInst LdrInst;
+ LdrInst.setOpcode(ARM::LDR);
+ LdrInst.addOperand(MCOperand::CreateReg(MI->getOperand(0).getReg()));
+ LdrInst.addOperand(MCOperand::CreateReg(ARM::PC));
+ LdrInst.addOperand(MCOperand::CreateReg(MI->getOperand(1).getReg()));
+ LdrInst.addOperand(MCOperand::CreateImm(0));
+ // Add predicate operands.
+ LdrInst.addOperand(MCOperand::CreateImm(MI->getOperand(3).getImm()));
+ LdrInst.addOperand(MCOperand::CreateReg(MI->getOperand(4).getReg()));
+ OutStreamer.EmitInstruction(LdrInst);
+
+ return;
+ }
case ARM::CONSTPOOL_ENTRY: { // FIXME: Remove asm string from td file.
/// CONSTPOOL_ENTRY - This instruction represents a floating constant pool
/// in the function. The first operand is the ID# for this instruction, the
Modified: llvm/trunk/lib/Target/ARM/AsmPrinter/ARMInstPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/AsmPrinter/ARMInstPrinter.cpp?rev=114098&r1=114097&r2=114098&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/AsmPrinter/ARMInstPrinter.cpp (original)
+++ llvm/trunk/lib/Target/ARM/AsmPrinter/ARMInstPrinter.cpp Thu Sep 16 12:43:25 2010
@@ -384,7 +384,10 @@
void ARMInstPrinter::printAddrModePCOperand(const MCInst *MI, unsigned OpNum,
raw_ostream &O,
const char *Modifier) {
- assert(0 && "FIXME: Implement printAddrModePCOperand");
+ // All instructions using addrmodepc are pseudos and should have been
+ // handled explicitly in printInstructionThroughMCStreamer(). If one got
+ // here, it wasn't, so something's wrong.
+ assert(0 && "Unhandled addrmodepc operand!");
}
void ARMInstPrinter::printBitfieldInvMaskImmOperand(const MCInst *MI,
More information about the llvm-commits
mailing list