#include "DwarfPrinter.h"
#include "llvm/CodeGen/AsmPrinter.h"
#include "llvm/MC/MCAsmInfo.h"
+#include "llvm/MC/MCSymbol.h"
#include "llvm/Target/TargetData.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/ErrorHandling.h"
///
void DIEObjectLabel::EmitValue(Dwarf *D, unsigned Form) const {
bool IsSmall = Form == dwarf::DW_FORM_data4;
- D->EmitReference(Label, false, IsSmall);
+ D->EmitReference(Sym, false, IsSmall);
}
/// SizeOf - Determine size of label value in bytes.
#ifndef NDEBUG
void DIEObjectLabel::print(raw_ostream &O) {
- O << "Obj: " << Label;
+ O << "Obj: " << Sym->getName();
}
#endif
class AsmPrinter;
class Dwarf;
class TargetData;
+ class MCSymbol;
//===--------------------------------------------------------------------===//
/// DIEAbbrevData - Dwarf abbreviation data, describes the one attribute of a
/// DIEObjectLabel - A label to an object in code or data.
//
class DIEObjectLabel : public DIEValue {
- const std::string Label;
+ const MCSymbol *Sym;
public:
- explicit DIEObjectLabel(const std::string &L)
- : DIEValue(isAsIsLabel), Label(L) {}
+ explicit DIEObjectLabel(const MCSymbol *S)
+ : DIEValue(isAsIsLabel), Sym(S) {}
/// EmitValue - Emit label value.
///
/// addObjectLabel - Add an non-Dwarf label attribute data and value.
///
void DwarfDebug::addObjectLabel(DIE *Die, unsigned Attribute, unsigned Form,
- const std::string &Label) {
- DIEValue *Value = new DIEObjectLabel(Label);
+ const MCSymbol *Sym) {
+ DIEValue *Value = new DIEObjectLabel(Sym);
DIEValues.push_back(Value);
Die->addValue(Attribute, Form, Value);
}
DIEBlock *Block = new DIEBlock();
addUInt(Block, 0, dwarf::DW_FORM_data1, dwarf::DW_OP_addr);
addObjectLabel(Block, 0, dwarf::DW_FORM_udata,
- Asm->Mang->getMangledName(DI_GV.getGlobal()));
+ Asm->GetGlobalValueSymbol(DI_GV.getGlobal()));
addBlock(VariableSpecDIE, dwarf::DW_AT_location, 0, Block);
ModuleCU->addDie(VariableSpecDIE);
} else {
DIEBlock *Block = new DIEBlock();
addUInt(Block, 0, dwarf::DW_FORM_data1, dwarf::DW_OP_addr);
addObjectLabel(Block, 0, dwarf::DW_FORM_udata,
- Asm->Mang->getMangledName(DI_GV.getGlobal()));
+ Asm->GetGlobalValueSymbol(DI_GV.getGlobal()));
addBlock(VariableDie, dwarf::DW_AT_location, 0, Block);
}
addToContextOwner(VariableDie, GVContext);
/// addObjectLabel - Add an non-Dwarf label attribute data and value.
///
void addObjectLabel(DIE *Die, unsigned Attribute, unsigned Form,
- const std::string &Label);
+ const MCSymbol *Sym);
/// addSectionOffset - Add a section offset label attribute data and value.
///
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/MachineModuleInfo.h"
#include "llvm/MC/MCAsmInfo.h"
+#include "llvm/MC/MCSymbol.h"
#include "llvm/Target/TargetData.h"
#include "llvm/Target/TargetFrameInfo.h"
#include "llvm/Target/TargetRegisterInfo.h"
if (IsPCRelative) O << "-" << MAI->getPCSymbol();
}
+void Dwarf::EmitReference(const MCSymbol *Sym, bool IsPCRelative,
+ bool Force32Bit) const {
+ PrintRelDirective(Force32Bit);
+ Sym->print(O, MAI);
+ if (IsPCRelative) O << "-" << MAI->getPCSymbol();
+}
+
/// EmitDifference - Emit the difference between two labels. Some assemblers do
/// not behave with absolute expressions with data directives, so there is an
/// option (needsSet) to use an intermediary set expression.
class MCAsmInfo;
class TargetData;
class TargetRegisterInfo;
+ class MCSymbol;
class Dwarf {
protected:
bool Force32Bit = false) const;
void EmitReference(const std::string &Name, bool IsPCRelative = false,
bool Force32Bit = false) const;
+ void EmitReference(const MCSymbol *Sym, bool IsPCRelative = false,
+ bool Force32Bit = false) const;
/// EmitDifference - Emit the difference between two labels. Some
/// assemblers do not behave with absolute expressions with data directives,