summaryrefslogtreecommitdiff
path: root/lib/CodeGen/AsmPrinter/DIE.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
commit1f8aacd6afdc30b4d1cf1da3bf5e41c7874f89be (patch)
tree6e197638122f16d7445e798897524d1230e6661e /lib/CodeGen/AsmPrinter/DIE.cpp
parent88328d2ff47670314a1007a4c81c42adf026ee9f (diff)
downloadllvm-1f8aacd6afdc30b4d1cf1da3bf5e41c7874f89be.tar.gz
llvm-1f8aacd6afdc30b4d1cf1da3bf5e41c7874f89be.tar.bz2
llvm-1f8aacd6afdc30b4d1cf1da3bf5e41c7874f89be.tar.xz
[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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185458 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/AsmPrinter/DIE.cpp')
-rw-r--r--lib/CodeGen/AsmPrinter/DIE.cpp30
1 files changed, 28 insertions, 2 deletions
diff --git a/lib/CodeGen/AsmPrinter/DIE.cpp b/lib/CodeGen/AsmPrinter/DIE.cpp
index 81bab33647..4b6698e374 100644
--- a/lib/CodeGen/AsmPrinter/DIE.cpp
+++ b/lib/CodeGen/AsmPrinter/DIE.cpp
@@ -247,13 +247,39 @@ void DIEInteger::print(raw_ostream &O) const {
#endif
//===----------------------------------------------------------------------===//
+// DIEExpr Implementation
+//===----------------------------------------------------------------------===//
+
+/// EmitValue - Emit expression value.
+///
+void DIEExpr::EmitValue(AsmPrinter *AP, unsigned Form) const {
+ AP->OutStreamer.EmitValue(Expr, SizeOf(AP, Form));
+}
+
+/// SizeOf - Determine size of expression value in bytes.
+///
+unsigned DIEExpr::SizeOf(AsmPrinter *AP, unsigned Form) const {
+ if (Form == dwarf::DW_FORM_data4) return 4;
+ if (Form == dwarf::DW_FORM_sec_offset) return 4;
+ if (Form == dwarf::DW_FORM_strp) return 4;
+ return AP->getDataLayout().getPointerSize();
+}
+
+#ifndef NDEBUG
+void DIEExpr::print(raw_ostream &O) const {
+ O << "Expr: ";
+ Expr->print(O);
+}
+#endif
+
+//===----------------------------------------------------------------------===//
// DIELabel Implementation
//===----------------------------------------------------------------------===//
/// EmitValue - Emit label value.
///
void DIELabel::EmitValue(AsmPrinter *AP, unsigned Form) const {
- AP->OutStreamer.EmitValue(Label, SizeOf(AP, Form));
+ AP->EmitLabelReference(Label, SizeOf(AP, Form));
}
/// SizeOf - Determine size of label value in bytes.
@@ -267,7 +293,7 @@ unsigned DIELabel::SizeOf(AsmPrinter *AP, unsigned Form) const {
#ifndef NDEBUG
void DIELabel::print(raw_ostream &O) const {
- O << "Lbl: " << Label->getSymbol().getName();
+ O << "Lbl: " << Label->getName();
}
#endif