[llvm-commits] CVS: llvm/include/llvm/Analysis/ValueNumbering.h

Chris Lattner lattner at cs.uiuc.edu
Sun May 23 16:15:20 PDT 2004


Changes in directory llvm/include/llvm/Analysis:

ValueNumbering.h updated: 1.6 -> 1.7

---
Log message:

Add interfaces to update value numbering results


---
Diffs of the changes:  (+22 -5)

Index: llvm/include/llvm/Analysis/ValueNumbering.h
diff -u llvm/include/llvm/Analysis/ValueNumbering.h:1.6 llvm/include/llvm/Analysis/ValueNumbering.h:1.7
--- llvm/include/llvm/Analysis/ValueNumbering.h:1.6	Sat Apr 10 17:32:47 2004
+++ llvm/include/llvm/Analysis/ValueNumbering.h	Sun May 23 16:11:17 2004
@@ -39,13 +39,30 @@
 
   ///===-------------------------------------------------------------------===//
   /// Interfaces to update value numbering analysis information as the client
-  /// changes the program
+  /// changes the program.
   ///
 
-  /// deleteInstruction - Clients should invoke this method when they delete an
-  /// instruction from the program.  This allows the analysis implementations to
-  /// avoid having dangling pointers in their representation.
-  virtual void deleteInstruction(Instruction *I) {}
+  /// 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);
+  }
 };
 
 extern void BasicValueNumberingStub();





More information about the llvm-commits mailing list