aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-08-11 20:30:58 +0000
committerChris Lattner <sabre@nondot.org>2009-08-11 20:30:58 +0000
commitdf97304b68f46fc1afed8a54b71eaea20973a8f4 (patch)
treeedf98a87e6ed40735fda5ba7ce9c6ecf71850c38
parent3fb451e883aad740e1d1503a3acda5bde359e498 (diff)
downloadexternal_llvm-df97304b68f46fc1afed8a54b71eaea20973a8f4.zip
external_llvm-df97304b68f46fc1afed8a54b71eaea20973a8f4.tar.gz
external_llvm-df97304b68f46fc1afed8a54b71eaea20973a8f4.tar.bz2
split "JumpTableDirective" (an existing hack) into a PIC and nonPIC
version. This allows TAI implementations to specify the directive to use based on the mode being codegen'd for. The real fix for this is to remove JumpTableDirective, but I don't feel like diving into the jumptable snarl just now. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78709 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/llvm/Target/TargetAsmInfo.h10
-rw-r--r--lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp10
-rw-r--r--lib/Target/Alpha/AlphaTargetAsmInfo.cpp2
-rw-r--r--lib/Target/Mips/MipsTargetAsmInfo.cpp4
-rw-r--r--lib/Target/TargetAsmInfo.cpp1
5 files changed, 12 insertions, 15 deletions
diff --git a/include/llvm/Target/TargetAsmInfo.h b/include/llvm/Target/TargetAsmInfo.h
index 2dd644c..2654025 100644
--- a/include/llvm/Target/TargetAsmInfo.h
+++ b/include/llvm/Target/TargetAsmInfo.h
@@ -184,9 +184,11 @@ namespace llvm {
//===--- Section Switching Directives ---------------------------------===//
- /// JumpTableDirective - if non-null, the directive to emit before a jump
- /// table.
+ /// JumpTableDirective - if non-null, the directive to emit before jump
+ /// table entries. FIXME: REMOVE THIS.
const char *JumpTableDirective;
+ const char *PICJumpTableDirective;
+
//===--- Global Variable Emission Directives --------------------------===//
@@ -418,8 +420,8 @@ namespace llvm {
const char *getAscizDirective() const {
return AscizDirective;
}
- const char *getJumpTableDirective() const {
- return JumpTableDirective;
+ const char *getJumpTableDirective(bool isPIC) const {
+ return isPIC ? PICJumpTableDirective : JumpTableDirective;
}
const char *getAlignDirective() const {
return AlignDirective;
diff --git a/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp b/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp
index 02ced44..178e085 100644
--- a/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp
+++ b/lib/Target/ARM/AsmPrinter/ARMAsmPrinter.cpp
@@ -923,9 +923,7 @@ void ARMAsmPrinter::printJTBlockOperand(const MachineInstr *MI, int OpNum) {
O << TAI->getPrivateGlobalPrefix() << "JTI" << getFunctionNumber()
<< '_' << JTI << '_' << MO2.getImm() << ":\n";
- const char *JTEntryDirective = TAI->getJumpTableDirective();
- if (!JTEntryDirective)
- JTEntryDirective = TAI->getData32bitsDirective();
+ const char *JTEntryDirective = TAI->getData32bitsDirective();
const MachineFunction *MF = MI->getParent()->getParent();
const MachineJumpTableInfo *MJTI = MF->getJumpTableInfo();
@@ -947,10 +945,8 @@ void ARMAsmPrinter::printJTBlockOperand(const MachineInstr *MI, int OpNum) {
<< "_set_" << MBB->getNumber();
else if (TM.getRelocationModel() == Reloc::PIC_) {
printBasicBlockLabel(MBB, false, false, false);
- // If the arch uses custom Jump Table directives, don't calc relative to JT
- if (!TAI->getJumpTableDirective())
- O << '-' << TAI->getPrivateGlobalPrefix() << "JTI"
- << getFunctionNumber() << '_' << JTI << '_' << MO2.getImm();
+ O << '-' << TAI->getPrivateGlobalPrefix() << "JTI"
+ << getFunctionNumber() << '_' << JTI << '_' << MO2.getImm();
} else {
printBasicBlockLabel(MBB, false, false, false);
}
diff --git a/lib/Target/Alpha/AlphaTargetAsmInfo.cpp b/lib/Target/Alpha/AlphaTargetAsmInfo.cpp
index 0abdce9..20be50e 100644
--- a/lib/Target/Alpha/AlphaTargetAsmInfo.cpp
+++ b/lib/Target/Alpha/AlphaTargetAsmInfo.cpp
@@ -17,6 +17,6 @@ using namespace llvm;
AlphaTargetAsmInfo::AlphaTargetAsmInfo() {
AlignmentIsInBytes = false;
PrivateGlobalPrefix = "$";
- JumpTableDirective = ".gprel32";
+ PICJumpTableDirective = ".gprel32";
WeakRefDirective = "\t.weak\t";
}
diff --git a/lib/Target/Mips/MipsTargetAsmInfo.cpp b/lib/Target/Mips/MipsTargetAsmInfo.cpp
index aa40ff6..8cb58c8 100644
--- a/lib/Target/Mips/MipsTargetAsmInfo.cpp
+++ b/lib/Target/Mips/MipsTargetAsmInfo.cpp
@@ -24,7 +24,5 @@ MipsTargetAsmInfo::MipsTargetAsmInfo(const MipsTargetMachine &TM) {
PrivateGlobalPrefix = "$";
CommentString = "#";
ZeroDirective = "\t.space\t";
-
- if (TM.getRelocationModel() == Reloc::PIC_)
- JumpTableDirective = "\t.gpword\t";
+ PICJumpTableDirective = "\t.gpword\t";
}
diff --git a/lib/Target/TargetAsmInfo.cpp b/lib/Target/TargetAsmInfo.cpp
index 84a9771..51aeae4 100644
--- a/lib/Target/TargetAsmInfo.cpp
+++ b/lib/Target/TargetAsmInfo.cpp
@@ -54,6 +54,7 @@ TargetAsmInfo::TargetAsmInfo() {
AlignmentIsInBytes = true;
TextAlignFillValue = 0;
JumpTableDirective = 0;
+ PICJumpTableDirective = 0;
GlobalDirective = "\t.globl\t";
SetDirective = 0;
LCOMMDirective = 0;