/// EmitValue - Emit label value.
///
void DIELabel::EmitValue(AsmPrinter *AP, unsigned Form) const {
- AP->OutStreamer.EmitSymbolValue(Label, SizeOf(AP, Form));
+ AP->OutStreamer.EmitValue(Label, SizeOf(AP, Form));
}
/// SizeOf - Determine size of label value in bytes.
#ifndef NDEBUG
void DIELabel::print(raw_ostream &O) const {
- O << "Lbl: " << Label->getName();
+ O << "Lbl: " << Label->getSymbol().getName();
}
#endif
#include "llvm/ADT/SmallVector.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/Dwarf.h"
+#include "llvm/MC/MCExpr.h"
#include <vector>
namespace llvm {
class AsmPrinter;
class MCSymbol;
+ class MCSymbolRefExpr;
class raw_ostream;
//===--------------------------------------------------------------------===//
/// DIELabel - A label expression DIE.
//
class DIELabel : public DIEValue {
- const MCSymbol *Label;
+ const MCSymbolRefExpr *Label;
public:
- explicit DIELabel(const MCSymbol *L) : DIEValue(isLabel), Label(L) {}
+ explicit DIELabel(const MCSymbolRefExpr *L) : DIEValue(isLabel), Label(L) {}
+ explicit DIELabel(const MCSymbol *Sym, MCContext &Ctxt)
+ : DIEValue(isLabel), Label(MCSymbolRefExpr::Create(Sym, Ctxt)) {}
/// EmitValue - Emit label value.
///
/// getValue - Get MCSymbol.
///
- const MCSymbol *getValue() const { return Label; }
+ const MCSymbolRefExpr *getValue() const { return Label; }
/// SizeOf - Determine size of label value in bytes.
///
MCSymbol *Symb = DU->getStringPoolEntry(String);
DIEValue *Value;
if (Asm->needsRelocationsForDwarfStringPool())
- Value = new (DIEValueAllocator) DIELabel(Symb);
+ Value = new (DIEValueAllocator) DIELabel(Symb, Asm->OutContext);
else {
MCSymbol *StringPool = DU->getStringPoolSym();
Value = new (DIEValueAllocator) DIEDelta(Symb, StringPool);
MCSymbol *Symb = DU->getStringPoolEntry(String);
DIEValue *Value;
if (Asm->needsRelocationsForDwarfStringPool())
- Value = new (DIEValueAllocator) DIELabel(Symb);
+ Value = new (DIEValueAllocator) DIELabel(Symb, Asm->OutContext);
else {
MCSymbol *StringPool = DU->getStringPoolSym();
Value = new (DIEValueAllocator) DIEDelta(Symb, StringPool);
/// addLabel - Add a Dwarf label attribute data and value.
///
void CompileUnit::addLabel(DIE *Die, unsigned Attribute, unsigned Form,
- const MCSymbol *Label) {
+ const MCSymbolRefExpr *Label) {
DIEValue *Value = new (DIEValueAllocator) DIELabel(Label);
Die->addValue(Attribute, Form, Value);
}
+void CompileUnit::addLabel(DIE *Die, unsigned Attribute, unsigned Form,
+ const MCSymbol *Label) {
+ addLabel(Die, Attribute, Form, MCSymbolRefExpr::Create(Label, Asm->OutContext));
+}
+
/// addLabelAddress - Add a dwarf label attribute data and value using
/// DW_FORM_addr or DW_FORM_GNU_addr_index.
///
MCSymbol *Label) {
if (!DD->useSplitDwarf()) {
if (Label != NULL) {
- DIEValue *Value = new (DIEValueAllocator) DIELabel(Label);
+ DIEValue *Value = new (DIEValueAllocator) DIELabel(Label, Asm->OutContext);
Die->addValue(Attribute, dwarf::DW_FORM_addr, Value);
} else {
DIEValue *Value = new (DIEValueAllocator) DIEInteger(0);
/// addOpAddress - Add a dwarf op address data and value using the
/// form given and an op of either DW_FORM_addr or DW_FORM_GNU_addr_index.
///
-void CompileUnit::addOpAddress(DIE *Die, MCSymbol *Sym) {
+void CompileUnit::addOpAddress(DIE *Die, const MCSymbol *Sym) {
if (!DD->useSplitDwarf()) {
addUInt(Die, 0, dwarf::DW_FORM_data1, dwarf::DW_OP_addr);
#include "llvm/ADT/OwningPtr.h"
#include "llvm/ADT/StringMap.h"
#include "llvm/DebugInfo.h"
+#include "llvm/MC/MCExpr.h"
namespace llvm {
/// addLabel - Add a Dwarf label attribute data and value.
///
+ void addLabel(DIE *Die, unsigned Attribute, unsigned Form,
+ const MCSymbolRefExpr *Label);
void addLabel(DIE *Die, unsigned Attribute, unsigned Form,
const MCSymbol *Label);
/// addOpAddress - Add a dwarf op address data and value using the
/// form given and an op of either DW_FORM_addr or DW_FORM_GNU_addr_index.
///
- void addOpAddress(DIE *Die, MCSymbol *Label);
+ void addOpAddress(DIE *Die, const MCSymbol *Label);
+ void addOpAddress(DIE *Die, const MCSymbolRefExpr *Label);
/// addDelta - Add a label delta attribute data and value.
///
case dwarf::DW_AT_location: {
if (DIELabel *L = dyn_cast<DIELabel>(Values[i])) {
if (Asm->MAI->doesDwarfUseRelocationsAcrossSections())
- Asm->EmitLabelReference(L->getValue(), 4);
+ Asm->EmitLabelReference(&L->getValue()->getSymbol(), 4);
else
- Asm->EmitLabelDifference(L->getValue(), DwarfDebugLocSectionSym, 4);
+ Asm->EmitLabelDifference(&L->getValue()->getSymbol(), DwarfDebugLocSectionSym, 4);
} else {
Values[i]->EmitValue(Asm, Form);
}