0ce8336afe67221d11b0b6fe5e57f0051da6248c
[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 was developed by the LLVM research group and is distributed under
6 // the University of Illinois Open Source 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
26 namespace llvm {
27
28 class Value;
29
30 struct ValueNumbering {
31   virtual ~ValueNumbering();    // We want to be subclassed
32
33   /// getEqualNumberNodes - Return nodes with the same value number as the
34   /// specified Value.  This fills in the argument vector with any equal values.
35   ///
36   virtual void getEqualNumberNodes(Value *V1,
37                                    std::vector<Value*> &RetVals) const = 0;
38
39   ///===-------------------------------------------------------------------===//
40   /// Interfaces to update value numbering analysis information as the client
41   /// changes the program
42   ///
43
44   /// deleteInstruction - Clients should invoke this method when they delete an
45   /// instruction from the program.  This allows the analysis implementations to
46   /// avoid having dangling pointers in their representation.
47   virtual void deleteInstruction(Instruction *I) {}
48 };
49
50 extern void BasicValueNumberingStub();
51 static IncludeFile
52 HDR_INCLUDE_VALUENUMBERING_CPP((void*)&BasicValueNumberingStub);
53
54 } // End llvm namespace
55
56 #endif