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)"
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:
- mapValue() (and mapConstant());
- mapMetadata() (and mapMDNode());
- remapInstruction();
- remapFunction(); and
- remapGlobalObjectMetadata().
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:
- scheduleMapGlobalInitializer()
- scheduleMapAppendingVariable()
- scheduleMapGlobalAlias()
- scheduleMapGlobalIFunc()
- scheduleRemapFunction()
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:
- include/llvm/Transforms/Utils/ValueMapper.h
- lib/Transforms/Utils/ValueMapper.cpp