summaryrefslogtreecommitdiffstats
path: root/llvm/lib/AsmParser/LLParser.cpp
diff options
context:
space:
mode:
authorDevang Patel <dpatel@apple.com>2009-09-16 18:18:06 +0000
committerDevang Patel <dpatel@apple.com>2009-09-16 18:18:06 +0000
commit0d9950e315b724eddab37774d418634114a0e2bb (patch)
treeb245a8d8e53d36c1d3d0d1ea9ed0b96113699341 /llvm/lib/AsmParser/LLParser.cpp
parent13fb91e9001ba3be90b6c289c1a49f15c781d62a (diff)
downloadbcm5719-llvm-0d9950e315b724eddab37774d418634114a0e2bb.tar.gz
bcm5719-llvm-0d9950e315b724eddab37774d418634114a0e2bb.zip
Parse debug info attached with an instruction.
llvm-svn: 82063
Diffstat (limited to 'llvm/lib/AsmParser/LLParser.cpp')
-rw-r--r--llvm/lib/AsmParser/LLParser.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/llvm/lib/AsmParser/LLParser.cpp b/llvm/lib/AsmParser/LLParser.cpp
index b7b95d7ecf0..3c125a01b19 100644
--- a/llvm/lib/AsmParser/LLParser.cpp
+++ b/llvm/lib/AsmParser/LLParser.cpp
@@ -2624,6 +2624,23 @@ bool LLParser::ParseBasicBlock(PerFunctionState &PFS) {
if (ParseInstruction(Inst, BB, PFS)) return true;
+ // Parse optional debug info
+ if (Lex.getKind() == lltok::comma) {
+ Lex.Lex();
+ if (Lex.getKind() == lltok::kw_dbg) {
+ Lex.Lex();
+ if (Lex.getKind() != lltok::Metadata)
+ return TokError("Expected '!' here");
+ Lex.Lex();
+ MetadataBase *N = 0;
+ if (ParseMDNode(N)) return true;
+ Metadata &TheMetadata = M->getContext().getMetadata();
+ unsigned MDDbgKind = TheMetadata.getMDKind("dbg");
+ if (!MDDbgKind)
+ MDDbgKind = TheMetadata.RegisterMDKind("dbg");
+ TheMetadata.setMD(MDDbgKind, cast<MDNode>(N), Inst);
+ }
+ }
BB->getInstList().push_back(Inst);
// Set the name on the instruction.
OpenPOWER on IntegriCloud