Refactor the constant folding code into it's own function. And call it from both
[oota-llvm.git] / include / llvm / CodeGen / SelectionDAG.h
index 15d0edc3d8acbc741465e044caa5e0bbd53bea21..6ca8a8c861f8f5431b37592a320033bf8bcd24fb 100644 (file)
@@ -36,7 +36,8 @@ class MachineFunction;
 class MachineConstantPoolValue;
 class FunctionLoweringInfo;
 
-template<> class ilist_traits<SDNode> : public ilist_default_traits<SDNode> {
+template<> struct ilist_traits<SDNode> : public ilist_default_traits<SDNode> {
+private:
   mutable SDNode Sentinel;
 public:
   ilist_traits() : Sentinel(ISD::DELETED_NODE, SDVTList()) {}
@@ -696,9 +697,15 @@ public:
   /// at least that alignment.
   SDValue CreateStackTemporary(MVT VT, unsigned minAlign = 1);
   
+  /// FoldConstantArithmetic - 
+  SDValue FoldConstantArithmetic(unsigned Opcode,
+                                 MVT VT,
+                                 ConstantSDNode *Cst1,
+                                 ConstantSDNode *Cst2);
+
   /// FoldSetCC - Constant fold a setcc to true or false.
   SDValue FoldSetCC(MVT VT, SDValue N1,
-                      SDValue N2, ISD::CondCode Cond);
+                    SDValue N2, ISD::CondCode Cond);
   
   /// SignBitIsZero - Return true if the sign bit of Op is known to be zero.  We
   /// use this predicate to simplify operations downstream.