merge DIEObjectLabel and DIEDwarfLabel into DIELabel.

Yes, DIE you fiendish labels, die all of you.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97995 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2010-03-08 22:31:46 +00:00
parent 7aa8189706
commit 4faf59af82
5 changed files with 13 additions and 89 deletions

View File

@ -254,53 +254,29 @@ void DIEString::print(raw_ostream &O) {
#endif #endif
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// DIEDwarfLabel Implementation // DIELabel Implementation
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
/// EmitValue - Emit label value. /// EmitValue - Emit label value.
/// ///
void DIEDwarfLabel::EmitValue(DwarfPrinter *D, unsigned Form) const { void DIELabel::EmitValue(DwarfPrinter *D, unsigned Form) const {
bool IsSmall = Form == dwarf::DW_FORM_data4; bool IsSmall = Form == dwarf::DW_FORM_data4;
D->EmitReference(Label, false, IsSmall); D->EmitReference(Label, false, IsSmall);
} }
/// SizeOf - Determine size of label value in bytes. /// SizeOf - Determine size of label value in bytes.
/// ///
unsigned DIEDwarfLabel::SizeOf(const TargetData *TD, unsigned Form) const { unsigned DIELabel::SizeOf(const TargetData *TD, unsigned Form) const {
if (Form == dwarf::DW_FORM_data4) return 4; if (Form == dwarf::DW_FORM_data4) return 4;
return TD->getPointerSize(); return TD->getPointerSize();
} }
#ifndef NDEBUG #ifndef NDEBUG
void DIEDwarfLabel::print(raw_ostream &O) { void DIELabel::print(raw_ostream &O) {
O << "Lbl: " << Label->getName(); O << "Lbl: " << Label->getName();
} }
#endif #endif
//===----------------------------------------------------------------------===//
// DIEObjectLabel Implementation
//===----------------------------------------------------------------------===//
/// EmitValue - Emit label value.
///
void DIEObjectLabel::EmitValue(DwarfPrinter *D, unsigned Form) const {
bool IsSmall = Form == dwarf::DW_FORM_data4;
D->EmitReference(Sym, false, IsSmall);
}
/// SizeOf - Determine size of label value in bytes.
///
unsigned DIEObjectLabel::SizeOf(const TargetData *TD, unsigned Form) const {
if (Form == dwarf::DW_FORM_data4) return 4;
return TD->getPointerSize();
}
#ifndef NDEBUG
void DIEObjectLabel::print(raw_ostream &O) {
O << "Obj: " << Sym->getName();
}
#endif
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// DIESectionOffset Implementation // DIESectionOffset Implementation
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//

View File

@ -203,7 +203,6 @@ namespace llvm {
isInteger, isInteger,
isString, isString,
isLabel, isLabel,
isAsIsLabel,
isSectionOffset, isSectionOffset,
isDelta, isDelta,
isEntry, isEntry,
@ -306,13 +305,12 @@ namespace llvm {
}; };
//===--------------------------------------------------------------------===// //===--------------------------------------------------------------------===//
/// DIEDwarfLabel - A Dwarf internal label expression DIE. /// DIELabel - A label expression DIE.
// //
/// FIXME: Merge into DIEObjectLabel. class DIELabel : public DIEValue {
class DIEDwarfLabel : public DIEValue {
const MCSymbol *Label; const MCSymbol *Label;
public: public:
explicit DIEDwarfLabel(const MCSymbol *L) : DIEValue(isLabel), Label(L) {} explicit DIELabel(const MCSymbol *L) : DIEValue(isLabel), Label(L) {}
/// EmitValue - Emit label value. /// EmitValue - Emit label value.
/// ///
@ -323,37 +321,9 @@ namespace llvm {
virtual unsigned SizeOf(const TargetData *TD, unsigned Form) const; virtual unsigned SizeOf(const TargetData *TD, unsigned Form) const;
// Implement isa/cast/dyncast. // Implement isa/cast/dyncast.
static bool classof(const DIEDwarfLabel *) { return true; } static bool classof(const DIELabel *) { return true; }
static bool classof(const DIEValue *L) { return L->getType() == isLabel; } static bool classof(const DIEValue *L) { return L->getType() == isLabel; }
#ifndef NDEBUG
virtual void print(raw_ostream &O);
#endif
};
//===--------------------------------------------------------------------===//
/// DIEObjectLabel - A label to an object in code or data.
//
class DIEObjectLabel : public DIEValue {
const MCSymbol *Sym;
public:
explicit DIEObjectLabel(const MCSymbol *S)
: DIEValue(isAsIsLabel), Sym(S) {}
/// EmitValue - Emit label value.
///
virtual void EmitValue(DwarfPrinter *D, unsigned Form) const;
/// SizeOf - Determine size of label value in bytes.
///
virtual unsigned SizeOf(const TargetData *TD, unsigned Form) const;
// Implement isa/cast/dyncast.
static bool classof(const DIEObjectLabel *) { return true; }
static bool classof(const DIEValue *L) {
return L->getType() == isAsIsLabel;
}
#ifndef NDEBUG #ifndef NDEBUG
virtual void print(raw_ostream &O); virtual void print(raw_ostream &O);
#endif #endif

View File

@ -367,17 +367,7 @@ void DwarfDebug::addString(DIE *Die, unsigned Attribute, unsigned Form,
/// ///
void DwarfDebug::addLabel(DIE *Die, unsigned Attribute, unsigned Form, void DwarfDebug::addLabel(DIE *Die, unsigned Attribute, unsigned Form,
const MCSymbol *Label) { const MCSymbol *Label) {
// FIXME: Merge into DIEObjectLabel? DIEValue *Value = new DIELabel(Label);
DIEValue *Value = new DIEDwarfLabel(Label);
DIEValues.push_back(Value);
Die->addValue(Attribute, Form, Value);
}
/// addObjectLabel - Add an non-Dwarf label attribute data and value.
///
void DwarfDebug::addObjectLabel(DIE *Die, unsigned Attribute, unsigned Form,
const MCSymbol *Sym) {
DIEValue *Value = new DIEObjectLabel(Sym);
DIEValues.push_back(Value); DIEValues.push_back(Value);
Die->addValue(Attribute, Form, Value); Die->addValue(Attribute, Form, Value);
} }
@ -1704,16 +1694,16 @@ void DwarfDebug::constructGlobalVariableDIE(MDNode *N) {
dwarf::DW_FORM_ref4, VariableDie); dwarf::DW_FORM_ref4, VariableDie);
DIEBlock *Block = new DIEBlock(); DIEBlock *Block = new DIEBlock();
addUInt(Block, 0, dwarf::DW_FORM_data1, dwarf::DW_OP_addr); addUInt(Block, 0, dwarf::DW_FORM_data1, dwarf::DW_OP_addr);
addObjectLabel(Block, 0, dwarf::DW_FORM_udata, addLabel(Block, 0, dwarf::DW_FORM_udata,
Asm->GetGlobalValueSymbol(DI_GV.getGlobal())); Asm->GetGlobalValueSymbol(DI_GV.getGlobal()));
addBlock(VariableSpecDIE, dwarf::DW_AT_location, 0, Block); addBlock(VariableSpecDIE, dwarf::DW_AT_location, 0, Block);
addUInt(VariableDie, dwarf::DW_AT_declaration, dwarf::DW_FORM_flag, 1); addUInt(VariableDie, dwarf::DW_AT_declaration, dwarf::DW_FORM_flag, 1);
ModuleCU->addDie(VariableSpecDIE); ModuleCU->addDie(VariableSpecDIE);
} else { } else {
DIEBlock *Block = new DIEBlock(); DIEBlock *Block = new DIEBlock();
addUInt(Block, 0, dwarf::DW_FORM_data1, dwarf::DW_OP_addr); addUInt(Block, 0, dwarf::DW_FORM_data1, dwarf::DW_OP_addr);
addObjectLabel(Block, 0, dwarf::DW_FORM_udata, addLabel(Block, 0, dwarf::DW_FORM_udata,
Asm->GetGlobalValueSymbol(DI_GV.getGlobal())); Asm->GetGlobalValueSymbol(DI_GV.getGlobal()));
addBlock(VariableDie, dwarf::DW_AT_location, 0, Block); addBlock(VariableDie, dwarf::DW_AT_location, 0, Block);
} }
addToContextOwner(VariableDie, GVContext); addToContextOwner(VariableDie, GVContext);

View File

@ -245,11 +245,6 @@ class DwarfDebug : public DwarfPrinter {
void addLabel(DIE *Die, unsigned Attribute, unsigned Form, void addLabel(DIE *Die, unsigned Attribute, unsigned Form,
const MCSymbol *Label); const MCSymbol *Label);
/// addObjectLabel - Add an non-Dwarf label attribute data and value.
///
void addObjectLabel(DIE *Die, unsigned Attribute, unsigned Form,
const MCSymbol *Sym);
/// addSectionOffset - Add a section offset label attribute data and value. /// addSectionOffset - Add a section offset label attribute data and value.
/// ///
void addSectionOffset(DIE *Die, unsigned Attribute, unsigned Form, void addSectionOffset(DIE *Die, unsigned Attribute, unsigned Form,

View File

@ -159,13 +159,6 @@ public:
bool IsSmall = false, bool isEH = false, bool IsSmall = false, bool isEH = false,
bool useSet = true); bool useSet = true);
#if 0
void EmitSectionOffset(const char* Label, const char* Section,
unsigned LabelNumber, unsigned SectionNumber,
bool IsSmall = false, bool isEH = false,
bool useSet = true);
#endif
/// EmitFrameMoves - Emit frame instructions to describe the layout of the /// EmitFrameMoves - Emit frame instructions to describe the layout of the
/// frame. /// frame.
void EmitFrameMoves(const char *BaseLabel, unsigned BaseLabelID, void EmitFrameMoves(const char *BaseLabel, unsigned BaseLabelID,