diff options
author | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2014-11-05 18:16:03 +0000 |
---|---|---|
committer | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2014-11-05 18:16:03 +0000 |
commit | c5754a65e64126743644aec2631f165a0ac3ffe4 (patch) | |
tree | b35cb05d283e1a11cf2012f2ff4b44116725a2cd /llvm/lib/CodeGen | |
parent | 8f093f4138e1ffafb7ee5344e012ba8dd952a055 (diff) | |
download | bcm5719-llvm-c5754a65e64126743644aec2631f165a0ac3ffe4.tar.gz bcm5719-llvm-c5754a65e64126743644aec2631f165a0ac3ffe4.zip |
IR: MDNode => Value: NamedMDNode::getOperator()
Change `NamedMDNode::getOperator()` from returning `MDNode *` to
returning `Value *`. To reduce boilerplate at some call sites, add a
`getOperatorAsMDNode()` for named metadata that's expected to only
return `MDNode` -- for now, that's everything, but debug node named
metadata (such as llvm.dbg.cu and llvm.dbg.sp) will soon change. This
is part of PR21433.
Note that there's a follow-up patch to clang for the API change.
llvm-svn: 221375
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp | 2 | ||||
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp | 8 |
2 files changed, 5 insertions, 5 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp index e8bff7c6de5..ba42742dd35 100644 --- a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp @@ -1398,7 +1398,7 @@ void AsmPrinter::EmitModuleIdents(Module &M) { if (const NamedMDNode *NMD = M.getNamedMetadata("llvm.ident")) { for (unsigned i = 0, e = NMD->getNumOperands(); i != e; ++i) { - const MDNode *N = NMD->getOperand(i); + const MDNode *N = NMD->getOperandAsMDNode(i); assert(N->getNumOperands() == 1 && "llvm.ident metadata entry can have only one operand"); const MDString *S = cast<MDString>(N->getOperand(0)); diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp index 4acd7271be9..9523446bd22 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp @@ -450,8 +450,8 @@ void DwarfDebug::beginModule() { SingleCU = CU_Nodes->getNumOperands() == 1; - for (MDNode *N : CU_Nodes->operands()) { - DICompileUnit CUNode(N); + for (Value *N : CU_Nodes->operands()) { + DICompileUnit CUNode(cast<MDNode>(N)); DwarfCompileUnit &CU = constructDwarfCompileUnit(CUNode); DIArray ImportedEntities = CUNode.getImportedEntities(); for (unsigned i = 0, e = ImportedEntities.getNumElements(); i != e; ++i) @@ -526,8 +526,8 @@ void DwarfDebug::collectDeadVariables() { const Module *M = MMI->getModule(); if (NamedMDNode *CU_Nodes = M->getNamedMetadata("llvm.dbg.cu")) { - for (MDNode *N : CU_Nodes->operands()) { - DICompileUnit TheCU(N); + for (Value *N : CU_Nodes->operands()) { + DICompileUnit TheCU(cast<MDNode>(N)); // Construct subprogram DIE and add variables DIEs. DwarfCompileUnit *SPCU = static_cast<DwarfCompileUnit *>(CUMap.lookup(TheCU)); |