Add file with warning for backward comptibility. Should be removed after 2.4
[oota-llvm.git] / include / llvm / Analysis / ValueNumbering.h
1 //===- llvm/Analysis/ValueNumbering.h - Value #'ing Interface ---*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file defines the abstract ValueNumbering interface, which is used as the
11 // common interface used by all clients of value numbering information, and
12 // implemented by all value numbering implementations.
13 //
14 // Implementations of this interface must implement the various virtual methods,
15 // which automatically provides functionality for the entire suite of client
16 // APIs.
17 //
18 //===----------------------------------------------------------------------===//
19
20 #ifndef LLVM_ANALYSIS_VALUE_NUMBERING_H
21 #define LLVM_ANALYSIS_VALUE_NUMBERING_H
22
23 #include <vector>
24 #include "llvm/Pass.h"
25 #include "llvm/System/IncludeFile.h"
26
27 namespace llvm {
28
29 class Value;
30 class Instruction;
31
32 struct ValueNumbering {
33   static char ID; // Class identification, replacement for typeinfo
34   virtual ~ValueNumbering();    // We want to be subclassed
35
36   /// getEqualNumberNodes - Return nodes with the same value number as the
37   /// specified Value.  This fills in the argument vector with any equal values.
38   ///
39   virtual void getEqualNumberNodes(Value *V1,
40                                    std::vector<Value*> &RetVals) const = 0;
41
42   ///===-------------------------------------------------------------------===//
43   /// Interfaces to update value numbering analysis information as the client
44   /// changes the program.
45   ///
46
47   /// deleteValue - This method should be called whenever an LLVM Value is
48   /// deleted from the program, for example when an instruction is found to be
49   /// redundant and is eliminated.
50   ///
51   virtual void deleteValue(Value *V) {}
52
53   /// copyValue - This method should be used whenever a preexisting value in the
54   /// program is copied or cloned, introducing a new value.  Note that analysis
55   /// implementations should tolerate clients that use this method to introduce
56   /// the same value multiple times: if the analysis already knows about a
57   /// value, it should ignore the request.
58   ///
59   virtual void copyValue(Value *From, Value *To) {}
60
61   /// replaceWithNewValue - This method is the obvious combination of the two
62   /// above, and it provided as a helper to simplify client code.
63   ///
64   void replaceWithNewValue(Value *Old, Value *New) {
65     copyValue(Old, New);
66     deleteValue(Old);
67   }
68 };
69
70 } // End llvm namespace
71
72 // Force any file including this header to get the implementation as well
73 FORCE_DEFINING_FILE_TO_BE_LINKED(BasicValueNumbering)
74
75 #endif