[PATCH] [mips] The naming convention for private labels is ABI dependant.

Daniel Sanders daniel.sanders at imgtec.com
Mon May 18 02:39:49 PDT 2015


Hi vkalintiris,

For N32/N64, private labels begin with '.L'.

We can't identify the ABI in MipsMCAsmInfo at the moment and fixing that is
likely to affect all targets. Therefore as a temporary measure use the target
triple. It's not 100% correct but it's less wrong than the current behaviour.
I'll follow up with a correct patch soon.

http://reviews.llvm.org/D9821

Files:
  lib/Target/Mips/MCTargetDesc/MipsMCAsmInfo.cpp
  test/CodeGen/Mips/private_label.ll

Index: lib/Target/Mips/MCTargetDesc/MipsMCAsmInfo.cpp
===================================================================
--- lib/Target/Mips/MCTargetDesc/MipsMCAsmInfo.cpp
+++ lib/Target/Mips/MCTargetDesc/MipsMCAsmInfo.cpp
@@ -29,12 +29,20 @@
     PointerSize = CalleeSaveStackSlotSize = 8;
   }
 
+  // FIXME: This should depend on the ABI and rather than the triple.
+  if ((TheTriple.getArch() == Triple::mips64el) ||
+      (TheTriple.getArch() == Triple::mips64)) {
+    PrivateGlobalPrefix = ".L";
+    PrivateLabelPrefix  = ".L";
+  } else {
+    PrivateGlobalPrefix = "$";
+    PrivateLabelPrefix  = "$";
+  }
+
   AlignmentIsInBytes          = false;
   Data16bitsDirective         = "\t.2byte\t";
   Data32bitsDirective         = "\t.4byte\t";
   Data64bitsDirective         = "\t.8byte\t";
-  PrivateGlobalPrefix         = "$";
-  PrivateLabelPrefix          = "$";
   CommentString               = "#";
   ZeroDirective               = "\t.space\t";
   GPRel32Directive            = "\t.gpword\t";
Index: test/CodeGen/Mips/private_label.ll
===================================================================
--- /dev/null
+++ test/CodeGen/Mips/private_label.ll
@@ -0,0 +1,11 @@
+; RUN: llc -march=mips < %s | FileCheck -check-prefix=O32 %s
+; RUN: llc -march=mips64 -target-abi n32 < %s | FileCheck -check-prefix=N32 %s
+; RUN: llc -march=mips64 -target-abi n64 < %s | FileCheck -check-prefix=N64 %s
+
+define void @labels() nounwind  {
+entry:
+  ; O32: $func_end
+  ; N32: .Lfunc_end
+  ; N64: .Lfunc_end
+  ret void
+}

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D9821.25948.patch
Type: text/x-patch
Size: 1535 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150518/88ce6208/attachment.bin>


More information about the llvm-commits mailing list