[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
Nate Begeman
natebegeman at mac.com
Thu Nov 17 23:43:07 PST 2005
Changes in directory llvm/lib/CodeGen/SelectionDAG:
SelectionDAGISel.cpp updated: 1.100 -> 1.101
---
Log message:
Split out the shift code from visitBinary.
---
Diffs of the changes: (+14 -7)
SelectionDAGISel.cpp | 21 ++++++++++++++-------
1 files changed, 14 insertions(+), 7 deletions(-)
Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.100 llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.101
--- llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.100 Wed Nov 16 01:22:30 2005
+++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Fri Nov 18 01:42:56 2005
@@ -347,7 +347,8 @@
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 @@
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::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));
}
More information about the llvm-commits
mailing list