summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/AsmPrinter/DIE.cpp
diff options
context:
space:
mode:
authorManman Ren <mren@apple.com>2013-07-02 23:40:10 +0000
committerManman Ren <mren@apple.com>2013-07-02 23:40:10 +0000
commitac8062bb724136609f422be9c5a82d3514645011 (patch)
treeecd2f216f1c3a9b2007d0e14203b618ff725b6a6 /llvm/lib/CodeGen/AsmPrinter/DIE.cpp
parent38db092083ba69af5b3fa60532798a9bc34f91b7 (diff)
downloadbcm5719-llvm-ac8062bb724136609f422be9c5a82d3514645011.tar.gz
bcm5719-llvm-ac8062bb724136609f422be9c5a82d3514645011.zip
Debug Info: use module flag to set up Dwarf version.
Correctly handles ref_addr depending on the Dwarf version. Emit Dwarf with version from module flag. TODO: turn on/off features depending on the Dwarf version. llvm-svn: 185484
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter/DIE.cpp')
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DIE.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DIE.cpp b/llvm/lib/CodeGen/AsmPrinter/DIE.cpp
index 4b6698e374e..d6caef7e5b8 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DIE.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DIE.cpp
@@ -12,6 +12,7 @@
//===----------------------------------------------------------------------===//
#include "DIE.h"
+#include "DwarfDebug.h"
#include "llvm/ADT/Twine.h"
#include "llvm/CodeGen/AsmPrinter.h"
#include "llvm/IR/DataLayout.h"
@@ -331,6 +332,16 @@ void DIEEntry::EmitValue(AsmPrinter *AP, unsigned Form) const {
AP->EmitInt32(Entry->getOffset());
}
+unsigned DIEEntry::getRefAddrSize(AsmPrinter *AP) {
+ // DWARF4: References that use the attribute form DW_FORM_ref_addr are
+ // specified to be four bytes in the DWARF 32-bit format and eight bytes
+ // in the DWARF 64-bit format, while DWARF Version 2 specifies that such
+ // references have the same size as an address on the target system.
+ if (AP->getDwarfDebug()->getDwarfVersion() == 2)
+ return AP->getDataLayout().getPointerSize();
+ return sizeof(int32_t);
+}
+
#ifndef NDEBUG
void DIEEntry::print(raw_ostream &O) const {
O << format("Die: 0x%lx", (long)(intptr_t)Entry);
OpenPOWER on IntegriCloud