Modify emission of jump tables on darwin to emit an extra "l" label that
authorChris Lattner <sabre@nondot.org>
Thu, 18 Jan 2007 01:15:58 +0000 (01:15 +0000)
committerChris Lattner <sabre@nondot.org>
Thu, 18 Jan 2007 01:15:58 +0000 (01:15 +0000)
delimits the boundaries of jump tables.  This lets the linker's dead code
stripping optimization do a better job.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33315 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/PowerPC/PPCTargetAsmInfo.cpp
lib/Target/X86/X86TargetAsmInfo.cpp

index b9f5849bdf69660263890f1a4e7bf60f95dd14f0..b54c9e9eb657b3a7ae4f479aa1a04950b5af1731 100644 (file)
@@ -57,6 +57,13 @@ DarwinTargetAsmInfo::DarwinTargetAsmInfo(const PPCTargetMachine &TM)
   UsedDirective = "\t.no_dead_strip\t";
   WeakRefDirective = "\t.weak_reference\t";
   HiddenDirective = "\t.private_extern\t";
+  
+  // In non-PIC modes, emit a special label before jump tables so that the
+  // linker can perform more accurate dead code stripping.
+  if (TM.getRelocationModel() != Reloc::PIC_) {
+    // Emit a local label that is preserved until the linker runs.
+    JumpTableSpecialLabelPrefix = "l";
+  }
 }
 
 LinuxTargetAsmInfo::LinuxTargetAsmInfo(const PPCTargetMachine &TM)
index 1735220ae2c206dc078077edaa397916229291d2..2bb4a6c227244a1ac95731cb6c9a7c8b6a1f9a71 100644 (file)
@@ -68,6 +68,13 @@ X86TargetAsmInfo::X86TargetAsmInfo(const X86TargetMachine &TM) {
     WeakRefDirective = "\t.weak_reference\t";
     HiddenDirective = "\t.private_extern\t";
     
+    // In non-PIC modes, emit a special label before jump tables so that the
+    // linker can perform more accurate dead code stripping.
+    if (TM.getRelocationModel() != Reloc::PIC_) {
+      // Emit a local label that is preserved until the linker runs.
+      JumpTableSpecialLabelPrefix = "l";
+    }
+    
     NeedsSet = true;
     DwarfAbbrevSection = ".section __DWARF,__debug_abbrev,regular,debug";
     DwarfInfoSection = ".section __DWARF,__debug_info,regular,debug";