Lookup or compute a mapping for a piece of metadata.
Declared in <llvm/Transforms/Utils/ValueMapper.h>
Metadata*
MapMetadata(
Metadata const* MD,
ValueToValueMapTy& VM,
RemapFlags Flags = RF_None,
ValueMapTypeRemapper* TypeMapper = nullptr,
ValueMaterializer* Materializer = nullptr,
MetadataPredicate const* IdentityMD = nullptr);
Compute and memoize a mapping for MD.
1. If MD is mapped, return it. 2. Else if RF_NoModuleLevelChanges or MD is an MDString, return MD. 3. Else if MD is a ConstantAsMetadata, call MapValue() and re-wrap its return (returning nullptr on nullptr). 4. Else if IdentityMD predicate returns true for MD then add an identity mapping for it and return it. 5. Else, MD is an MDNode. These are remapped, along with their transitive operands. Distinct nodes are duplicated or moved depending on RF_MoveDistinctNodes. Uniqued nodes are remapped like constants.
LocalAsMetadata is completely unsupported by MapMetadata. Instead, use MapValue() with its wrapping MetadataAsValue instance.
Root of the metadata hierarchy.
| Name | Description |
|---|---|
| MD | Root of the metadata hierarchy. |
| Flags | These are flags that the value mapping APIs allow. |
| TypeMapper | This is a class that can be implemented by clients to remap types when cloning constants and instructions. |
| Materializer | This is a class that can be implemented by clients to materialize Values on demand. |