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
This commit is contained in:
Chris Lattner 2009-08-11 20:30:58 +00:00
parent b3ac6e40d9
commit dfab291702
5 changed files with 12 additions and 15 deletions

@ -184,9 +184,11 @@ namespace llvm {
//===--- Section Switching Directives ---------------------------------===// //===--- Section Switching Directives ---------------------------------===//
/// JumpTableDirective - if non-null, the directive to emit before a jump /// JumpTableDirective - if non-null, the directive to emit before jump
/// table. /// table entries. FIXME: REMOVE THIS.
const char *JumpTableDirective; const char *JumpTableDirective;
const char *PICJumpTableDirective;
//===--- Global Variable Emission Directives --------------------------===// //===--- Global Variable Emission Directives --------------------------===//
@ -418,8 +420,8 @@ namespace llvm {
const char *getAscizDirective() const { const char *getAscizDirective() const {
return AscizDirective; return AscizDirective;
} }
const char *getJumpTableDirective() const { const char *getJumpTableDirective(bool isPIC) const {
return JumpTableDirective; return isPIC ? PICJumpTableDirective : JumpTableDirective;
} }
const char *getAlignDirective() const { const char *getAlignDirective() const {
return AlignDirective; return AlignDirective;

@ -923,9 +923,7 @@ void ARMAsmPrinter::printJTBlockOperand(const MachineInstr *MI, int OpNum) {
O << TAI->getPrivateGlobalPrefix() << "JTI" << getFunctionNumber() O << TAI->getPrivateGlobalPrefix() << "JTI" << getFunctionNumber()
<< '_' << JTI << '_' << MO2.getImm() << ":\n"; << '_' << JTI << '_' << MO2.getImm() << ":\n";
const char *JTEntryDirective = TAI->getJumpTableDirective(); const char *JTEntryDirective = TAI->getData32bitsDirective();
if (!JTEntryDirective)
JTEntryDirective = TAI->getData32bitsDirective();
const MachineFunction *MF = MI->getParent()->getParent(); const MachineFunction *MF = MI->getParent()->getParent();
const MachineJumpTableInfo *MJTI = MF->getJumpTableInfo(); const MachineJumpTableInfo *MJTI = MF->getJumpTableInfo();
@ -947,10 +945,8 @@ void ARMAsmPrinter::printJTBlockOperand(const MachineInstr *MI, int OpNum) {
<< "_set_" << MBB->getNumber(); << "_set_" << MBB->getNumber();
else if (TM.getRelocationModel() == Reloc::PIC_) { else if (TM.getRelocationModel() == Reloc::PIC_) {
printBasicBlockLabel(MBB, false, false, false); printBasicBlockLabel(MBB, false, false, false);
// If the arch uses custom Jump Table directives, don't calc relative to JT O << '-' << TAI->getPrivateGlobalPrefix() << "JTI"
if (!TAI->getJumpTableDirective()) << getFunctionNumber() << '_' << JTI << '_' << MO2.getImm();
O << '-' << TAI->getPrivateGlobalPrefix() << "JTI"
<< getFunctionNumber() << '_' << JTI << '_' << MO2.getImm();
} else { } else {
printBasicBlockLabel(MBB, false, false, false); printBasicBlockLabel(MBB, false, false, false);
} }

@ -17,6 +17,6 @@ using namespace llvm;
AlphaTargetAsmInfo::AlphaTargetAsmInfo() { AlphaTargetAsmInfo::AlphaTargetAsmInfo() {
AlignmentIsInBytes = false; AlignmentIsInBytes = false;
PrivateGlobalPrefix = "$"; PrivateGlobalPrefix = "$";
JumpTableDirective = ".gprel32"; PICJumpTableDirective = ".gprel32";
WeakRefDirective = "\t.weak\t"; WeakRefDirective = "\t.weak\t";
} }

@ -24,7 +24,5 @@ MipsTargetAsmInfo::MipsTargetAsmInfo(const MipsTargetMachine &TM) {
PrivateGlobalPrefix = "$"; PrivateGlobalPrefix = "$";
CommentString = "#"; CommentString = "#";
ZeroDirective = "\t.space\t"; ZeroDirective = "\t.space\t";
PICJumpTableDirective = "\t.gpword\t";
if (TM.getRelocationModel() == Reloc::PIC_)
JumpTableDirective = "\t.gpword\t";
} }

@ -54,6 +54,7 @@ TargetAsmInfo::TargetAsmInfo() {
AlignmentIsInBytes = true; AlignmentIsInBytes = true;
TextAlignFillValue = 0; TextAlignFillValue = 0;
JumpTableDirective = 0; JumpTableDirective = 0;
PICJumpTableDirective = 0;
GlobalDirective = "\t.globl\t"; GlobalDirective = "\t.globl\t";
SetDirective = 0; SetDirective = 0;
LCOMMDirective = 0; LCOMMDirective = 0;