diff options
author | Andrew Lenharth <andrewl@lenharth.org> | 2005-12-25 01:07:37 +0000 |
---|---|---|
committer | Andrew Lenharth <andrewl@lenharth.org> | 2005-12-25 01:07:37 +0000 |
commit | 30db2ec59f07aecb55cf385a87d7d6e0d67f873c (patch) | |
tree | dcf0e9df34428005afc74345979526dd082b13ae /llvm/lib/CodeGen | |
parent | 7259426d88b1e07533312b822fb7c58029400f56 (diff) | |
download | bcm5719-llvm-30db2ec59f07aecb55cf385a87d7d6e0d67f873c.tar.gz bcm5719-llvm-30db2ec59f07aecb55cf385a87d7d6e0d67f873c.zip |
allow custom lowering to return null for legal results
llvm-svn: 25007
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp | 32 |
1 files changed, 15 insertions, 17 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp index 1d684191219..1d9dd5c2c89 100644 --- a/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp @@ -1956,11 +1956,6 @@ SDOperand SelectionDAGLegalize::LegalizeOp(SDOperand Op) { break; } 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); @@ -1968,9 +1963,13 @@ SDOperand SelectionDAGLegalize::LegalizeOp(SDOperand Op) { Tmp = LegalizeOp(Tmp); // Relegalize input. AddLegalizedOperand(Op, Tmp); return Tmp; - } - break; + } //else it was considered legal and we fall through } + case TargetLowering::Legal: + if (Tmp1 != Node->getOperand(0) || + Tmp2 != Node->getOperand(1)) + Result = DAG.getNode(Node->getOpcode(), Node->getValueType(0), Tmp1,Tmp2); + break; default: assert(0 && "Operation not supported"); } @@ -2007,14 +2006,6 @@ SDOperand SelectionDAGLegalize::LegalizeOp(SDOperand Op) { Tmp1 = LegalizeOp(Node->getOperand(0)); // LHS Tmp2 = LegalizeOp(Node->getOperand(1)); // RHS 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::Promote: - 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); @@ -2022,9 +2013,16 @@ SDOperand SelectionDAGLegalize::LegalizeOp(SDOperand Op) { Tmp = LegalizeOp(Tmp); // Relegalize input. AddLegalizedOperand(Op, Tmp); return Tmp; - } - break; + } //else it was considered legal and we fall through } + 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::Promote: + assert(0 && "Cannot promote handle this yet!"); case TargetLowering::Expand: if (MVT::isInteger(Node->getValueType(0))) { MVT::ValueType VT = Node->getValueType(0); |