summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2007-01-18 01:15:58 +0000
committerChris Lattner <sabre@nondot.org>2007-01-18 01:15:58 +0000
commitc1ea85b4c4d67146966bf5abaf9f804ff4811e62 (patch)
tree025a346b71e1c2a171e5fcfe700bf9828205f603
parent0ee2d46cfed2ecc104118449602239eaf2a89d05 (diff)
downloadbcm5719-llvm-c1ea85b4c4d67146966bf5abaf9f804ff4811e62.tar.gz
bcm5719-llvm-c1ea85b4c4d67146966bf5abaf9f804ff4811e62.zip
Modify emission of jump tables on darwin to emit an extra "l" label that
delimits the boundaries of jump tables. This lets the linker's dead code stripping optimization do a better job. llvm-svn: 33315
-rw-r--r--llvm/lib/Target/PowerPC/PPCTargetAsmInfo.cpp7
-rw-r--r--llvm/lib/Target/X86/X86TargetAsmInfo.cpp7
2 files changed, 14 insertions, 0 deletions
diff --git a/llvm/lib/Target/PowerPC/PPCTargetAsmInfo.cpp b/llvm/lib/Target/PowerPC/PPCTargetAsmInfo.cpp
index b9f5849bdf6..b54c9e9eb65 100644
--- a/llvm/lib/Target/PowerPC/PPCTargetAsmInfo.cpp
+++ b/llvm/lib/Target/PowerPC/PPCTargetAsmInfo.cpp
@@ -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)
diff --git a/llvm/lib/Target/X86/X86TargetAsmInfo.cpp b/llvm/lib/Target/X86/X86TargetAsmInfo.cpp
index 1735220ae2c..2bb4a6c2272 100644
--- a/llvm/lib/Target/X86/X86TargetAsmInfo.cpp
+++ b/llvm/lib/Target/X86/X86TargetAsmInfo.cpp
@@ -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";
OpenPOWER on IntegriCloud