Add getPotentialPassManagerType(). No functionality change, yet.
[oota-llvm.git] / include / llvm / Analysis / ValueNumbering.h
index b337a22a675eedf884e6b5a085c1a9875019cfa8..f708f48382b9c113db8e1d9b36fbdde4be3b0962 100644 (file)
@@ -1,10 +1,10 @@
 //===- llvm/Analysis/ValueNumbering.h - Value #'ing Interface ---*- C++ -*-===//
-// 
+//
 //                     The LLVM Compiler Infrastructure
 //
 // This file was developed by the LLVM research group and is distributed under
 // the University of Illinois Open Source License. See LICENSE.TXT for details.
-// 
+//
 //===----------------------------------------------------------------------===//
 //
 // This file defines the abstract ValueNumbering interface, which is used as the
 namespace llvm {
 
 class Value;
+class Instruction;
 
 struct ValueNumbering {
+  virtual ~ValueNumbering();    // We want to be subclassed
 
   /// getEqualNumberNodes - Return nodes with the same value number as the
   /// specified Value.  This fills in the argument vector with any equal values.
@@ -35,13 +37,37 @@ struct ValueNumbering {
   virtual void getEqualNumberNodes(Value *V1,
                                    std::vector<Value*> &RetVals) const = 0;
 
-  virtual ~ValueNumbering();    // We want to be subclassed
-};
+  ///===-------------------------------------------------------------------===//
+  /// Interfaces to update value numbering analysis information as the client
+  /// changes the program.
+  ///
 
-extern void BasicValueNumberingStub();
-static IncludeFile
-HDR_INCLUDE_VALUENUMBERING_CPP((void*)&BasicValueNumberingStub);
+  /// deleteValue - This method should be called whenever an LLVM Value is
+  /// deleted from the program, for example when an instruction is found to be
+  /// redundant and is eliminated.
+  ///
+  virtual void deleteValue(Value *V) {}
+
+  /// copyValue - This method should be used whenever a preexisting value in the
+  /// program is copied or cloned, introducing a new value.  Note that analysis
+  /// implementations should tolerate clients that use this method to introduce
+  /// the same value multiple times: if the analysis already knows about a
+  /// value, it should ignore the request.
+  ///
+  virtual void copyValue(Value *From, Value *To) {}
+
+  /// replaceWithNewValue - This method is the obvious combination of the two
+  /// above, and it provided as a helper to simplify client code.
+  ///
+  void replaceWithNewValue(Value *Old, Value *New) {
+    copyValue(Old, New);
+    deleteValue(Old);
+  }
+};
 
 } // End llvm namespace
 
+// Force any file including this header to get the implementation as well
+FORCE_DEFINING_FILE_TO_BE_LINKED(BasicValueNumbering)
+
 #endif