summaryrefslogtreecommitdiffstats
path: root/llvm/lib/MC/MCParser
diff options
context:
space:
mode:
authorKevin Enderby <enderby@apple.com>2011-12-09 18:09:40 +0000
committerKevin Enderby <enderby@apple.com>2011-12-09 18:09:40 +0000
commite7739d484f15cb55a526f90b93ccb0f84c91d13e (patch)
treefd50d7f33b6f1b62a9997a5df2f1246293817849 /llvm/lib/MC/MCParser
parent5ca04bd4e70638da3918c9388b4169d85bcccc83 (diff)
downloadbcm5719-llvm-e7739d484f15cb55a526f90b93ccb0f84c91d13e.tar.gz
bcm5719-llvm-e7739d484f15cb55a526f90b93ccb0f84c91d13e.zip
The second part of support for generating dwarf for assembly source files. This
generates the dwarf Compile Unit DIE and a dwarf subprogram DIE for each non-temporary label. The next part will be to get the clang driver to enable this when assembling a .s file. rdar://9275556 llvm-svn: 146262
Diffstat (limited to 'llvm/lib/MC/MCParser')
-rw-r--r--llvm/lib/MC/MCParser/AsmParser.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/llvm/lib/MC/MCParser/AsmParser.cpp b/llvm/lib/MC/MCParser/AsmParser.cpp
index 78838937276..943f270a0a7 100644
--- a/llvm/lib/MC/MCParser/AsmParser.cpp
+++ b/llvm/lib/MC/MCParser/AsmParser.cpp
@@ -468,6 +468,9 @@ bool AsmParser::Run(bool NoInitialTextSection, bool NoFinalize) {
// section and generate a .file directive.
if (getContext().getGenDwarfForAssembly()) {
getContext().setGenDwarfSection(getStreamer().getCurrentSection());
+ MCSymbol *SectionStartSym = getContext().CreateTempSymbol();
+ getStreamer().EmitLabel(SectionStartSym);
+ getContext().setGenDwarfSectionStartSym(SectionStartSym);
getStreamer().EmitDwarfFileDirective(getContext().nextGenDwarfFileNumber(),
StringRef(), SrcMgr.getMemoryBuffer(CurBuffer)->getBufferIdentifier());
}
@@ -1047,6 +1050,12 @@ bool AsmParser::ParseStatement() {
// Emit the label.
Out.EmitLabel(Sym);
+ // If we are generating dwarf for assembly source files then gather the
+ // info to make a dwarf subprogram entry for this label if needed.
+ if (getContext().getGenDwarfForAssembly())
+ MCGenDwarfSubprogramEntry::Make(Sym, &getStreamer(), getSourceManager(),
+ IDLoc);
+
// Consume any end of statement token, if present, to avoid spurious
// AddBlankLine calls().
if (Lexer.is(AsmToken::EndOfStatement)) {
OpenPOWER on IntegriCloud