[PATCH] [PowerPC] Yet another approach to __tls_get_addr

hfinkel at anl.gov hfinkel at anl.gov
Mon Feb 2 12:45:08 PST 2015


This is great, thanks! With the changes noted below, LGTM.


================
Comment at: lib/Target/PowerPC/PPCAsmPrinter.cpp:820
@@ +819,3 @@
+    MCSymbolRefExpr::VariantKind Kind = MCSymbolRefExpr::VK_None;
+
+    if (!Subtarget.isPPC64() && !Subtarget.isDarwin() &&
----------------
Can there be an assert here that the relevant operands are actually equal to PPC::X3 or PPC::R3? If so, please add one.

================
Comment at: lib/Target/PowerPC/PPCAsmPrinter.cpp:881
@@ +880,3 @@
+    // Transform: %R3 = GETtlsldADDR32 %R3, <ga:@sym>
+    // Into: BL_TLS __tls_get_addr(sym at tlsld)@PLT
+
----------------
Can you please refactor the code here so that it shares as much as possible with the PPC::GETtlsADDR/PPC::GETtlsADDR32 handling above. It looks quite similar.

================
Comment at: lib/Target/PowerPC/PPCInstr64Bit.td:904
@@ -906,1 +903,3 @@
                  isPPC64;
+let Defs = [LR8] in {
+def GETtlsADDR : Pseudo<(outs g8rc:$rD), (ins g8rc:$reg, tlsgd:$sym),
----------------
No need for the { } around on def.

================
Comment at: lib/Target/PowerPC/PPCInstr64Bit.td:921
@@ -916,1 +920,3 @@
                  isPPC64;
+let Defs = [LR8] in {
+def GETtlsldADDR : Pseudo<(outs g8rc:$rD), (ins g8rc:$reg, tlsgd:$sym),
----------------
Same here (no { } needed).

================
Comment at: lib/Target/PowerPC/PPCInstrInfo.cpp:2281
@@ +2280,3 @@
+
+#undef DEBUG_TYPE
+#define DEBUG_TYPE "ppc-tls-dynamic-call"
----------------
When you rebase, you'll discover that I just moved all of these other passes into separate files. Please don't add it here, but rather add a separate file. I think that this file becomes somewhat unwieldy with a collection of passes tacked on to the end.

================
Comment at: lib/Target/PowerPC/PPCInstrInfo.cpp:2290
@@ +2289,3 @@
+  // PPCTLSDynamicCall pass - Add copies to and from GPR3 around
+  // GETtls[ld]ADDR machine instructions.
+  struct PPCTLSDynamicCall : public MachineFunctionPass {
----------------
Please explain why we're doing this here (that it turns into a call, and thus the register choice is actually constrained).

================
Comment at: lib/Target/PowerPC/PPCInstrInfo.td:2511
@@ -2518,1 +2510,3 @@
                            (PPCaddiTlsgdL i32:$reg, tglobaltlsaddr:$disp))]>;
+let Defs = [LR] in {
+def GETtlsADDR32 : Pseudo<(outs gprc:$rD), (ins gprc:$reg, tlsgd32:$sym),
----------------
You don't need the { } around a single following def.

================
Comment at: lib/Target/PowerPC/PPCInstrInfo.td:2521
@@ -2522,1 +2520,3 @@
                             (PPCaddiTlsldL i32:$reg, tglobaltlsaddr:$disp))]>;
+let Defs = [LR] in {
+def GETtlsldADDR32 : Pseudo<(outs gprc:$rD), (ins gprc:$reg, tlsgd32:$sym),
----------------
Same here (no { } needed).

http://reviews.llvm.org/D7350

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the llvm-commits mailing list