summaryrefslogtreecommitdiffstats
path: root/llvm/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
commit396ba8b495640d7a1d8ff38e70f145bb25d109df (patch)
treef467305ecc44a621c2315ac484cbbd09a3a377a6 /llvm/lib/CodeGen/AsmPrinter/DIE.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/DIE.cpp')
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DIE.cpp30
1 files changed, 28 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DIE.cpp b/llvm/lib/CodeGen/AsmPrinter/DIE.cpp
index 81bab336475..4b6698e374e 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DIE.cpp
+++ b/llvm/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
OpenPOWER on IntegriCloud