llvm.org GIT mirror llvm / 9b68f1c
Utils: Move cloneMD*() up, NFC git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225915 91177308-0d34-0410-b5e6-96231b3b80d8 Duncan P. N. Exon Smith 5 years ago
1 changed file(s) with 23 addition(s) and 23 deletion(s). Raw diff Collapse all Expand all
179179 return nullptr;
180180 }
181181
182 static Metadata *cloneMDTuple(const MDTuple *Node, ValueToValueMapTy &VM,
183 RemapFlags Flags,
184 ValueMapTypeRemapper *TypeMapper,
185 ValueMaterializer *Materializer) {
186 SmallVector Elts;
187 Elts.reserve(Node->getNumOperands());
188 for (unsigned I = 0, E = Node->getNumOperands(); I != E; ++I)
189 Elts.push_back(mapMetadataOp(Node->getOperand(I), VM, Flags, TypeMapper,
190 Materializer));
191
192 return MDTuple::get(Node->getContext(), Elts);
193 }
194
195 static Metadata *cloneMDLocation(const MDLocation *Node, ValueToValueMapTy &VM,
196 RemapFlags Flags,
197 ValueMapTypeRemapper *TypeMapper,
198 ValueMaterializer *Materializer) {
199 return MDLocation::get(
200 Node->getContext(), Node->getLine(), Node->getColumn(),
201 mapMetadataOp(Node->getScope(), VM, Flags, TypeMapper, Materializer),
202 mapMetadataOp(Node->getInlinedAt(), VM, Flags, TypeMapper, Materializer));
203 }
204
182205 /// \brief Map a distinct MDNode.
183206 ///
184207 /// Distinct nodes are not uniqued, so they must always recreated.
216239 return true;
217240 }
218241 return false;
219 }
220
221 static Metadata *cloneMDTuple(const MDTuple *Node, ValueToValueMapTy &VM,
222 RemapFlags Flags,
223 ValueMapTypeRemapper *TypeMapper,
224 ValueMaterializer *Materializer) {
225 SmallVector Elts;
226 Elts.reserve(Node->getNumOperands());
227 for (unsigned I = 0, E = Node->getNumOperands(); I != E; ++I)
228 Elts.push_back(mapMetadataOp(Node->getOperand(I), VM, Flags, TypeMapper,
229 Materializer));
230
231 return MDTuple::get(Node->getContext(), Elts);
232 }
233
234 static Metadata *cloneMDLocation(const MDLocation *Node, ValueToValueMapTy &VM,
235 RemapFlags Flags,
236 ValueMapTypeRemapper *TypeMapper,
237 ValueMaterializer *Materializer) {
238 return MDLocation::get(
239 Node->getContext(), Node->getLine(), Node->getColumn(),
240 mapMetadataOp(Node->getScope(), VM, Flags, TypeMapper, Materializer),
241 mapMetadataOp(Node->getInlinedAt(), VM, Flags, TypeMapper, Materializer));
242242 }
243243
244244 /// \brief Map a uniqued MDNode.