[PATCH] Add support for small-model PIC for PowerPC.
hfinkel at anl.gov
hfinkel at anl.gov
Thu Sep 18 10:47:06 PDT 2014
================
Comment at: lib/Target/PowerPC/PPCAsmPrinter.cpp:323
@@ +322,3 @@
+ // Transform %LR = MoveGOTtoLR
+ // Into this: bl _GLOBAL_OFFSET_TABLE_ at local-4
+ MCSymbol *GOTSymbol = OutContext.GetOrCreateSymbol(StringRef("_GLOBAL_OFFSET_TABLE_"));
----------------
It would be nice to have a comment here explaining what the 4 means.
================
Comment at: lib/Target/PowerPC/PPCAsmPrinter.cpp:415
@@ +414,3 @@
+ const MCExpr *PB =
+ MCSymbolRefExpr::Create(OutContext.GetOrCreateSymbol(Twine(".LTOC.")),
+ OutContext);
----------------
Why?
================
Comment at: lib/Target/PowerPC/PPCISelLowering.cpp:1700
@@ -1697,1 +1699,3 @@
+ else
+ GOTPtr = DAG.getNode(PPCISD::GlobalBaseReg, dl, PtrVT);
}
----------------
Should we rename the GOTPtr variable?
================
Comment at: lib/Target/PowerPC/PPCISelLowering.cpp:1733
@@ -1727,1 +1732,3 @@
+ else
+ GOTPtr = DAG.getNode(PPCISD::GlobalBaseReg, dl, PtrVT);
}
----------------
Same here.
================
Comment at: lib/Target/PowerPC/PPCInstrInfo.td:3694
@@ -3692,1 +3693,2 @@
defm : TrapExtendedMnemonic<"u", 31>;
+
----------------
Don't need to add a line here.
================
Comment at: test/CodeGen/PowerPC/ppc32-pic.ll:11
@@ -9,13 +10,3 @@
-; CHECK: [[POFF:\.L[0-9]+\$poff]]:
-; CHECK-NEXT: .long .L.TOC.-[[PB:\.L[0-9]+\$pb]]
-; CHECK-NEXT: foo:
-; CHECK: bl [[PB]]
-; CHECK-NEXT: [[PB]]:
-; CHECK: mflr 30
-; CHECK: lwz [[REG:[0-9]+]], [[POFF]]-[[PB]](30)
-; CHECK-NEXT: add 30, [[REG]], 30
-; CHECK: lwz [[VREG:[0-9]+]], [[VREF:\.LC[0-9]+]]-.L.TOC.(30)
-; CHECK: lwz {{[0-9]+}}, 0([[VREG]])
-; CHECK: [[VREF]]:
-; CHECK-NEXT: .long foobar
+; SMALL-BSS: foo:
+; SMALL-BSS: bl _GLOBAL_OFFSET_TABLE_ at local-4
----------------
SMALL-BSS-LABEL: foo
(but make the name something that is not a substring of other things)
http://reviews.llvm.org/D5399
More information about the llvm-commits
mailing list