First bit of support for the dwarf .loc directive. This patch updates the

needed parsing for the .loc directive and saves the current info from that
into the context.  The next patch will take the current loc info after an
instruction is assembled and save that info into a vector for each section for
use to build the line number tables.  The patch after that will encode the info
from those vectors into the output file as the dwarf line tables.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111956 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Kevin Enderby
2010-08-24 20:32:42 +00:00
parent a15a133647
commit c1840b3da2
4 changed files with 163 additions and 20 deletions

View File

@ -57,6 +57,50 @@ namespace llvm {
void dump() const;
};
/// MCDwarfLoc - Instances of this class represent the information from a
/// dwarf .loc directive.
class MCDwarfLoc {
// FileNum - the file number.
unsigned FileNum;
// Line - the line number.
unsigned Line;
// Column - the column position.
unsigned Column;
// Flags (see #define's below)
unsigned Flags;
// Isa
unsigned Isa;
#define DWARF2_FLAG_IS_STMT (1 << 0)
#define DWARF2_FLAG_BASIC_BLOCK (1 << 1)
#define DWARF2_FLAG_PROLOGUE_END (1 << 2)
#define DWARF2_FLAG_EPILOGUE_BEGIN (1 << 3)
private: // MCContext manages these
friend class MCContext;
MCDwarfLoc(unsigned fileNum, unsigned line, unsigned column, unsigned flags,
unsigned isa)
: FileNum(fileNum), Line(line), Column(column), Flags(flags), Isa(isa) {}
MCDwarfLoc(const MCDwarfLoc&); // DO NOT IMPLEMENT
void operator=(const MCDwarfLoc&); // DO NOT IMPLEMENT
public:
/// setFileNum - Set the FileNum of this MCDwarfLoc.
void setFileNum(unsigned fileNum) { FileNum = fileNum; }
/// setLine - Set the Line of this MCDwarfLoc.
void setLine(unsigned line) { Line = line; }
/// setColumn - Set the Column of this MCDwarfLoc.
void setColumn(unsigned column) { Column = column; }
/// setFlags - Set the Flags of this MCDwarfLoc.
void setFlags(unsigned flags) { Flags = flags; }
/// setIsa - Set the Isa of this MCDwarfLoc.
void setIsa(unsigned isa) { Isa = isa; }
};
inline raw_ostream &operator<<(raw_ostream &OS, const MCDwarfFile &DwarfFile){
DwarfFile.print(OS);
return OS;