1 //===- ValueMapper.h - Remapping for constants and metadata -----*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
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.
13 //===----------------------------------------------------------------------===//
15 #ifndef LLVM_TRANSFORMS_UTILS_VALUEMAPPER_H
16 #define LLVM_TRANSFORMS_UTILS_VALUEMAPPER_H
18 #include "llvm/ADT/ValueMap.h"
23 typedef ValueMap<const Value *, TrackingVH<Value> > ValueToValueMapTy;
25 /// RemapFlags - These are flags that the value mapping APIs allow.
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,
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
40 static inline RemapFlags operator|(RemapFlags LHS, RemapFlags RHS) {
41 return RemapFlags(unsigned(LHS)|unsigned(RHS));
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