summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
diff options
context:
space:
mode:
authorUlrich Weigand <ulrich.weigand@de.ibm.com>2013-07-02 18:46:26 +0000
committerUlrich Weigand <ulrich.weigand@de.ibm.com>2013-07-02 18:46:26 +0000
commit396ba8b495640d7a1d8ff38e70f145bb25d109df (patch)
treef467305ecc44a621c2315ac484cbbd09a3a377a6 /llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
parent9cfcdcb9e2bed7835122852ea9f5405ae313f11c (diff)
downloadbcm5719-llvm-396ba8b495640d7a1d8ff38e70f145bb25d109df.tar.gz
bcm5719-llvm-396ba8b495640d7a1d8ff38e70f145bb25d109df.zip
[DebugInfo] Introduce DIEExpr variant of DIEValue to hold MCExpr values
This partially reverts r185202 and restores DIELabel to hold plain MCSymbol references. Instead, we add a new subclass DIEExpr of DIEValue that can hold generic MCExpr references. This is in preparation for supporting debug info for TLS variables on PowerPC, where we need to describe the variable location using a more complex expression than just MCSymbolRefExpr. llvm-svn: 185458
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp')
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp21
1 files changed, 12 insertions, 9 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
index f42a33eb774..398718dc175 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
@@ -136,7 +136,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, Asm->OutContext);
+ Value = new (DIEValueAllocator) DIELabel(Symb);
else {
MCSymbol *StringPool = DU->getStringPoolSym();
Value = new (DIEValueAllocator) DIEDelta(Symb, StringPool);
@@ -156,7 +156,7 @@ void CompileUnit::addLocalString(DIE *Die, unsigned Attribute,
MCSymbol *Symb = DU->getStringPoolEntry(String);
DIEValue *Value;
if (Asm->needsRelocationsForDwarfStringPool())
- Value = new (DIEValueAllocator) DIELabel(Symb, Asm->OutContext);
+ Value = new (DIEValueAllocator) DIELabel(Symb);
else {
MCSymbol *StringPool = DU->getStringPoolSym();
Value = new (DIEValueAllocator) DIEDelta(Symb, StringPool);
@@ -164,17 +164,20 @@ void CompileUnit::addLocalString(DIE *Die, unsigned Attribute,
Die->addValue(Attribute, dwarf::DW_FORM_strp, Value);
}
-/// addLabel - Add a Dwarf label attribute data and value.
+/// addExpr - Add a Dwarf expression attribute data and value.
///
-void CompileUnit::addLabel(DIE *Die, unsigned Attribute, unsigned Form,
- const MCSymbolRefExpr *Label) {
- DIEValue *Value = new (DIEValueAllocator) DIELabel(Label);
+void CompileUnit::addExpr(DIE *Die, unsigned Attribute, unsigned Form,
+ const MCExpr *Expr) {
+ DIEValue *Value = new (DIEValueAllocator) DIEExpr(Expr);
Die->addValue(Attribute, Form, Value);
}
+/// addLabel - Add a Dwarf label attribute data and value.
+///
void CompileUnit::addLabel(DIE *Die, unsigned Attribute, unsigned Form,
const MCSymbol *Label) {
- addLabel(Die, Attribute, Form, MCSymbolRefExpr::Create(Label, Asm->OutContext));
+ DIEValue *Value = new (DIEValueAllocator) DIELabel(Label);
+ Die->addValue(Attribute, Form, Value);
}
/// addLabelAddress - Add a dwarf label attribute data and value using
@@ -184,7 +187,7 @@ void CompileUnit::addLabelAddress(DIE *Die, unsigned Attribute,
MCSymbol *Label) {
if (!DD->useSplitDwarf()) {
if (Label != NULL) {
- DIEValue *Value = new (DIEValueAllocator) DIELabel(Label, Asm->OutContext);
+ DIEValue *Value = new (DIEValueAllocator) DIELabel(Label);
Die->addValue(Attribute, dwarf::DW_FORM_addr, Value);
} else {
DIEValue *Value = new (DIEValueAllocator) DIEInteger(0);
@@ -1363,7 +1366,7 @@ void CompileUnit::createGlobalVariableDIE(const MDNode *N) {
addUInt(Block, 0, dwarf::DW_FORM_data1,
PointerSize == 4 ? dwarf::DW_OP_const4u : dwarf::DW_OP_const8u);
// 2) containing the (relocated) address of the TLS variable
- addLabel(Block, 0, dwarf::DW_FORM_udata, Ref);
+ addExpr(Block, 0, dwarf::DW_FORM_udata, Ref);
} else {
addUInt(Block, 0, dwarf::DW_FORM_data1, dwarf::DW_OP_GNU_const_index);
addUInt(Block, 0, dwarf::DW_FORM_udata, DU->getAddrPoolIndex(Ref));
OpenPOWER on IntegriCloud