aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/DwarfWriter.cpp
diff options
context:
space:
mode:
authorAnton Korobeynikov <asl@math.spbu.ru>2008-08-16 12:57:46 +0000
committerAnton Korobeynikov <asl@math.spbu.ru>2008-08-16 12:57:46 +0000
commitffe31d7bf1e070650b0ff9ebfac815ea172a82bb (patch)
tree2d393175d6a72aa68e404e7169ab57b41fc9d96f /lib/CodeGen/DwarfWriter.cpp
parentd0c1e29aecdaaa67ffabbaf2dd255809e6df4978 (diff)
Move SLEB/ULEB size calculation routines from AsmPrinter to TargetAsmInfo. This makes JIT asmprinter-free.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54843 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/DwarfWriter.cpp')
-rw-r--r--lib/CodeGen/DwarfWriter.cpp801
1 files changed, 401 insertions, 400 deletions
diff --git a/lib/CodeGen/DwarfWriter.cpp b/lib/CodeGen/DwarfWriter.cpp
index 335623cda6..5d6acc30ba 100644
--- a/lib/CodeGen/DwarfWriter.cpp
+++ b/lib/CodeGen/DwarfWriter.cpp
@@ -42,7 +42,7 @@ using namespace llvm;
using namespace llvm::dwarf;
namespace llvm {
-
+
//===----------------------------------------------------------------------===//
/// Configuration values for initial hash set sizes (log2).
@@ -59,26 +59,26 @@ class DIEValue;
//===----------------------------------------------------------------------===//
/// DWLabel - Labels are used to track locations in the assembler file.
-/// Labels appear in the form @verbatim <prefix><Tag><Number> @endverbatim,
-/// where the tag is a category of label (Ex. location) and number is a value
+/// Labels appear in the form @verbatim <prefix><Tag><Number> @endverbatim,
+/// where the tag is a category of label (Ex. location) and number is a value
/// unique in that category.
class DWLabel {
public:
/// Tag - Label category tag. Should always be a staticly declared C string.
///
const char *Tag;
-
+
/// Number - Value to make label unique.
///
unsigned Number;
DWLabel(const char *T, unsigned N) : Tag(T), Number(N) {}
-
+
void Profile(FoldingSetNodeID &ID) const {
ID.AddString(std::string(Tag));
ID.AddInteger(Number);
}
-
+
#ifndef NDEBUG
void print(std::ostream *O) const {
if (O) print(*O);
@@ -98,17 +98,17 @@ private:
/// Attribute - Dwarf attribute code.
///
unsigned Attribute;
-
+
/// Form - Dwarf form code.
- ///
- unsigned Form;
-
+ ///
+ unsigned Form;
+
public:
DIEAbbrevData(unsigned A, unsigned F)
: Attribute(A)
, Form(F)
{}
-
+
// Accessors.
unsigned getAttribute() const { return Attribute; }
unsigned getForm() const { return Form; }
@@ -129,7 +129,7 @@ private:
/// Tag - Dwarf tag code.
///
unsigned Tag;
-
+
/// Unique number for node.
///
unsigned Number;
@@ -150,7 +150,7 @@ public:
, Data()
{}
~DIEAbbrev() {}
-
+
// Accessors.
unsigned getTag() const { return Tag; }
unsigned getNumber() const { return Number; }
@@ -159,34 +159,34 @@ public:
void setTag(unsigned T) { Tag = T; }
void setChildrenFlag(unsigned CF) { ChildrenFlag = CF; }
void setNumber(unsigned N) { Number = N; }
-
+
/// AddAttribute - Adds another set of attribute information to the
/// abbreviation.
void AddAttribute(unsigned Attribute, unsigned Form) {
Data.push_back(DIEAbbrevData(Attribute, Form));
}
-
+
/// AddFirstAttribute - Adds a set of attribute information to the front
/// of the abbreviation.
void AddFirstAttribute(unsigned Attribute, unsigned Form) {
Data.insert(Data.begin(), DIEAbbrevData(Attribute, Form));
}
-
+
/// Profile - Used to gather unique data for the abbreviation folding set.
///
void Profile(FoldingSetNodeID &ID) {
ID.AddInteger(Tag);
ID.AddInteger(ChildrenFlag);
-
+
// For each attribute description.
for (unsigned i = 0, N = Data.size(); i < N; ++i)
Data[i].Profile(ID);
}
-
+
/// Emit - Print the abbreviation using the specified Dwarf writer.
///
- void Emit(const DwarfDebug &DD) const;
-
+ void Emit(const DwarfDebug &DD) const;
+
#ifndef NDEBUG
void print(std::ostream *O) {
if (O) print(*O);
@@ -204,23 +204,23 @@ protected:
/// Abbrev - Buffer for constructing abbreviation.
///
DIEAbbrev Abbrev;
-
+
/// Offset - Offset in debug info section.
///
unsigned Offset;
-
+
/// Size - Size of instance + children.
///
unsigned Size;
-
+
/// Children DIEs.
///
std::vector<DIE *> Children;
-
+
/// Attributes values.
///
SmallVector<DIEValue*, 32> Values;
-
+
public:
explicit DIE(unsigned Tag)
: Abbrev(Tag, DW_CHILDREN_no)
@@ -230,7 +230,7 @@ public:
, Values()
{}
virtual ~DIE();
-
+
// Accessors.
DIEAbbrev &getAbbrev() { return Abbrev; }
unsigned getAbbrevNumber() const {
@@ -244,18 +244,18 @@ public:
void setTag(unsigned Tag) { Abbrev.setTag(Tag); }
void setOffset(unsigned O) { Offset = O; }
void setSize(unsigned S) { Size = S; }
-
+
/// AddValue - Add a value and attributes to a DIE.
///
void AddValue(unsigned Attribute, unsigned Form, DIEValue *Value) {
Abbrev.AddAttribute(Attribute, Form);
Values.push_back(Value);
}
-
+
/// SiblingOffset - Return the offset of the debug information entry's
/// sibling.
unsigned SiblingOffset() const { return Offset + Size; }
-
+
/// AddSiblingOffset - Add a sibling offset field to the front of the DIE.
///
void AddSiblingOffset();
@@ -266,17 +266,17 @@ public:
Abbrev.setChildrenFlag(DW_CHILDREN_yes);
Children.push_back(Child);
}
-
+
/// Detach - Detaches objects connected to it after copying.
///
void Detach() {
Children.clear();
}
-
+
/// Profile - Used to gather unique data for the value folding set.
///
void Profile(FoldingSetNodeID &ID) ;
-
+
#ifndef NDEBUG
void print(std::ostream *O, unsigned IncIndent = 0) {
if (O) print(*O, IncIndent);
@@ -301,34 +301,34 @@ public:
isEntry,
isBlock
};
-
+
/// Type - Type of data stored in the value.
///
unsigned Type;
-
+
explicit DIEValue(unsigned T)
: Type(T)
{}
virtual ~DIEValue() {}
-
+
// Accessors
unsigned getType() const { return Type; }
-
+
// Implement isa/cast/dyncast.
static bool classof(const DIEValue *) { return true; }
-
+
/// EmitValue - Emit value via the Dwarf writer.
///
virtual void EmitValue(DwarfDebug &DD, unsigned Form) = 0;
-
+
/// SizeOf - Return the size of a value in bytes.
///
virtual unsigned SizeOf(const DwarfDebug &DD, unsigned Form) const = 0;
-
+
/// Profile - Used to gather unique data for the value folding set.
///
virtual void Profile(FoldingSetNodeID &ID) = 0;
-
+
#ifndef NDEBUG
void print(std::ostream *O) {
if (O) print(*O);
@@ -340,18 +340,18 @@ public:
//===----------------------------------------------------------------------===//
/// DWInteger - An integer value DIE.
-///
+///
class DIEInteger : public DIEValue {
private:
uint64_t Integer;
-
+
public:
explicit DIEInteger(uint64_t I) : DIEValue(isInteger), Integer(I) {}
// Implement isa/cast/dyncast.
static bool classof(const DIEInteger *) { return true; }
static bool classof(const DIEValue *I) { return I->Type == isInteger; }
-
+
/// BestForm - Choose the best form for integer.
///
static unsigned BestForm(bool IsSigned, uint64_t Integer) {
@@ -366,15 +366,15 @@ public:
}
return DW_FORM_data8;
}
-
+
/// EmitValue - Emit integer of appropriate size.
///
virtual void EmitValue(DwarfDebug &DD, unsigned Form);
-
+
/// SizeOf - Determine size of integer value in bytes.
///
virtual unsigned SizeOf(const DwarfDebug &DD, unsigned Form) const;
-
+
/// Profile - Used to gather unique data for the value folding set.
///
static void Profile(FoldingSetNodeID &ID, unsigned Integer) {
@@ -382,7 +382,7 @@ public:
ID.AddInteger(Integer);
}
virtual void Profile(FoldingSetNodeID &ID) { Profile(ID, Integer); }
-
+
#ifndef NDEBUG
virtual void print(std::ostream &O) {
O << "Int: " << (int64_t)Integer
@@ -393,27 +393,27 @@ public:
//===----------------------------------------------------------------------===//
/// DIEString - A string value DIE.
-///
+///
class DIEString : public DIEValue {
public:
const std::string String;
-
+
explicit DIEString(const std::string &S) : DIEValue(isString), String(S) {}
// Implement isa/cast/dyncast.
static bool classof(const DIEString *) { return true; }
static bool classof(const DIEValue *S) { return S->Type == isString; }
-
+
/// EmitValue - Emit string value.
///
virtual void EmitValue(DwarfDebug &DD, unsigned Form);
-
+
/// SizeOf - Determine size of string value in bytes.
///
virtual unsigned SizeOf(const DwarfDebug &DD, unsigned Form) const {
return String.size() + sizeof(char); // sizeof('\0');
}
-
+
/// Profile - Used to gather unique data for the value folding set.
///
static void Profile(FoldingSetNodeID &ID, const std::string &String) {
@@ -421,7 +421,7 @@ public:
ID.AddString(String);
}
virtual void Profile(FoldingSetNodeID &ID) { Profile(ID, String); }
-
+
#ifndef NDEBUG
virtual void print(std::ostream &O) {
O << "Str: \"" << String << "\"";
@@ -436,21 +436,21 @@ class DIEDwarfLabel : public DIEValue {
public:
const DWLabel Label;
-
+
explicit DIEDwarfLabel(const DWLabel &L) : DIEValue(isLabel), Label(L) {}
// Implement isa/cast/dyncast.
static bool classof(const DIEDwarfLabel *) { return true; }
static bool classof(const DIEValue *L) { return L->Type == isLabel; }
-
+
/// EmitValue - Emit label value.
///
virtual void EmitValue(DwarfDebug &DD, unsigned Form);
-
+
/// SizeOf - Determine size of label value in bytes.
///
virtual unsigned SizeOf(const DwarfDebug &DD, unsigned Form) const;
-
+
/// Profile - Used to gather unique data for the value folding set.
///
static void Profile(FoldingSetNodeID &ID, const DWLabel &Label) {
@@ -458,7 +458,7 @@ public:
Label.Profile(ID);
}
virtual void Profile(FoldingSetNodeID &ID) { Profile(ID, Label); }
-
+
#ifndef NDEBUG
virtual void print(std::ostream &O) {
O << "Lbl: ";
@@ -474,22 +474,22 @@ public:
class DIEObjectLabel : public DIEValue {
public:
const std::string Label;
-
+
explicit DIEObjectLabel(const std::string &L)
: DIEValue(isAsIsLabel), Label(L) {}
// Implement isa/cast/dyncast.
static bool classof(const DIEObjectLabel *) { return true; }
static bool classof(const DIEValue *L) { return L->Type == isAsIsLabel; }
-
+
/// EmitValue - Emit label value.
///
virtual void EmitValue(DwarfDebug &DD, unsigned Form);
-
+
/// SizeOf - Determine size of label value in bytes.
///
virtual unsigned SizeOf(const DwarfDebug &DD, unsigned Form) const;
-
+
/// Profile - Used to gather unique data for the value folding set.
///
static void Profile(FoldingSetNodeID &ID, const std::string &Label) {
@@ -514,7 +514,7 @@ public:
const DWLabel Section;
bool IsEH : 1;
bool UseSet : 1;
-
+
DIESectionOffset(const DWLabel &Lab, const DWLabel &Sec,
bool isEH = false, bool useSet = true)
: DIEValue(isSectionOffset), Label(Lab), Section(Sec),
@@ -523,15 +523,15 @@ public:
// Implement isa/cast/dyncast.
static bool classof(const DIESectionOffset *) { return true; }
static bool classof(const DIEValue *D) { return D->Type == isSectionOffset; }
-
+
/// EmitValue - Emit section offset.
///
virtual void EmitValue(DwarfDebug &DD, unsigned Form);
-
+
/// SizeOf - Determine size of section offset value in bytes.
///
virtual unsigned SizeOf(const DwarfDebug &DD, unsigned Form) const;
-
+
/// Profile - Used to gather unique data for the value folding set.
///
static void Profile(FoldingSetNodeID &ID, const DWLabel &Label,
@@ -557,27 +557,27 @@ public:
//===----------------------------------------------------------------------===//
/// DIEDelta - A simple label difference DIE.
-///
+///
class DIEDelta : public DIEValue {
public:
const DWLabel LabelHi;
const DWLabel LabelLo;
-
+
DIEDelta(const DWLabel &Hi, const DWLabel &Lo)
: DIEValue(isDelta), LabelHi(Hi), LabelLo(Lo) {}
// Implement isa/cast/dyncast.
static bool classof(const DIEDelta *) { return true; }
static bool classof(const DIEValue *D) { return D->Type == isDelta; }
-
+
/// EmitValue - Emit delta value.
///
virtual void EmitValue(DwarfDebug &DD, unsigned Form);
-
+
/// SizeOf - Determine size of delta value in bytes.
///
virtual unsigned SizeOf(const DwarfDebug &DD, unsigned Form) const;
-
+
/// Profile - Used to gather unique data for the value folding set.
///
static void Profile(FoldingSetNodeID &ID, const DWLabel &LabelHi,
@@ -605,23 +605,23 @@ public:
class DIEntry : public DIEValue {
public:
DIE *Entry;
-
+
explicit DIEntry(DIE *E) : DIEValue(isEntry), Entry(E) {}
-
+
// Implement isa/cast/dyncast.
static bool classof(const DIEntry *) { return true; }
static bool classof(const DIEValue *E) { return E->Type == isEntry; }
-
+
/// EmitValue - Emit debug information entry offset.
///
virtual void EmitValue(DwarfDebug &DD, unsigned Form);
-
+
/// SizeOf - Determine size of debug information entry in bytes.
///
virtual unsigned SizeOf(const DwarfDebug &DD, unsigned Form) const {
return sizeof(int32_t);
}
-
+
/// Profile - Used to gather unique data for the value folding set.
///
static void Profile(FoldingSetNodeID &ID, DIE *Entry) {
@@ -630,14 +630,14 @@ public:
}
virtual void Profile(FoldingSetNodeID &ID) {
ID.AddInteger(isEntry);
-
+
if (Entry) {
ID.AddPointer(Entry);
} else {
ID.AddPointer(this);
}
}
-
+
#ifndef NDEBUG
virtual void print(std::ostream &O) {
O << "Die: 0x" << std::hex << (intptr_t)Entry << std::dec;
@@ -651,7 +651,7 @@ public:
class DIEBlock : public DIEValue, public DIE {
public:
unsigned Size; // Size in bytes excluding size header.
-
+
DIEBlock()
: DIEValue(isBlock)
, DIE(0)
@@ -659,15 +659,15 @@ public:
{}
~DIEBlock() {
}
-
+
// Implement isa/cast/dyncast.
static bool classof(const DIEBlock *) { return true; }
static bool classof(const DIEValue *E) { return E->Type == isBlock; }
-
+
/// ComputeSize - calculate the size of the block.
///
unsigned ComputeSize(DwarfDebug &DD);
-
+
/// BestForm - Choose the best form for data.
///
unsigned BestForm() const {
@@ -680,11 +680,11 @@ public:
/// EmitValue - Emit block data.
///
virtual void EmitValue(DwarfDebug &DD, unsigned Form);
-
+
/// SizeOf - Determine size of block data in bytes.
///
virtual unsigned SizeOf(const DwarfDebug &DD, unsigned Form) const;
-
+
/// Profile - Used to gather unique data for the value folding set.
///
@@ -692,7 +692,7 @@ public:
ID.AddInteger(isBlock);
DIE::Profile(ID);
}
-
+
#ifndef NDEBUG
virtual void print(std::ostream &O) {
O << "Blk: ";
@@ -709,15 +709,15 @@ private:
/// Desc - Compile unit debug descriptor.
///
CompileUnitDesc *Desc;
-
+
/// ID - File identifier for source.
///
unsigned ID;
-
+
/// Die - Compile unit debug information entry.
///
DIE *Die;
-
+
/// DescToDieMap - Tracks the mapping of unit level debug informaton
/// descriptors to debug information entries.
std::map<DebugInfoDesc *, DIE *> DescToDieMap;
@@ -733,11 +733,11 @@ private:
/// DiesSet - Used to uniquely define dies within the compile unit.
///
FoldingSet<DIE> DiesSet;
-
+
/// Dies - List of all dies in the compile unit.
///
std::vector<DIE *> Dies;
-
+
public:
CompileUnit(CompileUnitDesc *CUD, unsigned I, DIE *D)
: Desc(CUD)
@@ -749,14 +749,14 @@ public:
, DiesSet(InitDiesSetSize)
, Dies()
{}
-
+
~CompileUnit() {
delete Die;
-
+
for (unsigned i = 0, N = Dies.size(); i < N; ++i)
delete Dies[i];
}
-
+
// Accessors.
CompileUnitDesc *getDesc() const { return Desc; }
unsigned getID() const { return ID; }
@@ -774,19 +774,19 @@ public:
void AddGlobal(const std::string &Name, DIE *Die) {
Globals[Name] = Die;
}
-
+
/// getDieMapSlotFor - Returns the debug information entry map slot for the
/// specified debug descriptor.
DIE *&getDieMapSlotFor(DebugInfoDesc *DID) {
return DescToDieMap[DID];
}
-
+
/// getDIEntrySlotFor - Returns the debug information entry proxy slot for the
/// specified debug descriptor.
DIEntry *&getDIEntrySlotFor(DebugInfoDesc *DID) {
return DescToDIEntryMap[DID];
}
-
+
/// AddDie - Adds or interns the DIE to the compile unit.
///
DIE *AddDie(DIE &Buffer) {
@@ -794,20 +794,20 @@ public:
Buffer.Profile(ID);
void *Where;
DIE *Die = DiesSet.FindNodeOrInsertPos(ID, Where);
-
+
if (!Die) {
Die = new DIE(Buffer);
DiesSet.InsertNode(Die, Where);
this->Die->AddChild(Die);
Buffer.Detach();
}
-
+
return Die;
}
};
//===----------------------------------------------------------------------===//
-/// Dwarf - Emits general Dwarf directives.
+/// Dwarf - Emits general Dwarf directives.
///
class Dwarf {
@@ -816,7 +816,7 @@ protected:
//===--------------------------------------------------------------------===//
// Core attributes used by the Dwarf writer.
//
-
+
//
/// O - Stream to .s file.
///
@@ -825,32 +825,32 @@ protected:
/// Asm - Target of Dwarf emission.
///
AsmPrinter *Asm;
-
+
/// TAI - Target asm information.
const TargetAsmInfo *TAI;
-
+
/// TD - Target data.
const TargetData *TD;
-
+
/// RI - Register Information.
const TargetRegisterInfo *RI;
-
+
/// M - Current module.
///
Module *M;
-
+
/// MF - Current machine function.
///
MachineFunction *MF;
-
+
/// MMI - Collected machine module information.
///
MachineModuleInfo *MMI;
-
+
/// SubprogramCount - The running count of functions being compiled.
///
unsigned SubprogramCount;
-
+
/// Flavor - A unique string indicating what dwarf producer this is, used to
/// unique labels.
const char * const Flavor;
@@ -891,7 +891,7 @@ public:
else
O << TAI->getData64bitsDirective();
}
-
+
/// PrintLabelName - Print label name in form used by Dwarf writer.
///
void PrintLabelName(DWLabel Label) const {
@@ -901,14 +901,14 @@ public:
O << TAI->getPrivateGlobalPrefix() << Tag;
if (Number) O << Number;
}
-
+
void PrintLabelName(const char *Tag, unsigned Number,
const char *Suffix) const {
O << TAI->getPrivateGlobalPrefix() << Tag;
if (Number) O << Number;
O << Suffix;
}
-
+
/// EmitLabel - Emit location label for internal use by Dwarf.
///
void EmitLabel(DWLabel Label) const {
@@ -918,7 +918,7 @@ public:
PrintLabelName(Tag, Number);
O << ":\n";
}
-
+
/// EmitReference - Emit a reference to a label.
///
void EmitReference(DWLabel Label, bool IsPCRelative = false,
@@ -929,15 +929,15 @@ public:
bool IsPCRelative = false, bool Force32Bit = false) const {
PrintRelDirective(Force32Bit);
PrintLabelName(Tag, Number);
-
+
if (IsPCRelative) O << "-" << TAI->getPCSymbol();
}
void EmitReference(const std::string &Name, bool IsPCRelative = false,
bool Force32Bit = false) const {
PrintRelDirective(Force32Bit);
-
+
O << Name;
-
+
if (IsPCRelative) O << "-" << TAI->getPCSymbol();
}
@@ -967,7 +967,7 @@ public:
++SetCounter;
} else {
PrintRelDirective(IsSmall);
-
+
PrintLabelName(TagHi, NumberHi);
O << "-";
PrintLabelName(TagLo, NumberLo);
@@ -993,25 +993,25 @@ public:
if (!printAbsolute) {
O << "-";
PrintLabelName(Section, SectionNumber);
- }
+ }
O << "\n";
PrintRelDirective(IsSmall);
-
+
PrintLabelName("set", SetCounter, Flavor);
++SetCounter;
} else {
PrintRelDirective(IsSmall, true);
-
+
PrintLabelName(Label, LabelNumber);
if (!printAbsolute) {
O << "-";
PrintLabelName(Section, SectionNumber);
}
- }
+ }
}
-
+
/// EmitFrameMoves - Emit frame instructions to describe the layout of the
/// frame.
void EmitFrameMoves(const char *BaseLabel, unsigned BaseLabelID,
@@ -1025,29 +1025,29 @@ public:
for (unsigned i = 0, N = Moves.size(); i < N; ++i) {
const MachineMove &Move = Moves[i];
unsigned LabelID = Move.getLabelID();
-
+
if (LabelID) {
LabelID = MMI->MappedLabel(LabelID);
-
+
// Throw out move if the label is invalid.
if (!LabelID) continue;
}
-
+
const MachineLocation &Dst = Move.getDestination();
const MachineLocation &Src = Move.getSource();
-
+
// Advance row if new location.
if (BaseLabel && LabelID && (BaseLabelID != LabelID || !IsLocal)) {
Asm->EmitInt8(DW_CFA_advance_loc4);
Asm->EOL("DW_CFA_advance_loc4");
EmitDifference("label", LabelID, BaseLabel, BaseLabelID, true);
Asm->EOL();
-
+
BaseLabelID = LabelID;
BaseLabel = "label";
IsLocal = true;
}
-
+
// If advancing cfa.
if (Dst.isRegister() && Dst.getRegister() == MachineLocation::VirtualFP) {
if (!Src.isRegister()) {
@@ -1060,9 +1060,9 @@ public:
Asm->EmitULEB128Bytes(RI->getDwarfRegNum(Src.getRegister(), isEH));
Asm->EOL("Register");
}
-
+
int Offset = -Src.getOffset();
-
+
Asm->EmitULEB128Bytes(Offset);
Asm->EOL("Offset");
} else {
@@ -1081,7 +1081,7 @@ public:
} else {
unsigned Reg = RI->getDwarfRegNum(Src.getRegister(), isEH);
int Offset = Dst.getOffset() / stackGrowth;
-
+
if (Offset < 0) {
Asm->EmitInt8(DW_CFA_offset_extended_sf);
Asm->EOL("DW_CFA_offset_extended_sf");
@@ -1112,7 +1112,7 @@ public:
};
//===----------------------------------------------------------------------===//
-/// DwarfDebug - Emits Dwarf debug directives.
+/// DwarfDebug - Emits Dwarf debug directives.
///
class DwarfDebug : public Dwarf {
@@ -1120,11 +1120,11 @@ private:
//===--------------------------------------------------------------------===//
// Attributes used to construct specific Dwarf sections.
//
-
+
/// CompileUnits - All the compile units involved in this build. The index
/// of each entry in this vector corresponds to the sources in MMI.
std::vector<CompileUnit *> CompileUnits;
-
+
/// AbbreviationsSet - Used to uniquely define abbreviations.
///
FoldingSet<DIEAbbrev> AbbreviationsSet;
@@ -1132,15 +1132,15 @@ private:
/// Abbreviations - A list of all the unique abbreviations in use.
///
std::vector<DIEAbbrev *> Abbreviations;
-
+
/// ValuesSet - Used to uniquely define values.
///
FoldingSet<DIEValue> ValuesSet;
-
+
/// Values - A list of all the unique values in use.
///
std::vector<DIEValue *> Values;
-
+
/// StringPool - A UniqueVector of strings used by indirect references.
///
UniqueVector<std::string> StringPool;
@@ -1148,11 +1148,11 @@ private:
/// UnitMap - Map debug information descriptor to compile unit.
///
std::map<DebugInfoDesc *, CompileUnit *> DescToUnitMap;
-
+
/// SectionMap - Provides a unique id per text section.
///
UniqueVector<std::string> SectionMap;
-
+
/// SectionSourceLines - Tracks line numbers per text section.
///
std::vector<std::vector<SourceLineInfo> > SectionSourceLines;
@@ -1160,7 +1160,7 @@ private:
/// didInitial - Flag to indicate if initial emission has been done.
///
bool didInitial;
-
+
/// shouldEmit - Flag to indicate if debug information should be emitted.
///
bool shouldEmit;
@@ -1174,26 +1174,26 @@ private:
};
std::vector<FunctionDebugFrameInfo> DebugFrames;
-
+
public:
-
+
/// ShouldEmitDwarf - Returns true if Dwarf declarations should be made.
///
bool ShouldEmitDwarf() const { return shouldEmit; }
/// AssignAbbrevNumber - Define a unique number for the abbreviation.
- ///
+ ///
void AssignAbbrevNumber(DIEAbbrev &Abbrev) {
// Profile the node so that we can make it unique.
FoldingSetNodeID ID;
Abbrev.Profile(ID);
-
+
// Check the set for priors.
DIEAbbrev *InSet = AbbreviationsSet.GetOrInsertNode(&Abbrev);
-
+
// If it's newly added.
if (InSet == &Abbrev) {
- // Add to abbreviation list.
+ // Add to abbreviation list.
Abbreviations.push_back(&Abbrev);
// Assign the vector position + 1 as its number.
Abbrev.setNumber(Abbreviations.size());
@@ -1209,30 +1209,30 @@ public:
unsigned StringID = StringPool.insert(String);
return DWLabel("string", StringID);
}
-
+
/// NewDIEntry - Creates a new DIEntry to be a proxy for a debug information
/// entry.
DIEntry *NewDIEntry(DIE *Entry = NULL) {
DIEntry *Value;
-
+
if (Entry) {
FoldingSetNodeID ID;
DIEntry::Profile(ID, Entry);
void *Where;
Value = static_cast<DIEntry *>(ValuesSet.FindNodeOrInsertPos(ID, Where));
-
+
if (Value) return Value;
-
+
Value = new DIEntry(Entry);
ValuesSet.InsertNode(Value, Where);
} else {
Value = new DIEntry(Entry);
}
-
+
Values.push_back(Value);
return Value;
}
-
+
/// SetDIEntry - Set a DIEntry once the debug information entry is defined.
///
void SetDIEntry(DIEntry *Value, DIE *Entry) {
@@ -1256,10 +1256,10 @@ public:
ValuesSet.InsertNode(Value, Where);
Values.push_back(Value);
}
-
+
Die->AddValue(Attribute, Form, Value);
}
-
+
/// AddSInt - Add an signed integer attribute data and value.
///
void AddSInt(DIE *Die, unsigned Attribute, unsigned Form, int64_t Integer) {
@@ -1274,10 +1274,10 @@ public:
ValuesSet.InsertNode(Value, Where);
Values.push_back(Value);
}
-
+
Die->AddValue(Attribute, Form, Value);
}
-
+
/// AddString - Add a std::string attribute data and value.
///
void AddString(DIE *Die, unsigned Attribute, unsigned Form,
@@ -1291,10 +1291,10 @@ public:
ValuesSet.InsertNode(Value, Where);
Values.push_back(Value);
}
-
+
Die->AddValue(Attribute, Form, Value);
}
-
+
/// AddLabel - Add a Dwarf label attribute data and value.
///
void AddLabel(DIE *Die, unsigned Attribute, unsigned Form,
@@ -1308,10 +1308,10 @@ public:
ValuesSet.InsertNode(Value, Where);
Values.push_back(Value);
}
-
+
Die->AddValue(Attribute, Form, Value);
}
-
+
/// AddObjectLabel - Add an non-Dwarf label attribute data and value.
///
void AddObjectLabel(DIE *Die, unsigned Attribute, unsigned Form,
@@ -1325,10 +1325,10 @@ public:
ValuesSet.InsertNode(Value, Where);
Values.push_back(Value);
}
-
+
Die->AddValue(Attribute, Form, Value);
}
-
+
/// AddSectionOffset - Add a section offset label attribute data and value.
///
void AddSectionOffset(DIE *Die, unsigned Attribute, unsigned Form,
@@ -1343,10 +1343,10 @@ public:
ValuesSet.InsertNode(Value, Where);
Values.push_back(Value);
}
-
+
Die->AddValue(Attribute, Form, Value);
}
-
+
/// AddDelta - Add a label delta attribute data and value.
///
void AddDelta(DIE *Die, unsigned Attribute, unsigned Form,
@@ -1360,10 +1360,10 @@ public:
ValuesSet.InsertNode(Value, Where);
Values.push_back(Value);
}
-
+
Die->AddValue(Attribute, Form, Value);
}
-
+
/// AddDIEntry - Add a DIE attribute data and value.
///
void AddDIEntry(DIE *Die, unsigned Attribute, unsigned Form, DIE *Entry) {
@@ -1387,7 +1387,7 @@ public:
delete Block;
Block = cast<DIEBlock>(Value);
}
-
+
Die->AddValue(Attribute, Block->BestForm(), Value);
}
@@ -1410,7 +1410,7 @@ private:
const MachineLocation &Location) {
unsigned Reg = RI->getDwarfRegNum(Location.getRegister(), false);
DIEBlock *Block = new DIEBlock();
-
+
if (Location.isRegister()) {
if (Reg < 32) {
AddUInt(Block, 0, DW_FORM_data1, DW_OP_reg0 + Reg);
@@ -1427,10 +1427,10 @@ private:
}
AddUInt(Block, 0, DW_FORM_sdata, Location.getOffset());
}
-
+
AddBlock(Die, Attribute, 0, Block);
}
-
+
/// AddBasicType - Add a new basic type attribute to the specified entity.
///
void AddBasicType(DIE *Entity, CompileUnit *Unit,
@@ -1439,7 +1439,7 @@ private:
DIE *Die = ConstructBasicType(Unit, Name, Encoding, Size);
AddDIEntry(Entity, DW_AT_type, DW_FORM_ref4, Die);
}
-
+
/// ConstructBasicType - Construct a new basic type.
///
DIE *ConstructBasicType(CompileUnit *Unit,
@@ -1451,14 +1451,14 @@ private:
if (!Name.empty()) AddString(&Buffer, DW_AT_name, DW_FORM_string, Name);
return Unit->AddDie(Buffer);
}
-
+
/// AddPointerType - Add a new pointer type attribute to the specified entity.
///
void AddPointerType(DIE *Entity, CompileUnit *Unit, const std::string &Name) {
DIE *Die = ConstructPointerType(Unit, Name);
AddDIEntry(Entity, DW_AT_type, DW_FORM_ref4, Die);
}
-
+
/// ConstructPointerType - Construct a new pointer type.
///
DIE *ConstructPointerType(CompileUnit *Unit, const std::string &Name) {
@@ -1467,7 +1467,7 @@ private:
if (!Name.empty()) AddString(&Buffer, DW_AT_name, DW_FORM_string, Name);
return Unit->AddDie(Buffer);
}
-
+
/// AddType - Add a new type attribute to the specified entity.
///
void AddType(DIE *Entity, TypeDesc *TyDesc, CompileUnit *Unit) {
@@ -1476,13 +1476,13 @@ private:
} else {
// Check for pre-existence.
DIEntry *&Slot = Unit->getDIEntrySlotFor(TyDesc);
-
+
// If it exists then use the existing value.
if (Slot) {
Entity->AddValue(DW_AT_type, DW_FORM_ref4, Slot);
return;
}
-
+
if (SubprogramDesc *SubprogramTy = dyn_cast<SubprogramDesc>(TyDesc)) {
// FIXME - Not sure why programs and variables are coming through here.
// Short cut for handling subprogram type