diff options
author | Andrew Lenharth <andrewl@lenharth.org> | 2006-09-18 18:01:03 +0000 |
---|---|---|
committer | Andrew Lenharth <andrewl@lenharth.org> | 2006-09-18 18:01:03 +0000 |
commit | ea4f9d580190d81e383dda436eaca0730ed4ff55 (patch) | |
tree | 83a72c9b0944e264dba894f12e2bf46a4930e49a /lib/Target/Alpha/AlphaISelLowering.cpp | |
parent | 303c6222a437bfabf4c1bfd1e00b3481dcda4755 (diff) | |
download | llvm-ea4f9d580190d81e383dda436eaca0730ed4ff55.tar.gz llvm-ea4f9d580190d81e383dda436eaca0730ed4ff55.tar.bz2 llvm-ea4f9d580190d81e383dda436eaca0730ed4ff55.tar.xz |
Jump tables on Alpha
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30463 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/Alpha/AlphaISelLowering.cpp')
-rw-r--r-- | lib/Target/Alpha/AlphaISelLowering.cpp | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/lib/Target/Alpha/AlphaISelLowering.cpp b/lib/Target/Alpha/AlphaISelLowering.cpp index a9649ab9a3..bcd60ed753 100644 --- a/lib/Target/Alpha/AlphaISelLowering.cpp +++ b/lib/Target/Alpha/AlphaISelLowering.cpp @@ -48,7 +48,7 @@ AlphaTargetLowering::AlphaTargetLowering(TargetMachine &TM) : TargetLowering(TM) addRegisterClass(MVT::f64, Alpha::F8RCRegisterClass); addRegisterClass(MVT::f32, Alpha::F4RCRegisterClass); - setOperationAction(ISD::BRIND, MVT::i64, Expand); + // setOperationAction(ISD::BRIND, MVT::i64, Expand); setOperationAction(ISD::BR_CC, MVT::Other, Expand); setOperationAction(ISD::SELECT_CC, MVT::Other, Expand); @@ -128,6 +128,8 @@ AlphaTargetLowering::AlphaTargetLowering(TargetMachine &TM) : TargetLowering(TM) setOperationAction(ISD::RET, MVT::Other, Custom); + setOperationAction(ISD::JumpTable, MVT::i64, Custom); + setStackPointerRegisterToSaveRestore(Alpha::R30); setOperationAction(ISD::ConstantFP, MVT::f64, Expand); @@ -162,6 +164,20 @@ const char *AlphaTargetLowering::getTargetNodeName(unsigned Opcode) const { } } +static SDOperand LowerJumpTable(SDOperand Op, SelectionDAG &DAG) { + MVT::ValueType PtrVT = Op.getValueType(); + JumpTableSDNode *JT = cast<JumpTableSDNode>(Op); + SDOperand JTI = DAG.getTargetJumpTable(JT->getIndex(), PtrVT); + SDOperand Zero = DAG.getConstant(0, PtrVT); + + const TargetMachine &TM = DAG.getTarget(); + + SDOperand Hi = DAG.getNode(AlphaISD::GPRelHi, MVT::i64, JTI, + DAG.getNode(AlphaISD::GlobalBaseReg, MVT::i64)); + SDOperand Lo = DAG.getNode(AlphaISD::GPRelLo, MVT::i64, JTI, Hi); + return Lo; +} + //http://www.cs.arizona.edu/computer.help/policy/DIGITAL_unix/ //AA-PY8AC-TET1_html/callCH3.html#BLOCK21 @@ -395,6 +411,8 @@ SDOperand AlphaTargetLowering::LowerOperation(SDOperand Op, SelectionDAG &DAG) { VarArgsOffset, GP, RA); case ISD::RET: return LowerRET(Op,DAG, getVRegRA()); + case ISD::JumpTable: return LowerJumpTable(Op, DAG); + case ISD::SINT_TO_FP: { assert(MVT::i64 == Op.getOperand(0).getValueType() && "Unhandled SINT_TO_FP type in custom expander!"); |