[llvm-commits] [llvm] r119090 - /llvm/trunk/lib/Target/PowerPC/PPCAsmPrinter.cpp
Chris Lattner
sabre at nondot.org
Sun Nov 14 14:56:43 PST 2010
Author: lattner
Date: Sun Nov 14 16:56:43 2010
New Revision: 119090
URL: http://llvm.org/viewvc/llvm-project?rev=119090&view=rev
Log:
with the picbase nonsense starting to be figured out, implement
lowering support for MovePCtoLR[8]. Down to 4 failures again.
Modified:
llvm/trunk/lib/Target/PowerPC/PPCAsmPrinter.cpp
Modified: llvm/trunk/lib/Target/PowerPC/PPCAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCAsmPrinter.cpp?rev=119090&r1=119089&r2=119090&view=diff
==============================================================================
--- llvm/trunk/lib/Target/PowerPC/PPCAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/PowerPC/PPCAsmPrinter.cpp Sun Nov 14 16:56:43 2010
@@ -558,6 +558,28 @@
// Lower multi-instruction pseudo operations.
switch (MI->getOpcode()) {
default: break;
+ case PPC::MovePCtoLR:
+ case PPC::MovePCtoLR8: {
+ // Transform %LR = MovePCtoLR
+ // Into this, where the label is the PIC base:
+ // bl L1$pb
+ // L1$pb:
+ MCSymbol *PICBase = MF->getPICBaseSymbol();
+
+ // Emit the 'bl'.
+ TmpInst.setOpcode(PPC::BL_Darwin); // Darwin vs SVR4 doesn't matter here.
+
+
+ // FIXME: We would like an efficient form for this, so we don't have to do
+ // a lot of extra uniquing.
+ TmpInst.addOperand(MCOperand::CreateExpr(MCSymbolRefExpr::
+ Create(PICBase, OutContext)));
+ OutStreamer.EmitInstruction(TmpInst);
+
+ // Emit the label.
+ OutStreamer.EmitLabel(PICBase);
+ return;
+ }
case PPC::LDtoc: {
// Transform %X3 = LDtoc <ga:@min1>, %X2
LowerPPCMachineInstrToMCInst(MI, TmpInst, *this);
More information about the llvm-commits
mailing list