LLVM  3.7.0
ValueMapper.cpp
Go to the documentation of this file.
1 //===- ValueMapper.cpp - Interface shared by lib/Transforms/Utils ---------===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file defines the MapValue function, which is shared by various parts of
11 // the lib/Transforms/Utils library.
12 //
13 //===----------------------------------------------------------------------===//
14 
16 #include "llvm/IR/CallSite.h"
17 #include "llvm/IR/Constants.h"
18 #include "llvm/IR/Function.h"
19 #include "llvm/IR/InlineAsm.h"
20 #include "llvm/IR/Instructions.h"
21 #include "llvm/IR/Metadata.h"
22 using namespace llvm;
23 
24 // Out of line method to get vtable etc for class.
25 void ValueMapTypeRemapper::anchor() {}
26 void ValueMaterializer::anchor() {}
27 
29  ValueMapTypeRemapper *TypeMapper,
30  ValueMaterializer *Materializer) {
32 
33  // If the value already exists in the map, use it.
34  if (I != VM.end() && I->second) return I->second;
35 
36  // If we have a materializer and it can materialize a value, use that.
37  if (Materializer) {
38  if (Value *NewV = Materializer->materializeValueFor(const_cast<Value*>(V)))
39  return VM[V] = NewV;
40  }
41 
42  // Global values do not need to be seeded into the VM if they
43  // are using the identity mapping.
44  if (isa<GlobalValue>(V))
45  return VM[V] = const_cast<Value*>(V);
46 
47  if (const InlineAsm *IA = dyn_cast<InlineAsm>(V)) {
48  // Inline asm may need *type* remapping.
49  FunctionType *NewTy = IA->getFunctionType();
50  if (TypeMapper) {
51  NewTy = cast<FunctionType>(TypeMapper->remapType(NewTy));
52 
53  if (NewTy != IA->getFunctionType())
54  V = InlineAsm::get(NewTy, IA->getAsmString(), IA->getConstraintString(),
55  IA->hasSideEffects(), IA->isAlignStack());
56  }
57 
58  return VM[V] = const_cast<Value*>(V);
59  }
60 
61  if (const auto *MDV = dyn_cast<MetadataAsValue>(V)) {
62  const Metadata *MD = MDV->getMetadata();
63  // If this is a module-level metadata and we know that nothing at the module
64  // level is changing, then use an identity mapping.
65  if (!isa<LocalAsMetadata>(MD) && (Flags & RF_NoModuleLevelChanges))
66  return VM[V] = const_cast<Value *>(V);
67 
68  auto *MappedMD = MapMetadata(MD, VM, Flags, TypeMapper, Materializer);
69  if (MD == MappedMD || (!MappedMD && (Flags & RF_IgnoreMissingEntries)))
70  return VM[V] = const_cast<Value *>(V);
71 
72  // FIXME: This assert crashes during bootstrap, but I think it should be
73  // correct. For now, just match behaviour from before the metadata/value
74  // split.
75  //
76  // assert(MappedMD && "Referenced metadata value not in value map");
77  return VM[V] = MetadataAsValue::get(V->getContext(), MappedMD);
78  }
79 
80  // Okay, this either must be a constant (which may or may not be mappable) or
81  // is something that is not in the mapping table.
82  Constant *C = const_cast<Constant*>(dyn_cast<Constant>(V));
83  if (!C)
84  return nullptr;
85 
86  if (BlockAddress *BA = dyn_cast<BlockAddress>(C)) {
87  Function *F =
88  cast<Function>(MapValue(BA->getFunction(), VM, Flags, TypeMapper, Materializer));
89  BasicBlock *BB = cast_or_null<BasicBlock>(MapValue(BA->getBasicBlock(), VM,
90  Flags, TypeMapper, Materializer));
91  return VM[V] = BlockAddress::get(F, BB ? BB : BA->getBasicBlock());
92  }
93 
94  // Otherwise, we have some other constant to remap. Start by checking to see
95  // if all operands have an identity remapping.
96  unsigned OpNo = 0, NumOperands = C->getNumOperands();
97  Value *Mapped = nullptr;
98  for (; OpNo != NumOperands; ++OpNo) {
99  Value *Op = C->getOperand(OpNo);
100  Mapped = MapValue(Op, VM, Flags, TypeMapper, Materializer);
101  if (Mapped != C) break;
102  }
103 
104  // See if the type mapper wants to remap the type as well.
105  Type *NewTy = C->getType();
106  if (TypeMapper)
107  NewTy = TypeMapper->remapType(NewTy);
108 
109  // If the result type and all operands match up, then just insert an identity
110  // mapping.
111  if (OpNo == NumOperands && NewTy == C->getType())
112  return VM[V] = C;
113 
114  // Okay, we need to create a new constant. We've already processed some or
115  // all of the operands, set them all up now.
117  Ops.reserve(NumOperands);
118  for (unsigned j = 0; j != OpNo; ++j)
119  Ops.push_back(cast<Constant>(C->getOperand(j)));
120 
121  // If one of the operands mismatch, push it and the other mapped operands.
122  if (OpNo != NumOperands) {
123  Ops.push_back(cast<Constant>(Mapped));
124 
125  // Map the rest of the operands that aren't processed yet.
126  for (++OpNo; OpNo != NumOperands; ++OpNo)
127  Ops.push_back(MapValue(cast<Constant>(C->getOperand(OpNo)), VM,
128  Flags, TypeMapper, Materializer));
129  }
130 
131  if (ConstantExpr *CE = dyn_cast<ConstantExpr>(C))
132  return VM[V] = CE->getWithOperands(Ops, NewTy);
133  if (isa<ConstantArray>(C))
134  return VM[V] = ConstantArray::get(cast<ArrayType>(NewTy), Ops);
135  if (isa<ConstantStruct>(C))
136  return VM[V] = ConstantStruct::get(cast<StructType>(NewTy), Ops);
137  if (isa<ConstantVector>(C))
138  return VM[V] = ConstantVector::get(Ops);
139  // If this is a no-operand constant, it must be because the type was remapped.
140  if (isa<UndefValue>(C))
141  return VM[V] = UndefValue::get(NewTy);
142  if (isa<ConstantAggregateZero>(C))
143  return VM[V] = ConstantAggregateZero::get(NewTy);
144  assert(isa<ConstantPointerNull>(C));
145  return VM[V] = ConstantPointerNull::get(cast<PointerType>(NewTy));
146 }
147 
149  Metadata *Val) {
150  VM.MD()[Key].reset(Val);
151  return Val;
152 }
153 
154 static Metadata *mapToSelf(ValueToValueMapTy &VM, const Metadata *MD) {
155  return mapToMetadata(VM, MD, const_cast<Metadata *>(MD));
156 }
157 
158 static Metadata *MapMetadataImpl(const Metadata *MD,
161  ValueMapTypeRemapper *TypeMapper,
162  ValueMaterializer *Materializer);
163 
166  ValueMapTypeRemapper *TypeMapper,
167  ValueMaterializer *Materializer) {
168  if (!Op)
169  return nullptr;
170  if (Metadata *MappedOp =
171  MapMetadataImpl(Op, Cycles, VM, Flags, TypeMapper, Materializer))
172  return MappedOp;
173  // Use identity map if MappedOp is null and we can ignore missing entries.
174  if (Flags & RF_IgnoreMissingEntries)
175  return Op;
176 
177  // FIXME: This assert crashes during bootstrap, but I think it should be
178  // correct. For now, just match behaviour from before the metadata/value
179  // split.
180  //
181  // llvm_unreachable("Referenced metadata not in value map!");
182  return nullptr;
183 }
184 
185 /// \brief Remap nodes.
186 ///
187 /// Insert \c NewNode in the value map, and then remap \c OldNode's operands.
188 /// Assumes that \c NewNode is already a clone of \c OldNode.
189 ///
190 /// \pre \c NewNode is a clone of \c OldNode.
191 static bool remap(const MDNode *OldNode, MDNode *NewNode,
194  ValueMaterializer *Materializer) {
195  assert(OldNode->getNumOperands() == NewNode->getNumOperands() &&
196  "Expected nodes to match");
197  assert(OldNode->isResolved() && "Expected resolved node");
198  assert(!NewNode->isUniqued() && "Expected non-uniqued node");
199 
200  // Map the node upfront so it's available for cyclic references.
201  mapToMetadata(VM, OldNode, NewNode);
202  bool AnyChanged = false;
203  for (unsigned I = 0, E = OldNode->getNumOperands(); I != E; ++I) {
204  Metadata *Old = OldNode->getOperand(I);
205  assert(NewNode->getOperand(I) == Old &&
206  "Expected old operands to already be in place");
207 
208  Metadata *New = mapMetadataOp(OldNode->getOperand(I), Cycles, VM, Flags,
209  TypeMapper, Materializer);
210  if (Old != New) {
211  AnyChanged = true;
212  NewNode->replaceOperandWith(I, New);
213  }
214  }
215 
216  return AnyChanged;
217 }
218 
219 /// \brief Map a distinct MDNode.
220 ///
221 /// Distinct nodes are not uniqued, so they must always recreated.
222 static Metadata *mapDistinctNode(const MDNode *Node,
225  ValueMapTypeRemapper *TypeMapper,
226  ValueMaterializer *Materializer) {
227  assert(Node->isDistinct() && "Expected distinct node");
228 
229  MDNode *NewMD = MDNode::replaceWithDistinct(Node->clone());
230  remap(Node, NewMD, Cycles, VM, Flags, TypeMapper, Materializer);
231 
232  // Track any cycles beneath this node.
233  for (Metadata *Op : NewMD->operands())
234  if (auto *Node = dyn_cast_or_null<MDNode>(Op))
235  if (!Node->isResolved())
236  Cycles.push_back(Node);
237 
238  return NewMD;
239 }
240 
241 /// \brief Map a uniqued MDNode.
242 ///
243 /// Uniqued nodes may not need to be recreated (they may map to themselves).
244 static Metadata *mapUniquedNode(const MDNode *Node,
247  ValueMapTypeRemapper *TypeMapper,
248  ValueMaterializer *Materializer) {
249  assert(Node->isUniqued() && "Expected uniqued node");
250 
251  // Create a temporary node upfront in case we have a metadata cycle.
252  auto ClonedMD = Node->clone();
253  if (!remap(Node, ClonedMD.get(), Cycles, VM, Flags, TypeMapper, Materializer))
254  // No operands changed, so use the identity mapping.
255  return mapToSelf(VM, Node);
256 
257  // At least one operand has changed, so uniquify the cloned node.
258  return mapToMetadata(VM, Node,
259  MDNode::replaceWithUniqued(std::move(ClonedMD)));
260 }
261 
265  ValueMapTypeRemapper *TypeMapper,
266  ValueMaterializer *Materializer) {
267  // If the value already exists in the map, use it.
268  if (Metadata *NewMD = VM.MD().lookup(MD).get())
269  return NewMD;
270 
271  if (isa<MDString>(MD))
272  return mapToSelf(VM, MD);
273 
274  if (isa<ConstantAsMetadata>(MD))
275  if ((Flags & RF_NoModuleLevelChanges))
276  return mapToSelf(VM, MD);
277 
278  if (const auto *VMD = dyn_cast<ValueAsMetadata>(MD)) {
279  Value *MappedV =
280  MapValue(VMD->getValue(), VM, Flags, TypeMapper, Materializer);
281  if (VMD->getValue() == MappedV ||
282  (!MappedV && (Flags & RF_IgnoreMissingEntries)))
283  return mapToSelf(VM, MD);
284 
285  // FIXME: This assert crashes during bootstrap, but I think it should be
286  // correct. For now, just match behaviour from before the metadata/value
287  // split.
288  //
289  // assert(MappedV && "Referenced metadata not in value map!");
290  if (MappedV)
291  return mapToMetadata(VM, MD, ValueAsMetadata::get(MappedV));
292  return nullptr;
293  }
294 
295  // Note: this cast precedes the Flags check so we always get its associated
296  // assertion.
297  const MDNode *Node = cast<MDNode>(MD);
298 
299  // If this is a module-level metadata and we know that nothing at the
300  // module level is changing, then use an identity mapping.
301  if (Flags & RF_NoModuleLevelChanges)
302  return mapToSelf(VM, MD);
303 
304  // Require resolved nodes whenever metadata might be remapped.
305  assert(Node->isResolved() && "Unexpected unresolved node");
306 
307  if (Node->isDistinct())
308  return mapDistinctNode(Node, Cycles, VM, Flags, TypeMapper, Materializer);
309 
310  return mapUniquedNode(Node, Cycles, VM, Flags, TypeMapper, Materializer);
311 }
312 
315  ValueMaterializer *Materializer) {
317  Metadata *NewMD =
318  MapMetadataImpl(MD, Cycles, VM, Flags, TypeMapper, Materializer);
319 
320  // Resolve cycles underneath MD.
321  if (NewMD && NewMD != MD) {
322  if (auto *N = dyn_cast<MDNode>(NewMD))
323  if (!N->isResolved())
324  N->resolveCycles();
325 
326  for (MDNode *N : Cycles)
327  if (!N->isResolved())
328  N->resolveCycles();
329  } else {
330  // Shouldn't get unresolved cycles if nothing was remapped.
331  assert(Cycles.empty() && "Expected no unresolved cycles");
332  }
333 
334  return NewMD;
335 }
336 
339  ValueMaterializer *Materializer) {
340  return cast<MDNode>(MapMetadata(static_cast<const Metadata *>(MD), VM, Flags,
341  TypeMapper, Materializer));
342 }
343 
344 /// RemapInstruction - Convert the instruction operands from referencing the
345 /// current values into those specified by VMap.
346 ///
349  ValueMaterializer *Materializer){
350  // Remap operands.
351  for (User::op_iterator op = I->op_begin(), E = I->op_end(); op != E; ++op) {
352  Value *V = MapValue(*op, VMap, Flags, TypeMapper, Materializer);
353  // If we aren't ignoring missing entries, assert that something happened.
354  if (V)
355  *op = V;
356  else
357  assert((Flags & RF_IgnoreMissingEntries) &&
358  "Referenced value not in value map!");
359  }
360 
361  // Remap phi nodes' incoming blocks.
362  if (PHINode *PN = dyn_cast<PHINode>(I)) {
363  for (unsigned i = 0, e = PN->getNumIncomingValues(); i != e; ++i) {
364  Value *V = MapValue(PN->getIncomingBlock(i), VMap, Flags);
365  // If we aren't ignoring missing entries, assert that something happened.
366  if (V)
367  PN->setIncomingBlock(i, cast<BasicBlock>(V));
368  else
369  assert((Flags & RF_IgnoreMissingEntries) &&
370  "Referenced block not in value map!");
371  }
372  }
373 
374  // Remap attached metadata.
376  I->getAllMetadata(MDs);
377  for (SmallVectorImpl<std::pair<unsigned, MDNode *>>::iterator
378  MI = MDs.begin(),
379  ME = MDs.end();
380  MI != ME; ++MI) {
381  MDNode *Old = MI->second;
382  MDNode *New = MapMetadata(Old, VMap, Flags, TypeMapper, Materializer);
383  if (New != Old)
384  I->setMetadata(MI->first, New);
385  }
386 
387  if (!TypeMapper)
388  return;
389 
390  // If the instruction's type is being remapped, do so now.
391  if (auto CS = CallSite(I)) {
393  FunctionType *FTy = CS.getFunctionType();
394  Tys.reserve(FTy->getNumParams());
395  for (Type *Ty : FTy->params())
396  Tys.push_back(TypeMapper->remapType(Ty));
397  CS.mutateFunctionType(FunctionType::get(
398  TypeMapper->remapType(I->getType()), Tys, FTy->isVarArg()));
399  return;
400  }
401  if (auto *AI = dyn_cast<AllocaInst>(I))
402  AI->setAllocatedType(TypeMapper->remapType(AI->getAllocatedType()));
403  if (auto *GEP = dyn_cast<GetElementPtrInst>(I)) {
404  GEP->setSourceElementType(
405  TypeMapper->remapType(GEP->getSourceElementType()));
406  GEP->setResultElementType(
407  TypeMapper->remapType(GEP->getResultElementType()));
408  }
409  I->mutateType(TypeMapper->remapType(I->getType()));
410 }
static bool remap(const MDNode *OldNode, MDNode *NewNode, SmallVectorImpl< MDNode * > &Cycles, ValueToValueMapTy &VM, RemapFlags Flags, ValueMapTypeRemapper *TypeMapper, ValueMaterializer *Materializer)
Remap nodes.
ValueT lookup(const KeyT &Val) const
lookup - Return the entry for the specified key, or a default constructed value if no such entry exis...
Definition: DenseMap.h:159
unsigned getNumParams() const
getNumParams - Return the number of fixed parameters this function type requires. ...
Definition: DerivedTypes.h:136
void replaceOperandWith(unsigned I, Metadata *New)
Replace a specific operand.
Definition: Metadata.cpp:743
static Metadata * mapDistinctNode(const MDNode *Node, SmallVectorImpl< MDNode * > &Cycles, ValueToValueMapTy &VM, RemapFlags Flags, ValueMapTypeRemapper *TypeMapper, ValueMaterializer *Materializer)
Map a distinct MDNode.
unsigned getNumOperands() const
Definition: User.h:138
unsigned getNumOperands() const
Return number of MDNode operands.
Definition: Metadata.h:942
static ConstantAggregateZero * get(Type *Ty)
Definition: Constants.cpp:1377
ArrayRef< Type * > params() const
Definition: DerivedTypes.h:126
This file contains the declarations for metadata subclasses.
Metadata node.
Definition: Metadata.h:740
F(f)
void getAllMetadata(SmallVectorImpl< std::pair< unsigned, MDNode * >> &MDs) const
getAllMetadata - Get all metadata attached to this Instruction.
Definition: Instruction.h:183
Hexagon Common GEP
#define op(i)
void reserve(size_type N)
Definition: SmallVector.h:401
static Metadata * mapToSelf(ValueToValueMapTy &VM, const Metadata *MD)
op_iterator op_begin()
Definition: User.h:183
static std::enable_if< std::is_base_of< MDNode, T >::value, T * >::type replaceWithDistinct(std::unique_ptr< T, TempMDNodeDeleter > N)
Replace a temporary node with a distinct one.
Definition: Metadata.h:866
BlockAddress - The address of a basic block.
Definition: Constants.h:802
A Use represents the edge between a Value definition and its users.
Definition: Use.h:69
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
Definition: APInt.h:33
static Constant * get(ArrayRef< Constant * > V)
Definition: Constants.cpp:1057
static Metadata * MapMetadataImpl(const Metadata *MD, SmallVectorImpl< MDNode * > &Cycles, ValueToValueMapTy &VM, RemapFlags Flags, ValueMapTypeRemapper *TypeMapper, ValueMaterializer *Materializer)
ConstantExpr - a constant value that is initialized with an expression using other constant values...
Definition: Constants.h:852
FunctionType - Class to represent function types.
Definition: DerivedTypes.h:96
bool LLVM_ATTRIBUTE_UNUSED_RESULT empty() const
Definition: SmallVector.h:57
iterator find(const KeyT &Val)
Definition: ValueMap.h:132
static FunctionType * get(Type *Result, ArrayRef< Type * > Params, bool isVarArg)
FunctionType::get - This static method is the primary way of constructing a FunctionType.
Definition: Type.cpp:361
RF_NoModuleLevelChanges - If this flag is set, the remapper knows that only local values within a fun...
Definition: ValueMapper.h:57
RF_IgnoreMissingEntries - If this flag is set, the remapper ignores entries that are not in the value...
Definition: ValueMapper.h:62
static MetadataAsValue * get(LLVMContext &Context, Metadata *MD)
Definition: Metadata.cpp:75
ValueMaterializer - This is a class that can be implemented by clients to materialize Values on deman...
Definition: ValueMapper.h:39
static std::enable_if< std::is_base_of< MDNode, T >::value, T * >::type replaceWithUniqued(std::unique_ptr< T, TempMDNodeDeleter > N)
Replace a temporary node with a uniqued one.
Definition: Metadata.h:856
* if(!EatIfPresent(lltok::kw_thread_local)) return false
ParseOptionalThreadLocal := /*empty.
static ConstantPointerNull * get(PointerType *T)
get() - Static factory methods - Return objects of the specified value
Definition: Constants.cpp:1455
LLVM Basic Block Representation.
Definition: BasicBlock.h:65
The instances of the Type class are immutable: once they are created, they are never changed...
Definition: Type.h:45
static BlockAddress * get(Function *F, BasicBlock *BB)
get - Return a BlockAddress for the specified function and basic block.
Definition: Constants.cpp:1496
This is an important base class in LLVM.
Definition: Constant.h:41
Metadata * MapMetadata(const Metadata *MD, ValueToValueMapTy &VM, RemapFlags Flags=RF_None, ValueMapTypeRemapper *TypeMapper=nullptr, ValueMaterializer *Materializer=nullptr)
This file contains the declarations for the subclasses of Constant, which represent the different fla...
static Constant * get(ArrayType *T, ArrayRef< Constant * > V)
Definition: Constants.cpp:873
op_iterator op_end()
Definition: User.h:185
Value * MapValue(const Value *V, ValueToValueMapTy &VM, RemapFlags Flags=RF_None, ValueMapTypeRemapper *TypeMapper=nullptr, ValueMaterializer *Materializer=nullptr)
Definition: ValueMapper.cpp:28
Value * getOperand(unsigned i) const
Definition: User.h:118
static Constant * get(StructType *T, ArrayRef< Constant * > V)
Definition: Constants.cpp:1008
virtual Value * materializeValueFor(Value *V)=0
materializeValueFor - The client should implement this method if they want to generate a mapped Value...
TempMDNode clone() const
Create a (temporary) clone of this.
Definition: Metadata.cpp:437
static UndefValue * get(Type *T)
get() - Static factory methods - Return an 'undef' object of the specified type.
Definition: Constants.cpp:1473
RemapFlags
RemapFlags - These are flags that the value mapping APIs allow.
Definition: ValueMapper.h:51
LLVMContext & getContext() const
All values hold a context through their type.
Definition: Value.cpp:519
void setMetadata(unsigned KindID, MDNode *Node)
setMetadata - Set the metadata of the specified kind to the specified node.
Definition: Metadata.cpp:1083
iterator end()
Definition: ValueMap.h:112
const MDOperand & getOperand(unsigned I) const
Definition: Metadata.h:936
static ValueAsMetadata * get(Value *V)
Definition: Metadata.cpp:251
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
Definition: SmallVector.h:861
Type * getType() const
All values are typed, get the type of this value.
Definition: Value.h:222
void RemapInstruction(Instruction *I, ValueToValueMapTy &VM, RemapFlags Flags=RF_None, ValueMapTypeRemapper *TypeMapper=nullptr, ValueMaterializer *Materializer=nullptr)
RemapInstruction - Convert the instruction operands from referencing the current values into those sp...
LLVM_ATTRIBUTE_UNUSED_RESULT std::enable_if< !is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type >::type dyn_cast(const Y &Val)
Definition: Casting.h:285
ValueMapTypeRemapper - This is a class that can be implemented by clients to remap types when cloning...
Definition: ValueMapper.h:27
bool isDistinct() const
Definition: Metadata.h:818
static MDTuple * get(LLVMContext &Context, ArrayRef< Metadata * > MDs)
Definition: Metadata.h:1030
static Metadata * mapToMetadata(ValueToValueMapTy &VM, const Metadata *Key, Metadata *Val)
#define I(x, y, z)
Definition: MD5.cpp:54
#define N
static Metadata * mapMetadataOp(Metadata *Op, SmallVectorImpl< MDNode * > &Cycles, ValueToValueMapTy &VM, RemapFlags Flags, ValueMapTypeRemapper *TypeMapper, ValueMaterializer *Materializer)
static InlineAsm * get(FunctionType *Ty, StringRef AsmString, StringRef Constraints, bool hasSideEffects, bool isAlignStack=false, AsmDialect asmDialect=AD_ATT)
InlineAsm::get - Return the specified uniqued inline asm string.
Definition: InlineAsm.cpp:28
void mutateType(Type *Ty)
Mutate the type of this Value to be of the specified type.
Definition: Value.h:471
bool isVarArg() const
Definition: DerivedTypes.h:120
bool isUniqued() const
Definition: Metadata.h:817
LLVM Value Representation.
Definition: Value.h:69
static Metadata * mapUniquedNode(const MDNode *Node, SmallVectorImpl< MDNode * > &Cycles, ValueToValueMapTy &VM, RemapFlags Flags, ValueMapTypeRemapper *TypeMapper, ValueMaterializer *Materializer)
Map a uniqued MDNode.
virtual Type * remapType(Type *SrcTy)=0
remapType - The client should implement this method if they want to remap types while mapping values...
bool isResolved() const
Check if node is fully resolved.
Definition: Metadata.h:815
MDMapT & MD()
Definition: ValueMap.h:103
Root of the metadata hierarchy.
Definition: Metadata.h:45