]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/include/llvm/Transforms/Utils/ValueMapper.h
Upgrade our copy of llvm/clang to r126079, from upstream's trunk.
[FreeBSD/FreeBSD.git] / contrib / llvm / include / llvm / Transforms / Utils / ValueMapper.h
1 //===- ValueMapper.h - Remapping for constants and metadata -----*- 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 MapValue interface which is used by various parts of
11 // the Transforms/Utils library to implement cloning and linking facilities.
12 //
13 //===----------------------------------------------------------------------===//
14
15 #ifndef LLVM_TRANSFORMS_UTILS_VALUEMAPPER_H
16 #define LLVM_TRANSFORMS_UTILS_VALUEMAPPER_H
17
18 #include "llvm/ADT/ValueMap.h"
19
20 namespace llvm {
21   class Value;
22   class Instruction;
23   typedef ValueMap<const Value *, TrackingVH<Value> > ValueToValueMapTy;
24
25   /// RemapFlags - These are flags that the value mapping APIs allow.
26   enum RemapFlags {
27     RF_None = 0,
28     
29     /// RF_NoModuleLevelChanges - If this flag is set, the remapper knows that
30     /// only local values within a function (such as an instruction or argument)
31     /// are mapped, not global values like functions and global metadata.
32     RF_NoModuleLevelChanges = 1,
33     
34     /// RF_IgnoreMissingEntries - If this flag is set, the remapper ignores
35     /// entries that are not in the value map.  If it is unset, it aborts if an
36     /// operand is asked to be remapped which doesn't exist in the mapping.
37     RF_IgnoreMissingEntries = 2
38   };
39   
40   static inline RemapFlags operator|(RemapFlags LHS, RemapFlags RHS) {
41     return RemapFlags(unsigned(LHS)|unsigned(RHS));
42   }
43   
44   Value *MapValue(const Value *V, ValueToValueMapTy &VM,
45                   RemapFlags Flags = RF_None);
46   void RemapInstruction(Instruction *I, ValueToValueMapTy &VM,
47                         RemapFlags Flags = RF_None);
48 } // End llvm namespace
49
50 #endif