LLVM: llvm::ValueMapper Class Reference (original) (raw)

Context for (re-)mapping values (and metadata). More...

#include "[llvm/Transforms/Utils/ValueMapper.h](ValueMapper%5F8h%5Fsource.html)"

Public Member Functions
LLVM_ABI ValueMapper (ValueToValueMapTy &VM, RemapFlags Flags=RF_None, ValueMapTypeRemapper *TypeMapper=nullptr, ValueMaterializer *Materializer=nullptr, const MetadataPredicate *IdentityMD=nullptr)
ValueMapper (ValueMapper &&)=delete
ValueMapper (const ValueMapper &)=delete
ValueMapper & operator= (ValueMapper &&)=delete
ValueMapper & operator= (const ValueMapper &)=delete
LLVM_ABI ~ValueMapper ()
LLVM_ABI unsigned registerAlternateMappingContext (ValueToValueMapTy &VM, ValueMaterializer *Materializer=nullptr)
Register an alternate mapping context.
LLVM_ABI void addFlags (RemapFlags Flags)
Add to the current RemapFlags.
LLVM_ABI Metadata * mapMetadata (const Metadata &MD)
LLVM_ABI MDNode * mapMDNode (const MDNode &N)
LLVM_ABI Value * mapValue (const Value &V)
LLVM_ABI Constant * mapConstant (const Constant &C)
LLVM_ABI void remapInstruction (Instruction &I)
LLVM_ABI void remapDbgRecord (Module *M, DbgRecord &V)
LLVM_ABI void remapDbgRecordRange (Module *M, iterator_range< DbgRecordIterator > Range)
LLVM_ABI void remapFunction (Function &F)
LLVM_ABI void remapGlobalObjectMetadata (GlobalObject &GO)
LLVM_ABI void scheduleMapGlobalInitializer (GlobalVariable &GV, Constant &Init, unsigned MappingContextID=0)
LLVM_ABI void scheduleMapAppendingVariable (GlobalVariable &GV, GlobalVariable *OldGV, bool IsOldCtorDtor, ArrayRef< Constant * > NewMembers, unsigned MappingContextID=0)
LLVM_ABI void scheduleMapGlobalAlias (GlobalAlias &GA, Constant &Aliasee, unsigned MappingContextID=0)
LLVM_ABI void scheduleMapGlobalIFunc (GlobalIFunc &GI, Constant &Resolver, unsigned MappingContextID=0)
LLVM_ABI void scheduleRemapFunction (Function &F, unsigned MappingContextID=0)

Context for (re-)mapping values (and metadata).

A shared context used for mapping and remapping of Value and Metadata instances using ValueToValueMapTy, RemapFlags, ValueMapTypeRemapper, ValueMaterializer, and IdentityMD.

There are a number of top-level entry points:

The ValueMaterializer can be used as a callback, but cannot invoke any of these top-level functions recursively. Instead, callbacks should use one of the following to schedule work lazily in the ValueMapper instance:

Sometimes a callback needs a different mapping context. Such a context can be registered using registerAlternateMappingContext(), which takes an alternate ValueToValueMapTy and ValueMaterializer and returns a ID to pass into the schedule*() functions.

If an IdentityMD predicate is optionally provided, Metadata for which the predicate returns true will be mapped onto itself in VM on first use.

TODO: lib/Linker really doesn't need the ValueHandle in the ValueToValueMapTy. We should template ValueMapper (and its implementation classes), and explicitly instantiate on two concrete instances of ValueMap (one as ValueToValueMap, and one with raw Value pointers). It may be viable to do away with TrackingMDRef in the Metadata side map for the lib/Linker case as well, in which case we'll need a new template parameter on ValueMap.

TODO: Update callers of RemapInstruction() and MapValue() (etc.) to use ValueMapper directly.

Definition at line 163 of file ValueMapper.h.

ValueMapper() [2/3]

llvm::ValueMapper::ValueMapper ( ValueMapper && ) delete

ValueMapper() [3/3]

~ValueMapper()

ValueMapper::~ValueMapper ( )

addFlags()

mapConstant()

mapMDNode()

mapMetadata()

mapValue()

operator=() [1/2]

operator=() [2/2]

registerAlternateMappingContext()

Register an alternate mapping context.

Returns a MappingContextID that can be used with the various schedule*() API to switch in a different value map on-the-fly.

Definition at line 1237 of file ValueMapper.cpp.

References getAsMapper().

remapDbgRecord()

remapDbgRecordRange()

remapFunction()

void ValueMapper::remapFunction ( Function & F )

remapGlobalObjectMetadata()

void ValueMapper::remapGlobalObjectMetadata ( GlobalObject & GO )

remapInstruction()

scheduleMapAppendingVariable()

scheduleMapGlobalAlias()

scheduleMapGlobalIFunc()

scheduleMapGlobalInitializer()

scheduleRemapFunction()

void ValueMapper::scheduleRemapFunction ( Function & F,
unsigned MappingContextID = 0 )

The documentation for this class was generated from the following files: