mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 19:23:23 +01:00
Utils: Move cloneMD*() up, NFC
llvm-svn: 225915
This commit is contained in:
parent
e0ad6d2442
commit
02dd0e93d7
@ -180,6 +180,29 @@ static Metadata *mapMetadataOp(Metadata *Op, ValueToValueMapTy &VM,
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
static Metadata *cloneMDTuple(const MDTuple *Node, ValueToValueMapTy &VM,
|
||||
RemapFlags Flags,
|
||||
ValueMapTypeRemapper *TypeMapper,
|
||||
ValueMaterializer *Materializer) {
|
||||
SmallVector<Metadata *, 4> Elts;
|
||||
Elts.reserve(Node->getNumOperands());
|
||||
for (unsigned I = 0, E = Node->getNumOperands(); I != E; ++I)
|
||||
Elts.push_back(mapMetadataOp(Node->getOperand(I), VM, Flags, TypeMapper,
|
||||
Materializer));
|
||||
|
||||
return MDTuple::get(Node->getContext(), Elts);
|
||||
}
|
||||
|
||||
static Metadata *cloneMDLocation(const MDLocation *Node, ValueToValueMapTy &VM,
|
||||
RemapFlags Flags,
|
||||
ValueMapTypeRemapper *TypeMapper,
|
||||
ValueMaterializer *Materializer) {
|
||||
return MDLocation::get(
|
||||
Node->getContext(), Node->getLine(), Node->getColumn(),
|
||||
mapMetadataOp(Node->getScope(), VM, Flags, TypeMapper, Materializer),
|
||||
mapMetadataOp(Node->getInlinedAt(), VM, Flags, TypeMapper, Materializer));
|
||||
}
|
||||
|
||||
/// \brief Map a distinct MDNode.
|
||||
///
|
||||
/// Distinct nodes are not uniqued, so they must always recreated.
|
||||
@ -219,29 +242,6 @@ static bool shouldRemapUniquedNode(const UniquableMDNode *Node,
|
||||
return false;
|
||||
}
|
||||
|
||||
static Metadata *cloneMDTuple(const MDTuple *Node, ValueToValueMapTy &VM,
|
||||
RemapFlags Flags,
|
||||
ValueMapTypeRemapper *TypeMapper,
|
||||
ValueMaterializer *Materializer) {
|
||||
SmallVector<Metadata *, 4> Elts;
|
||||
Elts.reserve(Node->getNumOperands());
|
||||
for (unsigned I = 0, E = Node->getNumOperands(); I != E; ++I)
|
||||
Elts.push_back(mapMetadataOp(Node->getOperand(I), VM, Flags, TypeMapper,
|
||||
Materializer));
|
||||
|
||||
return MDTuple::get(Node->getContext(), Elts);
|
||||
}
|
||||
|
||||
static Metadata *cloneMDLocation(const MDLocation *Node, ValueToValueMapTy &VM,
|
||||
RemapFlags Flags,
|
||||
ValueMapTypeRemapper *TypeMapper,
|
||||
ValueMaterializer *Materializer) {
|
||||
return MDLocation::get(
|
||||
Node->getContext(), Node->getLine(), Node->getColumn(),
|
||||
mapMetadataOp(Node->getScope(), VM, Flags, TypeMapper, Materializer),
|
||||
mapMetadataOp(Node->getInlinedAt(), VM, Flags, TypeMapper, Materializer));
|
||||
}
|
||||
|
||||
/// \brief Map a uniqued MDNode.
|
||||
///
|
||||
/// Uniqued nodes may not need to be recreated (they may map to themselves).
|
||||
|
Loading…
Reference in New Issue
Block a user