15 #ifndef LLVM_TRANSFORMS_UTILS_VALUEMAPPER_H
16 #define LLVM_TRANSFORMS_UTILS_VALUEMAPPER_H
29 virtual void anchor();
41 virtual void anchor();
92 return RemapFlags(
unsigned(LHS) |
unsigned(RHS));
95 class ValueMapperImpl;
171 unsigned MappingContextID = 0);
175 unsigned MappingContextID = 0);
177 unsigned MappingContextID = 0);
void RemapFunction(Function &F, ValueToValueMapTy &VM, RemapFlags Flags=RF_None, ValueMapTypeRemapper *TypeMapper=nullptr, ValueMaterializer *Materializer=nullptr)
Remap the operands, metadata, arguments, and instructions of a function.
Any global values not in value map are mapped to null instead of mapping to self. ...
virtual ~ValueMapTypeRemapper()
Context for (re-)mapping values (and metadata).
void scheduleRemapFunction(Function &F, unsigned MappingContextID=0)
Metadata * MapMetadata(const Metadata *MD, ValueToValueMapTy &VM, RemapFlags Flags=RF_None, ValueMapTypeRemapper *TypeMapper=nullptr, ValueMaterializer *Materializer=nullptr)
Lookup or compute a mapping for a piece of metadata.
struct fuzzer::@269 Flags
void remapInstruction(Instruction &I)
Constant * mapConstant(const Constant &C)
SmallBitVector operator|(const SmallBitVector &LHS, const SmallBitVector &RHS)
Metadata * mapMetadata(const Metadata &MD)
Instruct the remapper to move distinct metadata instead of duplicating it when there are module-level...
ValueMaterializer()=default
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
If this flag is set, the remapper knows that only local values within a function (such as an instruct...
This is a class that can be implemented by clients to materialize Values on demand.
The instances of the Type class are immutable: once they are created, they are never changed...
This is an important base class in LLVM.
~ValueMaterializer()=default
void scheduleMapGlobalInitializer(GlobalVariable &GV, Constant &Init, unsigned MappingContextID=0)
ValueMap< const Value *, WeakVH > ValueToValueMapTy
RemapFlags
These are flags that the value mapping APIs allow.
Value * MapValue(const Value *V, ValueToValueMapTy &VM, RemapFlags Flags=RF_None, ValueMapTypeRemapper *TypeMapper=nullptr, ValueMaterializer *Materializer=nullptr)
Look up or compute a value in the value map.
ValueMaterializer & operator=(const ValueMaterializer &)=default
void scheduleMapAppendingVariable(GlobalVariable &GV, Constant *InitPrefix, bool IsOldCtorDtor, ArrayRef< Constant * > NewMembers, unsigned MappingContextID=0)
void remapFunction(Function &F)
void scheduleMapGlobalAliasee(GlobalAlias &GA, Constant &Aliasee, unsigned MappingContextID=0)
static GCRegistry::Add< ShadowStackGC > C("shadow-stack","Very portable GC for uncooperative code generators")
void RemapInstruction(Instruction *I, ValueToValueMapTy &VM, RemapFlags Flags=RF_None, ValueMapTypeRemapper *TypeMapper=nullptr, ValueMaterializer *Materializer=nullptr)
Convert the instruction operands from referencing the current values into those specified by VM...
This is a class that can be implemented by clients to remap types when cloning constants and instruct...
If this flag is set, the remapper ignores missing function-local entries (Argument, Instruction, BasicBlock) that are not in the value map.
virtual Value * materialize(Value *V)=0
This method can be implemented to generate a mapped Value on demand.
void addFlags(RemapFlags Flags)
Add to the current RemapFlags.
Value * mapValue(const Value &V)
LLVM Value Representation.
unsigned registerAlternateMappingContext(ValueToValueMapTy &VM, ValueMaterializer *Materializer=nullptr)
Register an alternate mapping context.
virtual Type * remapType(Type *SrcTy)=0
The client should implement this method if they want to remap types while mapping values...
MDNode * mapMDNode(const MDNode &N)