[llvm-commits] CVS: llvm/include/llvm/CodeGen/SelectionDAG.h SelectionDAGNodes.h

Nate Begeman natebegeman at mac.com
Wed Aug 10 13:50:53 PDT 2005



Changes in directory llvm/include/llvm/CodeGen:

SelectionDAG.h updated: 1.32 -> 1.33
SelectionDAGNodes.h updated: 1.46 -> 1.47
---
Log message:

Add new node, SELECT_CC.  This node is for targets that don't natively
implement SELECT.


---
Diffs of the changes:  (+21 -2)

 SelectionDAG.h      |   13 +++++++++++++
 SelectionDAGNodes.h |   10 ++++++++--
 2 files changed, 21 insertions(+), 2 deletions(-)


Index: llvm/include/llvm/CodeGen/SelectionDAG.h
diff -u llvm/include/llvm/CodeGen/SelectionDAG.h:1.32 llvm/include/llvm/CodeGen/SelectionDAG.h:1.33
--- llvm/include/llvm/CodeGen/SelectionDAG.h:1.32	Tue Aug  9 18:08:53 2005
+++ llvm/include/llvm/CodeGen/SelectionDAG.h	Wed Aug 10 15:50:42 2005
@@ -183,6 +183,19 @@
                      ISD::CondCode Cond) {
     return getNode(ISD::SETCC, VT, LHS, RHS, getCondCode(Cond));
   }
+
+  /// getSelectCC - Helper function to make it easier to build SelectCC's if you
+  /// just have an ISD::CondCode instead of an SDOperand.
+  ///
+  SDOperand getSelectCC(SDOperand LHS, SDOperand RHS,
+                        SDOperand True, SDOperand False, ISD::CondCode Cond) {
+    MVT::ValueType VT = True.getValueType();
+    assert(LHS.getValueType() == RHS.getValueType() &&
+           "LHS and RHS of condition must have same type!");
+    assert(True.getValueType() == False.getValueType() &&
+           "True and False arms of SelectCC must have same type!");
+    return getNode(ISD::SELECT_CC, VT, LHS, RHS, True, False,getCondCode(Cond));
+  }
   
   /// getLoad - Loads are not normal binary operators: their result type is not
   /// determined by their operands, and they produce a value AND a token chain.


Index: llvm/include/llvm/CodeGen/SelectionDAGNodes.h
diff -u llvm/include/llvm/CodeGen/SelectionDAGNodes.h:1.46 llvm/include/llvm/CodeGen/SelectionDAGNodes.h:1.47
--- llvm/include/llvm/CodeGen/SelectionDAGNodes.h:1.46	Tue Aug  9 15:19:34 2005
+++ llvm/include/llvm/CodeGen/SelectionDAGNodes.h	Wed Aug 10 15:50:42 2005
@@ -103,8 +103,14 @@
     // Counting operators
     CTTZ, CTLZ, CTPOP,
 
-    // Select operator.
-    SELECT,
+    // Select
+    SELECT, 
+    
+    // Select with condition operator - This selects between a true value and 
+    // a false value (ops #2 and #3) based on the boolean result of comparing
+    // the lhs and rhs (ops #0 and #1) of a conditional expression with the 
+    // condition code in op #4, a CondCodeSDNode.
+    SELECT_CC,
 
     // SetCC operator - This evaluates to a boolean (i1) true value if the
     // condition is true.  The operands to this are the left and right operands






More information about the llvm-commits mailing list