1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-01-31 20:51:52 +01:00

Parse debug info attached with an instruction.

llvm-svn: 82063
This commit is contained in:
Devang Patel 2009-09-16 18:18:06 +00:00
parent ae097e977b
commit b3173a0dfb
3 changed files with 19 additions and 0 deletions

View File

@ -530,6 +530,7 @@ lltok::Kind LLLexer::LexIdentifier() {
KEYWORD(asm);
KEYWORD(sideeffect);
KEYWORD(gc);
KEYWORD(dbg);
KEYWORD(ccc);
KEYWORD(fastcc);

View File

@ -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.

View File

@ -63,6 +63,7 @@ namespace lltok {
kw_asm,
kw_sideeffect,
kw_gc,
kw_dbg,
kw_c,
kw_cc, kw_ccc, kw_fastcc, kw_coldcc,