diff options
author | Andrew Lenharth <andrewl@lenharth.org> | 2005-12-24 23:42:32 +0000 |
---|---|---|
committer | Andrew Lenharth <andrewl@lenharth.org> | 2005-12-24 23:42:32 +0000 |
commit | e8f65f1e62ea1d4f2ca9fd0137ae2e0ce20e26e1 (patch) | |
tree | 443733c4ce8b7d32df8cd3766996cee2d3056fb9 | |
parent | 330851a8f6cc7cf8ccf54ade63b5d58614c0218e (diff) |
Support Custom lowering of a few more operations.
Alpha needs to custom lower *DIV and *REM
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25006 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/CodeGen/SelectionDAG/LegalizeDAG.cpp | 36 |
1 files changed, 31 insertions, 5 deletions
diff --git a/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp b/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp index af1d47697a..1d68419121 100644 --- a/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp +++ b/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp @@ -537,6 +537,7 @@ SDOperand SelectionDAGLegalize::LegalizeOp(SDOperand Op) { case ISD::GlobalAddress: case ISD::TargetGlobalAddress: case ISD::ExternalSymbol: + case ISD::TargetExternalSymbol: case ISD::ConstantPool: // Nothing to do. case ISD::BasicBlock: case ISD::CONDCODE: @@ -1954,9 +1955,25 @@ SDOperand SelectionDAGLegalize::LegalizeOp(SDOperand Op) { Tmp2 = PromoteOp(Node->getOperand(1)); // Promote the RHS. break; } - if (Tmp1 != Node->getOperand(0) || - Tmp2 != Node->getOperand(1)) - Result = DAG.getNode(Node->getOpcode(), Node->getValueType(0), Tmp1,Tmp2); + switch (TLI.getOperationAction(Node->getOpcode(), Node->getValueType(0))) { + case TargetLowering::Legal: + if (Tmp1 != Node->getOperand(0) || + Tmp2 != Node->getOperand(1)) + Result = DAG.getNode(Node->getOpcode(), Node->getValueType(0), Tmp1,Tmp2); + break; + case TargetLowering::Custom: { + Result = DAG.getNode(Node->getOpcode(), Node->getValueType(0), Tmp1, Tmp2); + SDOperand Tmp = TLI.LowerOperation(Result, DAG); + if (Tmp.Val) { + Tmp = LegalizeOp(Tmp); // Relegalize input. + AddLegalizedOperand(Op, Tmp); + return Tmp; + } + break; + } + default: + assert(0 && "Operation not supported"); + } break; case ISD::BUILD_PAIR: { @@ -1997,8 +2014,17 @@ SDOperand SelectionDAGLegalize::LegalizeOp(SDOperand Op) { Tmp2); break; case TargetLowering::Promote: - case TargetLowering::Custom: - assert(0 && "Cannot promote/custom handle this yet!"); + assert(0 && "Cannot promote handle this yet!"); + case TargetLowering::Custom: { + Result = DAG.getNode(Node->getOpcode(), Node->getValueType(0), Tmp1, Tmp2); + SDOperand Tmp = TLI.LowerOperation(Result, DAG); + if (Tmp.Val) { + Tmp = LegalizeOp(Tmp); // Relegalize input. + AddLegalizedOperand(Op, Tmp); + return Tmp; + } + break; + } case TargetLowering::Expand: if (MVT::isInteger(Node->getValueType(0))) { MVT::ValueType VT = Node->getValueType(0); |