From: Richard Osborne Date: Thu, 11 Mar 2010 14:58:16 +0000 (+0000) Subject: Add a new jump table encoding to indicate jump tables entries X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=95da605e15a6f108b551ecc6772823ea53de3007;p=oota-llvm.git Add a new jump table encoding to indicate jump tables entries are inside the function by the target at the point of use. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98255 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/llvm/CodeGen/MachineJumpTableInfo.h b/include/llvm/CodeGen/MachineJumpTableInfo.h index 5a4c9a9fb76..b8d04bf2132 100644 --- a/include/llvm/CodeGen/MachineJumpTableInfo.h +++ b/include/llvm/CodeGen/MachineJumpTableInfo.h @@ -61,7 +61,11 @@ public: /// .set L4_5_set_123, LBB123 - LJTI1_2 /// .word L4_5_set_123 EK_LabelDifference32, - + + /// EK_Inline - Jump table entries are emitted inline at their point of + /// use. It is the responsibility of the target to emit the entries. + EK_Inline, + /// EK_Custom32 - Each entry is a 32-bit value that is custom lowered by the /// TargetLowering::LowerCustomJumpTableEntry hook. EK_Custom32 diff --git a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp index 4978fba44cd..53e1fab0593 100644 --- a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp +++ b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp @@ -651,6 +651,7 @@ void AsmPrinter::EmitConstantPool() { void AsmPrinter::EmitJumpTableInfo() { const MachineJumpTableInfo *MJTI = MF->getJumpTableInfo(); if (MJTI == 0) return; + if (MJTI->getEntryKind() == MachineJumpTableInfo::EK_Inline) return; const std::vector &JT = MJTI->getJumpTables(); if (JT.empty()) return; @@ -727,6 +728,8 @@ void AsmPrinter::EmitJumpTableEntry(const MachineJumpTableInfo *MJTI, unsigned UID) const { const MCExpr *Value = 0; switch (MJTI->getEntryKind()) { + case MachineJumpTableInfo::EK_Inline: + llvm_unreachable("Cannot emit EK_Inline jump table entry"); break; case MachineJumpTableInfo::EK_Custom32: Value = TM.getTargetLowering()->LowerCustomJumpTableEntry(MJTI, MBB, UID, OutContext); diff --git a/lib/CodeGen/MachineFunction.cpp b/lib/CodeGen/MachineFunction.cpp index 1e3cb1ee5a5..cecfa156264 100644 --- a/lib/CodeGen/MachineFunction.cpp +++ b/lib/CodeGen/MachineFunction.cpp @@ -574,6 +574,8 @@ unsigned MachineJumpTableInfo::getEntrySize(const TargetData &TD) const { case MachineJumpTableInfo::EK_LabelDifference32: case MachineJumpTableInfo::EK_Custom32: return 4; + case MachineJumpTableInfo::EK_Inline: + return 0; } assert(0 && "Unknown jump table encoding!"); return ~0; @@ -591,6 +593,8 @@ unsigned MachineJumpTableInfo::getEntryAlignment(const TargetData &TD) const { case MachineJumpTableInfo::EK_LabelDifference32: case MachineJumpTableInfo::EK_Custom32: return TD.getABIIntegerTypeAlignment(32); + case MachineJumpTableInfo::EK_Inline: + return 1; } assert(0 && "Unknown jump table encoding!"); return ~0; diff --git a/lib/ExecutionEngine/JIT/JITEmitter.cpp b/lib/ExecutionEngine/JIT/JITEmitter.cpp index 783ebb4deb6..26353f794f2 100644 --- a/lib/ExecutionEngine/JIT/JITEmitter.cpp +++ b/lib/ExecutionEngine/JIT/JITEmitter.cpp @@ -1393,6 +1393,8 @@ void JITEmitter::emitConstantPool(MachineConstantPool *MCP) { void JITEmitter::initJumpTableInfo(MachineJumpTableInfo *MJTI) { if (TheJIT->getJITInfo().hasCustomJumpTables()) return; + if (MJTI->getEntryKind() == MachineJumpTableInfo::EK_Inline) + return; const std::vector &JT = MJTI->getJumpTables(); if (JT.empty()) return; @@ -1420,6 +1422,8 @@ void JITEmitter::emitJumpTableInfo(MachineJumpTableInfo *MJTI) { switch (MJTI->getEntryKind()) { + case MachineJumpTableInfo::EK_Inline: + return; case MachineJumpTableInfo::EK_BlockAddress: { // EK_BlockAddress - Each entry is a plain address of block, e.g.: // .word LBB123