aboutsummaryrefslogtreecommitdiffstats
path: root/include/llvm
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
commit94c2e85bea1ab1b837a4c055ccc83d5cd32dd027 (patch)
tree2439394068bac231063b5bd6d977167d65e29ebf /include/llvm
parentbf67a99c35412db4bf6c1e2fd511d9044d6acc71 (diff)
downloadexternal_llvm-94c2e85bea1ab1b837a4c055ccc83d5cd32dd027.tar.gz
external_llvm-94c2e85bea1ab1b837a4c055ccc83d5cd32dd027.tar.bz2
external_llvm-94c2e85bea1ab1b837a4c055ccc83d5cd32dd027.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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@146262 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm')
-rw-r--r--include/llvm/MC/MCContext.h28
-rw-r--r--include/llvm/MC/MCDwarf.h42
-rw-r--r--include/llvm/Support/Dwarf.h1
3 files changed, 71 insertions, 0 deletions
diff --git a/include/llvm/MC/MCContext.h b/include/llvm/MC/MCContext.h
index d45b0c8ca6..455b45ea23 100644
--- a/include/llvm/MC/MCContext.h
+++ b/include/llvm/MC/MCContext.h
@@ -108,6 +108,16 @@ namespace llvm {
/// The default initial text section that we generate dwarf debugging line
/// info for when generating dwarf assembly source files.
const MCSection *GenDwarfSection;
+ /// Symbols created for the start and end of this section.
+ MCSymbol *GenDwarfSectionStartSym, *GenDwarfSectionEndSym;
+
+ /// The information gathered from labels that will have dwarf subprogram
+ /// entries when generating dwarf assembly source files.
+ std::vector<const MCGenDwarfSubprogramEntry *> MCGenDwarfSubprogramEntries;
+
+ /// The string to embed in the debug information for the compile unit, if
+ /// non-empty.
+ StringRef DwarfDebugFlags;
/// Honor temporary labels, this is useful for debugging semantic
/// differences between temporary and non-temporary labels (primarily on
@@ -269,6 +279,24 @@ namespace llvm {
unsigned nextGenDwarfFileNumber() { return ++GenDwarfFileNumber; }
const MCSection *getGenDwarfSection() { return GenDwarfSection; }
void setGenDwarfSection(const MCSection *Sec) { GenDwarfSection = Sec; }
+ MCSymbol *getGenDwarfSectionStartSym() { return GenDwarfSectionStartSym; }
+ void setGenDwarfSectionStartSym(MCSymbol *Sym) {
+ GenDwarfSectionStartSym = Sym;
+ }
+ MCSymbol *getGenDwarfSectionEndSym() { return GenDwarfSectionEndSym; }
+ void setGenDwarfSectionEndSym(MCSymbol *Sym) {
+ GenDwarfSectionEndSym = Sym;
+ }
+ const std::vector<const MCGenDwarfSubprogramEntry *>
+ &getMCGenDwarfSubprogramEntries() const {
+ return MCGenDwarfSubprogramEntries;
+ }
+ void addMCGenDwarfSubprogramEntry(const MCGenDwarfSubprogramEntry *E) {
+ MCGenDwarfSubprogramEntries.push_back(E);
+ }
+
+ void setDwarfDebugFlags(StringRef S) { DwarfDebugFlags = S; }
+ StringRef getDwarfDebugFlags() { return DwarfDebugFlags; }
/// @}
diff --git a/include/llvm/MC/MCDwarf.h b/include/llvm/MC/MCDwarf.h
index 431e3c4da8..9c77218215 100644
--- a/include/llvm/MC/MCDwarf.h
+++ b/include/llvm/MC/MCDwarf.h
@@ -31,6 +31,8 @@ namespace llvm {
class MCSymbol;
class MCObjectStreamer;
class raw_ostream;
+ class SourceMgr;
+ class SMLoc;
/// MCDwarfFile - Instances of this class represent the name of the dwarf
/// .file directive and its associated dwarf file number in the MC file,
@@ -227,6 +229,46 @@ namespace llvm {
int64_t LineDelta, uint64_t AddrDelta);
};
+ class MCGenDwarfInfo {
+ public:
+ //
+ // When generating dwarf for assembly source files this emits the Dwarf
+ // sections.
+ //
+ static void Emit(MCStreamer *MCOS);
+ };
+
+ // When generating dwarf for assembly source files this is the info that is
+ // needed to be gathered for each symbol that will have a dwarf2_subprogram.
+ class MCGenDwarfSubprogramEntry {
+ private:
+ // Name of the symbol without a leading underbar, if any.
+ StringRef Name;
+ // The dwarf file number this symbol is in.
+ unsigned FileNumber;
+ // The line number this symbol is at.
+ unsigned LineNumber;
+ // The low_pc for the dwarf2_subprogram is taken from this symbol. The
+ // high_pc is taken from the next symbol's value or the end of the section
+ // for the last symbol
+ MCSymbol *Label;
+
+ public:
+ MCGenDwarfSubprogramEntry(StringRef name, unsigned fileNumber,
+ unsigned lineNumber, MCSymbol *label) :
+ Name(name), FileNumber(fileNumber), LineNumber(lineNumber), Label(label){}
+
+ StringRef getName() const { return Name; }
+ unsigned getFileNumber() const { return FileNumber; }
+ unsigned getLineNumber() const { return LineNumber; }
+ MCSymbol *getLabel() const { return Label; }
+
+ // This is called when label is created when we are generating dwarf for
+ // assembly source files.
+ static void Make(MCSymbol *Symbol, MCStreamer *MCOS, SourceMgr &SrcMgr,
+ SMLoc &Loc);
+ };
+
class MCCFIInstruction {
public:
enum OpType { SameValue, Remember, Restore, Move, RelMove };
diff --git a/include/llvm/Support/Dwarf.h b/include/llvm/Support/Dwarf.h
index 30f91874db..357f555a39 100644
--- a/include/llvm/Support/Dwarf.h
+++ b/include/llvm/Support/Dwarf.h
@@ -526,6 +526,7 @@ enum dwarf_constants {
DW_LANG_D = 0x0013,
DW_LANG_Python = 0x0014,
DW_LANG_lo_user = 0x8000,
+ DW_LANG_Mips_Assembler = 0x8001,
DW_LANG_hi_user = 0xffff,
// Identifier case codes