aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
diff options
context:
space:
mode:
authorNate Begeman <natebegeman@mac.com>2006-04-22 18:53:45 +0000
committerNate Begeman <natebegeman@mac.com>2006-04-22 18:53:45 +0000
commit37efe6764568a3829fee26aba532283131d1a104 (patch)
tree5729b1d1477bb72a5a4f83494638aab63e54f522 /lib/CodeGen/SelectionDAG/SelectionDAG.cpp
parent1900c012f5f15063a9349f6646d7dd1654df38f9 (diff)
JumpTable support! What this represents is working asm and jit support for
x86 and ppc for 100% dense switch statements when relocations are non-PIC. This support will be extended and enhanced in the coming days to support PIC, and less dense forms of jump tables. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@27947 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/SelectionDAG/SelectionDAG.cpp')
-rw-r--r--lib/CodeGen/SelectionDAG/SelectionDAG.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
index ec1050fd72..c26632a41e 100644
--- a/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
+++ b/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
@@ -387,6 +387,13 @@ void SelectionDAG::RemoveNodeFromCSEMaps(SDNode *N) {
case ISD::TargetFrameIndex:
Erased = TargetFrameIndices.erase(cast<FrameIndexSDNode>(N)->getIndex());
break;
+ case ISD::JumpTable:
+ Erased = JumpTableIndices.erase(cast<JumpTableSDNode>(N)->getIndex());
+ break;
+ case ISD::TargetJumpTable:
+ Erased =
+ TargetJumpTableIndices.erase(cast<JumpTableSDNode>(N)->getIndex());
+ break;
case ISD::ConstantPool:
Erased = ConstantPoolIndices.
erase(std::make_pair(cast<ConstantPoolSDNode>(N)->get(),
@@ -741,6 +748,22 @@ SDOperand SelectionDAG::getTargetFrameIndex(int FI, MVT::ValueType VT) {
return SDOperand(N, 0);
}
+SDOperand SelectionDAG::getJumpTable(int JTI, MVT::ValueType VT) {
+ SDNode *&N = JumpTableIndices[JTI];
+ if (N) return SDOperand(N, 0);
+ N = new JumpTableSDNode(JTI, VT, false);
+ AllNodes.push_back(N);
+ return SDOperand(N, 0);
+}
+
+SDOperand SelectionDAG::getTargetJumpTable(int JTI, MVT::ValueType VT) {
+ SDNode *&N = TargetJumpTableIndices[JTI];
+ if (N) return SDOperand(N, 0);
+ N = new JumpTableSDNode(JTI, VT, true);
+ AllNodes.push_back(N);
+ return SDOperand(N, 0);
+}
+
SDOperand SelectionDAG::getConstantPool(Constant *C, MVT::ValueType VT,
unsigned Alignment, int Offset) {
SDNode *&N = ConstantPoolIndices[std::make_pair(C,
@@ -2742,6 +2765,7 @@ const char *SDNode::getOperationName(const SelectionDAG *G) const {
case ISD::ConstantFP: return "ConstantFP";
case ISD::GlobalAddress: return "GlobalAddress";
case ISD::FrameIndex: return "FrameIndex";
+ case ISD::JumpTable: return "JumpTable";
case ISD::ConstantPool: return "ConstantPool";
case ISD::ExternalSymbol: return "ExternalSymbol";
case ISD::INTRINSIC_WO_CHAIN: {
@@ -2759,6 +2783,7 @@ const char *SDNode::getOperationName(const SelectionDAG *G) const {
case ISD::TargetConstantFP:return "TargetConstantFP";
case ISD::TargetGlobalAddress: return "TargetGlobalAddress";
case ISD::TargetFrameIndex: return "TargetFrameIndex";
+ case ISD::TargetJumpTable: return "TargetJumpTable";
case ISD::TargetConstantPool: return "TargetConstantPool";
case ISD::TargetExternalSymbol: return "TargetExternalSymbol";
@@ -2849,6 +2874,7 @@ const char *SDNode::getOperationName(const SelectionDAG *G) const {
// Control flow instructions
case ISD::BR: return "br";
+ case ISD::BRIND: return "brind";
case ISD::BRCOND: return "brcond";
case ISD::BR_CC: return "br_cc";
case ISD::RET: return "ret";