summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen
diff options
context:
space:
mode:
authorDavid Blaikie <dblaikie@gmail.com>2013-06-28 20:05:04 +0000
committerDavid Blaikie <dblaikie@gmail.com>2013-06-28 20:05:04 +0000
commitf3cd7c51156833d86a34b1d93b9553a48ffe5569 (patch)
tree123d851907576bad84716d97c1c445a4b793fe2a /llvm/lib/CodeGen
parent4ca70100de1c55bddd1ff9a2fb0347e2cb5a0520 (diff)
downloadbcm5719-llvm-f3cd7c51156833d86a34b1d93b9553a48ffe5569.tar.gz
bcm5719-llvm-f3cd7c51156833d86a34b1d93b9553a48ffe5569.zip
DebugInfo: Pass MCSymbolRefExprs for labels instead of MCSymbols
This is a precursor to adding debug info support for TLS which requires non-default relocations applied to TLS symbols. llvm-svn: 185202
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DIE.cpp4
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DIE.h10
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp15
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h6
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp4
5 files changed, 26 insertions, 13 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DIE.cpp b/llvm/lib/CodeGen/AsmPrinter/DIE.cpp
index 5f451a7e576..81bab336475 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DIE.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DIE.cpp
@@ -253,7 +253,7 @@ void DIEInteger::print(raw_ostream &O) const {
/// 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.
@@ -267,7 +267,7 @@ unsigned DIELabel::SizeOf(AsmPrinter *AP, unsigned Form) const {
#ifndef NDEBUG
void DIELabel::print(raw_ostream &O) const {
- O << "Lbl: " << Label->getName();
+ O << "Lbl: " << Label->getSymbol().getName();
}
#endif
diff --git a/llvm/lib/CodeGen/AsmPrinter/DIE.h b/llvm/lib/CodeGen/AsmPrinter/DIE.h
index c29144d9ce2..eaa61d925ea 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DIE.h
+++ b/llvm/lib/CodeGen/AsmPrinter/DIE.h
@@ -18,11 +18,13 @@
#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;
//===--------------------------------------------------------------------===//
@@ -264,9 +266,11 @@ namespace llvm {
/// 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.
///
@@ -274,7 +278,7 @@ namespace llvm {
/// getValue - Get MCSymbol.
///
- const MCSymbol *getValue() const { return Label; }
+ const MCSymbolRefExpr *getValue() const { return Label; }
/// SizeOf - Determine size of label value in bytes.
///
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
index 9ec5b28cf00..6bd4f086040 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
@@ -135,7 +135,7 @@ void CompileUnit::addString(DIE *Die, unsigned Attribute, StringRef String) {
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);
@@ -155,7 +155,7 @@ void CompileUnit::addLocalString(DIE *Die, unsigned Attribute,
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);
@@ -166,11 +166,16 @@ void CompileUnit::addLocalString(DIE *Die, unsigned Attribute,
/// 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.
///
@@ -178,7 +183,7 @@ void CompileUnit::addLabelAddress(DIE *Die, unsigned Attribute,
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);
@@ -194,7 +199,7 @@ void CompileUnit::addLabelAddress(DIE *Die, unsigned Attribute,
/// 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);
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h b/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h
index 6a370809f23..3a95195c3a7 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h
@@ -19,6 +19,7 @@
#include "llvm/ADT/OwningPtr.h"
#include "llvm/ADT/StringMap.h"
#include "llvm/DebugInfo.h"
+#include "llvm/MC/MCExpr.h"
namespace llvm {
@@ -220,6 +221,8 @@ public:
/// 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);
/// addLabelAddress - Add a dwarf label attribute data and value using
@@ -230,7 +233,8 @@ public:
/// 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.
///
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
index a954eaea3f4..ead90c05e03 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
@@ -1918,9 +1918,9 @@ void DwarfDebug::emitDIE(DIE *Die, std::vector<DIEAbbrev *> *Abbrevs) {
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);
}
OpenPOWER on IntegriCloud