[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp SelectionDAG.cpp
Evan Cheng
evan.cheng at apple.com
Mon Aug 28 23:42:49 PDT 2006
Changes in directory llvm/lib/CodeGen/SelectionDAG:
DAGCombiner.cpp updated: 1.183 -> 1.184
SelectionDAG.cpp updated: 1.335 -> 1.336
---
Log message:
Move isCommutativeBinOp from SelectionDAG.cpp and DAGCombiner.cpp out. Make it a static method of SelectionDAG.
---
Diffs of the changes: (+3 -31)
DAGCombiner.cpp | 19 +++----------------
SelectionDAG.cpp | 15 ---------------
2 files changed, 3 insertions(+), 31 deletions(-)
Index: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.183 llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.184
--- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.183 Sun Aug 27 07:54:01 2006
+++ llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Tue Aug 29 01:42:35 2006
@@ -306,19 +306,6 @@
return false;
}
-// FIXME: This should probably go in the ISD class rather than being duplicated
-// in several files.
-static bool isCommutativeBinOp(unsigned Opcode) {
- switch (Opcode) {
- case ISD::ADD:
- case ISD::MUL:
- case ISD::AND:
- case ISD::OR:
- case ISD::XOR: return true;
- default: return false; // FIXME: Need commutative info for user ops!
- }
-}
-
SDOperand DAGCombiner::ReassociateOps(unsigned Opc, SDOperand N0, SDOperand N1){
MVT::ValueType VT = N0.getValueType();
// reassoc. (op (op x, c1), y) -> (op (op x, y), c1) iff x+c1 has one use
@@ -3456,7 +3443,7 @@
return DAG.getSetCC(VT, N0.getOperand(1), N1.getOperand(1), Cond);
if (N0.getOperand(1) == N1.getOperand(1))
return DAG.getSetCC(VT, N0.getOperand(0), N1.getOperand(0), Cond);
- if (isCommutativeBinOp(N0.getOpcode())) {
+ if (DAG.isCommutativeBinOp(N0.getOpcode())) {
// If X op Y == Y op X, try other combinations.
if (N0.getOperand(0) == N1.getOperand(1))
return DAG.getSetCC(VT, N0.getOperand(1), N1.getOperand(0), Cond);
@@ -3499,7 +3486,7 @@
return DAG.getSetCC(VT, N0.getOperand(1),
DAG.getConstant(0, N0.getValueType()), Cond);
if (N0.getOperand(1) == N1) {
- if (isCommutativeBinOp(N0.getOpcode()))
+ if (DAG.isCommutativeBinOp(N0.getOpcode()))
return DAG.getSetCC(VT, N0.getOperand(0),
DAG.getConstant(0, N0.getValueType()), Cond);
else {
@@ -3521,7 +3508,7 @@
return DAG.getSetCC(VT, N1.getOperand(1),
DAG.getConstant(0, N1.getValueType()), Cond);
} else if (N1.getOperand(1) == N0) {
- if (isCommutativeBinOp(N1.getOpcode())) {
+ if (DAG.isCommutativeBinOp(N1.getOpcode())) {
return DAG.getSetCC(VT, N1.getOperand(0),
DAG.getConstant(0, N1.getValueType()), Cond);
} else {
Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.335 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.336
--- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.335 Sun Aug 27 03:08:54 2006
+++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Tue Aug 29 01:42:35 2006
@@ -38,21 +38,6 @@
return Res;
}
-static bool isCommutativeBinOp(unsigned Opcode) {
- switch (Opcode) {
- case ISD::ADD:
- case ISD::MUL:
- case ISD::MULHU:
- case ISD::MULHS:
- case ISD::FADD:
- case ISD::FMUL:
- case ISD::AND:
- case ISD::OR:
- case ISD::XOR: return true;
- default: return false; // FIXME: Need commutative info for user ops!
- }
-}
-
// isInvertibleForFree - Return true if there is no cost to emitting the logical
// inverse of this node.
static bool isInvertibleForFree(SDOperand N) {
More information about the llvm-commits
mailing list