SmallVectorize.
[oota-llvm.git] / include / llvm / Analysis / PHITransAddr.h
index 1f4f3416da8dce53d088a0de329bb8224880a09c..033efba3e742b9d66cda9cc3c497ebabbb8f15b7 100644 (file)
@@ -66,9 +66,11 @@ public:
   bool IsPotentiallyPHITranslatable() const;
   
   /// PHITranslateValue - PHI translate the current address up the CFG from
-  /// CurBB to Pred, updating our state the reflect any needed changes.  This
-  /// returns true on failure and sets Addr to null.
-  bool PHITranslateValue(BasicBlock *CurBB, BasicBlock *PredBB);
+  /// CurBB to Pred, updating our state to reflect any needed changes.  If the
+  /// dominator tree DT is non-null, the translated value must dominate
+  /// PredBB.  This returns true on failure and sets Addr to null.
+  bool PHITranslateValue(BasicBlock *CurBB, BasicBlock *PredBB,
+                         const DominatorTree *DT);
   
   /// PHITranslateWithInsertion - PHI translate this value into the specified
   /// predecessor block, inserting a computation of the value if it is
@@ -80,15 +82,16 @@ public:
   Value *PHITranslateWithInsertion(BasicBlock *CurBB, BasicBlock *PredBB,
                                    const DominatorTree &DT,
                                    SmallVectorImpl<Instruction*> &NewInsts);
-private:
-  Value *PHITranslateSubExpr(Value *V, BasicBlock *CurBB, BasicBlock *PredBB);
   
+  void dump() const;
   
-  /// GetAvailablePHITranslatedSubExpr - Return the value computed by
-  /// PHITranslateSubExpr if it dominates PredBB, otherwise return null.
-  Value *GetAvailablePHITranslatedSubExpr(Value *V,
-                                          BasicBlock *CurBB, BasicBlock *PredBB,
-                                          const DominatorTree &DT) const;
+  /// Verify - Check internal consistency of this data structure.  If the
+  /// structure is valid, it returns true.  If invalid, it prints errors and
+  /// returns false.
+  bool Verify() const;
+private:
+  Value *PHITranslateSubExpr(Value *V, BasicBlock *CurBB, BasicBlock *PredBB,
+                             const DominatorTree *DT);
   
   /// InsertPHITranslatedSubExpr - Insert a computation of the PHI translated
   /// version of 'V' for the edge PredBB->CurBB into the end of the PredBB
@@ -98,6 +101,15 @@ private:
   Value *InsertPHITranslatedSubExpr(Value *InVal, BasicBlock *CurBB,
                                     BasicBlock *PredBB, const DominatorTree &DT,
                                     SmallVectorImpl<Instruction*> &NewInsts);
+  
+  /// AddAsInput - If the specified value is an instruction, add it as an input.
+  Value *AddAsInput(Value *V) {
+    // If V is an instruction, it is now an input.
+    if (Instruction *VI = dyn_cast<Instruction>(V))
+      InstInputs.push_back(VI);
+    return V;
+  }
+  
 };
 
 } // end namespace llvm