LLVM API Documentation
00001 //===- llvm/Analysis/ValueNumbering.h - Value #'ing Interface ---*- C++ -*-===// 00002 // 00003 // The LLVM Compiler Infrastructure 00004 // 00005 // This file was developed by the LLVM research group and is distributed under 00006 // the University of Illinois Open Source License. See LICENSE.TXT for details. 00007 // 00008 //===----------------------------------------------------------------------===// 00009 // 00010 // This file defines the abstract ValueNumbering interface, which is used as the 00011 // common interface used by all clients of value numbering information, and 00012 // implemented by all value numbering implementations. 00013 // 00014 // Implementations of this interface must implement the various virtual methods, 00015 // which automatically provides functionality for the entire suite of client 00016 // APIs. 00017 // 00018 //===----------------------------------------------------------------------===// 00019 00020 #ifndef LLVM_ANALYSIS_VALUE_NUMBERING_H 00021 #define LLVM_ANALYSIS_VALUE_NUMBERING_H 00022 00023 #include <vector> 00024 #include "llvm/Pass.h" 00025 00026 namespace llvm { 00027 00028 class Value; 00029 class Instruction; 00030 00031 struct ValueNumbering { 00032 virtual ~ValueNumbering(); // We want to be subclassed 00033 00034 /// getEqualNumberNodes - Return nodes with the same value number as the 00035 /// specified Value. This fills in the argument vector with any equal values. 00036 /// 00037 virtual void getEqualNumberNodes(Value *V1, 00038 std::vector<Value*> &RetVals) const = 0; 00039 00040 ///===-------------------------------------------------------------------===// 00041 /// Interfaces to update value numbering analysis information as the client 00042 /// changes the program. 00043 /// 00044 00045 /// deleteValue - This method should be called whenever an LLVM Value is 00046 /// deleted from the program, for example when an instruction is found to be 00047 /// redundant and is eliminated. 00048 /// 00049 virtual void deleteValue(Value *V) {} 00050 00051 /// copyValue - This method should be used whenever a preexisting value in the 00052 /// program is copied or cloned, introducing a new value. Note that analysis 00053 /// implementations should tolerate clients that use this method to introduce 00054 /// the same value multiple times: if the analysis already knows about a 00055 /// value, it should ignore the request. 00056 /// 00057 virtual void copyValue(Value *From, Value *To) {} 00058 00059 /// replaceWithNewValue - This method is the obvious combination of the two 00060 /// above, and it provided as a helper to simplify client code. 00061 /// 00062 void replaceWithNewValue(Value *Old, Value *New) { 00063 copyValue(Old, New); 00064 deleteValue(Old); 00065 } 00066 }; 00067 00068 } // End llvm namespace 00069 00070 // Force any file including this header to get the implementation as well 00071 FORCE_DEFINING_FILE_TO_BE_LINKED(BasicValueNumbering) 00072 00073 #endif