|
LLVM 22.0.0git
|
Context for (re-)mapping values (and metadata). More...
#include "llvm/Transforms/Utils/ValueMapper.h"
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::ValueMapper | ( | ValueToValueMapTy & | VM, |
| RemapFlags | Flags = RF_None, | ||
| ValueMapTypeRemapper * | TypeMapper = nullptr, | ||
| ValueMaterializer * | Materializer = nullptr, | ||
| const MetadataPredicate * | IdentityMD = nullptr ) |
Definition at line 1228 of file ValueMapper.cpp.
Referenced by operator=(), operator=(), ValueMapper(), and ValueMapper().
|
delete |
References ValueMapper().
|
delete |
References ValueMapper().
| ValueMapper::~ValueMapper | ( | ) |
Definition at line 1234 of file ValueMapper.cpp.
References getAsMapper().
| void ValueMapper::addFlags | ( | RemapFlags | Flags | ) |
Add to the current RemapFlags.
Definition at line 1242 of file ValueMapper.cpp.
Definition at line 1250 of file ValueMapper.cpp.
References llvm::CallingConv::C, llvm::cast_or_null(), and mapValue().
Referenced by llvm::MapValue().
Definition at line 1258 of file ValueMapper.cpp.
References llvm::cast_or_null(), mapMetadata(), and N.
Referenced by llvm::MapMetadata().
Definition at line 1254 of file ValueMapper.cpp.
Referenced by mapMDNode(), and llvm::MapMetadata().
Definition at line 1246 of file ValueMapper.cpp.
Referenced by mapConstant(), and llvm::MapValue().
|
delete |
References llvm::CallingConv::C, F, I, LLVM_ABI, N, Range, and ValueMapper().
|
delete |
References ValueMapper().
| unsigned ValueMapper::registerAlternateMappingContext | ( | ValueToValueMapTy & | VM, |
| ValueMaterializer * | Materializer = nullptr ) |
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().
Definition at line 1266 of file ValueMapper.cpp.
Referenced by llvm::RemapDbgRecord(), and remapDbgRecordRange().
| void ValueMapper::remapDbgRecordRange | ( | Module * | M, |
| iterator_range< DbgRecordIterator > | Range ) |
Definition at line 1270 of file ValueMapper.cpp.
References Range, and remapDbgRecord().
Referenced by llvm::RemapDbgRecordRange().
| void ValueMapper::remapFunction | ( | Function & | F | ) |
| void ValueMapper::remapGlobalObjectMetadata | ( | GlobalObject & | GO | ) |
Definition at line 1281 of file ValueMapper.cpp.
| void ValueMapper::remapInstruction | ( | Instruction & | I | ) |
Definition at line 1262 of file ValueMapper.cpp.
References I.
Referenced by llvm::RemapInstruction().
| void ValueMapper::scheduleMapAppendingVariable | ( | GlobalVariable & | GV, |
| GlobalVariable * | OldGV, | ||
| bool | IsOldCtorDtor, | ||
| ArrayRef< Constant * > | NewMembers, | ||
| unsigned | MappingContextID = 0 ) |
Definition at line 1291 of file ValueMapper.cpp.
References getAsMapper().
| void ValueMapper::scheduleMapGlobalAlias | ( | GlobalAlias & | GA, |
| Constant & | Aliasee, | ||
| unsigned | MappingContextID = 0 ) |
Definition at line 1300 of file ValueMapper.cpp.
References getAsMapper().
| void ValueMapper::scheduleMapGlobalIFunc | ( | GlobalIFunc & | GI, |
| Constant & | Resolver, | ||
| unsigned | MappingContextID = 0 ) |
Definition at line 1305 of file ValueMapper.cpp.
References getAsMapper().
| void ValueMapper::scheduleMapGlobalInitializer | ( | GlobalVariable & | GV, |
| Constant & | Init, | ||
| unsigned | MappingContextID = 0 ) |
Definition at line 1285 of file ValueMapper.cpp.
References getAsMapper().
Definition at line 1310 of file ValueMapper.cpp.
References F, and getAsMapper().