diff options
author | Chris Lattner <sabre@nondot.org> | 2010-01-26 04:05:28 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2010-01-26 04:05:28 +0000 |
commit | 85fe07866a3b240d9facef3b2f2ea81a0a8db018 (patch) | |
tree | 28dedd932f111891807cddc62af9e4d49268346d /lib | |
parent | c690aab230170badb38179d837a51b329a1a5d58 (diff) | |
download | llvm-85fe07866a3b240d9facef3b2f2ea81a0a8db018.tar.gz llvm-85fe07866a3b240d9facef3b2f2ea81a0a8db018.tar.bz2 llvm-85fe07866a3b240d9facef3b2f2ea81a0a8db018.tar.xz |
Add support for target-specific 32-bit custom-lowered
jump table entries.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94505 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/CodeGen/AsmPrinter/AsmPrinter.cpp | 11 | ||||
-rw-r--r-- | lib/CodeGen/MachineFunction.cpp | 2 | ||||
-rw-r--r-- | lib/ExecutionEngine/JIT/JITEmitter.cpp | 1 |
3 files changed, 9 insertions, 5 deletions
diff --git a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp index 28937797a8..fd6d182702 100644 --- a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp +++ b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp @@ -479,12 +479,10 @@ void AsmPrinter::EmitJumpTableInfo(MachineFunction &MF) { // Pick the directive to use to print the jump table entries, and switch to // the appropriate section. - TargetLowering *LoweringInfo = TM.getTargetLowering(); - const Function *F = MF.getFunction(); bool JTInDiffSection = false; if (F->isWeakForLinker() || - (IsPic && !LoweringInfo->usesGlobalOffsetTable())) { + (IsPic && !TM.getTargetLowering()->usesGlobalOffsetTable())) { // In PIC mode, we need to emit the jump table to the same section as the // function body itself, otherwise the label differences won't make sense. // We should also do if the section name is NULL or function is declared in @@ -546,12 +544,15 @@ void AsmPrinter::printPICJumpTableEntry(const MachineJumpTableInfo *MJTI, unsigned uid) const { const MCExpr *Value = 0; switch (MJTI->getEntryKind()) { + case MachineJumpTableInfo::EK_Custom32: + Value = TM.getTargetLowering()->LowerCustomJumpTableEntry(MJTI, MBB, uid, + OutContext); + break; case MachineJumpTableInfo::EK_BlockAddress: // EK_BlockAddress - Each entry is a plain address of block, e.g.: // .word LBB123 Value = MCSymbolRefExpr::Create(GetMBBSymbol(MBB->getNumber()), OutContext); break; - case MachineJumpTableInfo::EK_GPRel32BlockAddress: { // EK_GPRel32BlockAddress - Each entry is an address of block, encoded // with a relocation as gp-relative, e.g.: @@ -560,7 +561,7 @@ void AsmPrinter::printPICJumpTableEntry(const MachineJumpTableInfo *MJTI, OutStreamer.EmitGPRel32Value(MCSymbolRefExpr::Create(MBBSym, OutContext)); return; } - + case MachineJumpTableInfo::EK_LabelDifference32: { // EK_LabelDifference32 - Each entry is the address of the block minus // the address of the jump table. This is used for PIC jump tables where diff --git a/lib/CodeGen/MachineFunction.cpp b/lib/CodeGen/MachineFunction.cpp index bea0445b15..cf3b8f056a 100644 --- a/lib/CodeGen/MachineFunction.cpp +++ b/lib/CodeGen/MachineFunction.cpp @@ -544,6 +544,7 @@ unsigned MachineJumpTableInfo::getEntrySize(const TargetData &TD) const { return TD.getPointerSize(); case MachineJumpTableInfo::EK_GPRel32BlockAddress: case MachineJumpTableInfo::EK_LabelDifference32: + case MachineJumpTableInfo::EK_Custom32: return 4; } assert(0 && "Unknown jump table encoding!"); @@ -560,6 +561,7 @@ unsigned MachineJumpTableInfo::getEntryAlignment(const TargetData &TD) const { return TD.getPointerABIAlignment(); case MachineJumpTableInfo::EK_GPRel32BlockAddress: case MachineJumpTableInfo::EK_LabelDifference32: + case MachineJumpTableInfo::EK_Custom32: return TD.getABIIntegerTypeAlignment(32); } assert(0 && "Unknown jump table encoding!"); diff --git a/lib/ExecutionEngine/JIT/JITEmitter.cpp b/lib/ExecutionEngine/JIT/JITEmitter.cpp index 291655353d..4d5857414b 100644 --- a/lib/ExecutionEngine/JIT/JITEmitter.cpp +++ b/lib/ExecutionEngine/JIT/JITEmitter.cpp @@ -1445,6 +1445,7 @@ void JITEmitter::emitJumpTableInfo(MachineJumpTableInfo *MJTI) { break; } + case MachineJumpTableInfo::EK_Custom32: case MachineJumpTableInfo::EK_GPRel32BlockAddress: case MachineJumpTableInfo::EK_LabelDifference32: { assert(MJTI->getEntrySize(*TheJIT->getTargetData()) == 4&&"Cross JIT'ing?"); |