diff options
author | Nate Begeman <natebegeman@mac.com> | 2005-11-18 07:42:56 +0000 |
---|---|---|
committer | Nate Begeman <natebegeman@mac.com> | 2005-11-18 07:42:56 +0000 |
commit | e21ea61588996609f827213a2701a204f2f13fb3 (patch) | |
tree | a02f4af31d152ce5ad4820ea5508884920f6c58d | |
parent | 36ba5006df1dee8bb8789ee817f169af022ae239 (diff) |
Split out the shift code from visitBinary.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24412 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp b/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp index 53d97e7b7c..5f488a4e26 100644 --- a/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp +++ b/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp @@ -347,7 +347,8 @@ public: void visitUnwind(UnwindInst &I) { assert(0 && "TODO"); } // - void visitBinary(User &I, unsigned Opcode, bool isShift = false); + void visitBinary(User &I, unsigned Opcode); + void visitShift(User &I, unsigned Opcode); void visitAdd(User &I) { visitBinary(I, I.getType()->isFloatingPoint() ? ISD::FADD : ISD::ADD); } @@ -380,9 +381,9 @@ public: void visitAnd(User &I) { visitBinary(I, ISD::AND); } void visitOr (User &I) { visitBinary(I, ISD::OR); } void visitXor(User &I) { visitBinary(I, ISD::XOR); } - void visitShl(User &I) { visitBinary(I, ISD::SHL, true); } - void visitShr(User &I) { - visitBinary(I, I.getType()->isUnsigned() ? ISD::SRL : ISD::SRA, true); + void visitShl(User &I) { visitShift(I, ISD::SHL); } + void visitShr(User &I) { + visitShift(I, I.getType()->isUnsigned() ? ISD::SRL : ISD::SRA); } void visitSetCC(User &I, ISD::CondCode SignedOpc, ISD::CondCode UnsignedOpc); @@ -520,13 +521,19 @@ void SelectionDAGLowering::visitSub(User &I) { } } -void SelectionDAGLowering::visitBinary(User &I, unsigned Opcode, bool isShift) { +void SelectionDAGLowering::visitBinary(User &I, unsigned Opcode) { SDOperand Op1 = getValue(I.getOperand(0)); SDOperand Op2 = getValue(I.getOperand(1)); - if (isShift) - Op2 = DAG.getNode(ISD::ANY_EXTEND, TLI.getShiftAmountTy(), Op2); + setValue(&I, DAG.getNode(Opcode, Op1.getValueType(), Op1, Op2)); +} +void SelectionDAGLowering::visitShift(User &I, unsigned Opcode) { + SDOperand Op1 = getValue(I.getOperand(0)); + SDOperand Op2 = getValue(I.getOperand(1)); + + Op2 = DAG.getNode(ISD::ANY_EXTEND, TLI.getShiftAmountTy(), Op2); + setValue(&I, DAG.getNode(Opcode, Op1.getValueType(), Op1, Op2)); } |