summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
authorDevang Patel <dpatel@apple.com>2009-01-05 17:57:47 +0000
committerDevang Patel <dpatel@apple.com>2009-01-05 17:57:47 +0000
commit1e03f7f19e08699e1c449e311133ae1748e1c489 (patch)
tree08fd71c6ed6dcab5215bc615863ae85849a96741 /llvm
parentc9e772efc29d2fefc94f5c9530e1ac0ef8feb593 (diff)
downloadbcm5719-llvm-1e03f7f19e08699e1c449e311133ae1748e1c489.tar.gz
bcm5719-llvm-1e03f7f19e08699e1c449e311133ae1748e1c489.zip
Construct basic and derived type DIEs using DebugInfo.
llvm-svn: 61714
Diffstat (limited to 'llvm')
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/DwarfWriter.cpp44
1 files changed, 44 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfWriter.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfWriter.cpp
index 13ea22cb289..30f14b7c9f3 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfWriter.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfWriter.cpp
@@ -23,6 +23,7 @@
#include "llvm/CodeGen/MachineModuleInfo.h"
#include "llvm/CodeGen/MachineFrameInfo.h"
#include "llvm/CodeGen/MachineLocation.h"
+#include "llvm/Analysis/DebugInfo.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/Dwarf.h"
#include "llvm/Support/CommandLine.h"
@@ -1496,6 +1497,49 @@ private:
}
}
+ /// ConstructType - Construct basic type die from DIBasicType.
+ void ConstructType(CompileUnit *DW_Unit, DIE &Buffer,
+ DIBasicType *BTy) {
+
+ // Get core information.
+ const std::string &Name = BTy->getName();
+ Buffer.setTag(DW_TAG_base_type);
+ AddUInt(&Buffer, DW_AT_encoding, DW_FORM_data1, BTy->getEncoding());
+ // Add name if not anonymous or intermediate type.
+ if (!Name.empty())
+ AddString(&Buffer, DW_AT_name, DW_FORM_string, Name);
+ uint64_t Size = BTy->getSizeInBits() >> 3;
+ AddUInt(&Buffer, DW_AT_byte_size, 0, Size);
+ }
+
+ void ConstructType(CompileUnit *DW_Unit, DIE &Buffer,
+ DIDerivedType *DTy) {
+
+ // Get core information.
+ const std::string &Name = DTy->getName();
+ uint64_t Size = DTy->getSizeInBits() >> 3;
+ unsigned Tag = DTy->getTag();
+ // FIXME - Workaround for templates.
+ if (Tag == DW_TAG_inheritance) Tag = DW_TAG_reference_type;
+
+ Buffer.setTag(Tag);
+ // Map to main type, void will not have a type.
+ DIType FromTy = DTy->getTypeDerivedFrom();
+ // FIXME - Enable this. AddType(&Buffer, FromTy, DW_Unit);
+
+ // Add name if not anonymous or intermediate type.
+ if (!Name.empty()) AddString(&Buffer, DW_AT_name, DW_FORM_string, Name);
+
+ // Add size if non-zero (derived types might be zero-sized.)
+ if (Size)
+ AddUInt(&Buffer, DW_AT_byte_size, 0, Size);
+
+ // Add source line info if available and TyDesc is not a forward
+ // declaration.
+ // FIXME - Enable this. if (!DTy->isForwardDecl())
+ // FIXME - Enable this. AddSourceLine(&Buffer, *DTy);
+ }
+
/// ConstructType - Adds all the required attributes to the type.
///
void ConstructType(DIE &Buffer, TypeDesc *TyDesc, CompileUnit *Unit) {
OpenPOWER on IntegriCloud