2010-08-24 20:50:07 +02:00
|
|
|
//===- ValueMapper.h - Remapping for constants and metadata -----*- C++ -*-===//
|
2007-11-09 13:16:58 +01:00
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
2007-12-29 20:59:42 +01:00
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
2007-11-09 13:16:58 +01:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// This file defines the MapValue interface which is used by various parts of
|
|
|
|
// the Transforms/Utils library to implement cloning and linking facilities.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2010-08-24 20:50:07 +02:00
|
|
|
#ifndef LLVM_TRANSFORMS_UTILS_VALUEMAPPER_H
|
|
|
|
#define LLVM_TRANSFORMS_UTILS_VALUEMAPPER_H
|
2007-11-09 13:16:58 +01:00
|
|
|
|
2010-06-24 02:33:28 +02:00
|
|
|
#include "llvm/ADT/ValueMap.h"
|
2007-11-09 13:16:58 +01:00
|
|
|
|
|
|
|
namespace llvm {
|
|
|
|
class Value;
|
|
|
|
class Instruction;
|
2010-10-13 04:08:17 +02:00
|
|
|
typedef ValueMap<const Value *, TrackingVH<Value> > ValueToValueMapTy;
|
2007-11-09 13:16:58 +01:00
|
|
|
|
2011-01-08 09:15:20 +01:00
|
|
|
/// RemapFlags - These are flags that the value mapping APIs allow.
|
|
|
|
enum RemapFlags {
|
|
|
|
RF_None = 0,
|
|
|
|
|
|
|
|
/// RF_NoModuleLevelChanges - If this flag is set, the remapper knows that
|
|
|
|
/// only local values within a function (such as an instruction or argument)
|
|
|
|
/// are mapped, not global values like functions and global metadata.
|
|
|
|
RF_NoModuleLevelChanges = 1,
|
|
|
|
|
|
|
|
/// RF_IgnoreMissingEntries - If this flag is set, the remapper ignores
|
|
|
|
/// entries that are not in the value map. If it is unset, it aborts if an
|
|
|
|
/// operand is asked to be remapped which doesn't exist in the mapping.
|
|
|
|
RF_IgnoreMissingEntries = 2
|
|
|
|
};
|
|
|
|
|
|
|
|
static inline RemapFlags operator|(RemapFlags LHS, RemapFlags RHS) {
|
|
|
|
return RemapFlags(unsigned(LHS)|unsigned(RHS));
|
|
|
|
}
|
|
|
|
|
2010-08-26 17:41:53 +02:00
|
|
|
Value *MapValue(const Value *V, ValueToValueMapTy &VM,
|
2011-01-08 09:15:20 +01:00
|
|
|
RemapFlags Flags = RF_None);
|
2010-08-26 17:41:53 +02:00
|
|
|
void RemapInstruction(Instruction *I, ValueToValueMapTy &VM,
|
2011-01-08 09:15:20 +01:00
|
|
|
RemapFlags Flags = RF_None);
|
2007-11-09 13:16:58 +01:00
|
|
|
} // End llvm namespace
|
|
|
|
|
|
|
|
#endif
|