<div dir="ltr">Cool<div><br></div><div>Mind if I use all these enums in the DWARF parser? (when I get to it).</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Oct 21, 2013 at 9:28 PM, David Blaikie <span dir="ltr"><<a href="mailto:dblaikie@gmail.com" target="_blank">dblaikie@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: dblaikie<br>
Date: Mon Oct 21 12:28:37 2013<br>
New Revision: 193091<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=193091&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=193091&view=rev</a><br>
Log:<br>
DebugInfo: Put each kind of constant (form, attribute, tag, etc) into its own enum for ease of use.<br>
<br>
This allows various variables to be more self-documenting and easier to<br>
debug by being of specific types without overlapping enum values.<br>
<br>
Precommit review by Eric Christopher.<br>
<br>
Modified:<br>
llvm/trunk/include/llvm/Support/Dwarf.h<br>
llvm/trunk/lib/CodeGen/AsmPrinter/DIE.cpp<br>
llvm/trunk/lib/CodeGen/AsmPrinter/DIE.h<br>
llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp<br>
llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h<br>
llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp<br>
<br>
Modified: llvm/trunk/include/llvm/Support/Dwarf.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/Dwarf.h?rev=193091&r1=193090&r2=193091&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/Dwarf.h?rev=193091&r1=193090&r2=193091&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/include/llvm/Support/Dwarf.h (original)<br>
+++ llvm/trunk/include/llvm/Support/Dwarf.h Mon Oct 21 12:28:37 2013<br>
@@ -68,8 +68,7 @@ enum LLVMConstants LLVM_ENUM_INT_TYPE(ui<br>
const uint32_t DW_CIE_ID = UINT32_MAX;<br>
const uint64_t DW64_CIE_ID = UINT64_MAX;<br>
<br>
-enum Constants {<br>
- // Tags<br>
+enum Tag LLVM_ENUM_INT_TYPE(uint16_t) {<br>
DW_TAG_array_type = 0x01,<br>
DW_TAG_class_type = 0x02,<br>
DW_TAG_entry_point = 0x03,<br>
@@ -139,12 +138,10 @@ enum Constants {<br>
DW_TAG_GNU_formal_parameter_pack = 0x4108,<br>
DW_TAG_lo_user = 0x4080,<br>
DW_TAG_APPLE_property = 0x4200,<br>
- DW_TAG_hi_user = 0xffff,<br>
-<br>
- // Children flag<br>
- DW_CHILDREN_no = 0x00,<br>
- DW_CHILDREN_yes = 0x01,<br>
+ DW_TAG_hi_user = 0xffff<br>
+};<br>
<br>
+enum Attribute LLVM_ENUM_INT_TYPE(uint16_t) {<br>
// Attributes<br>
DW_AT_sibling = 0x01,<br>
DW_AT_location = 0x02,<br>
@@ -295,8 +292,10 @@ enum Constants {<br>
DW_AT_APPLE_property_setter = 0x3fea,<br>
DW_AT_APPLE_property_attribute = 0x3feb,<br>
DW_AT_APPLE_objc_complete_type = 0x3fec,<br>
- DW_AT_APPLE_property = 0x3fed,<br>
+ DW_AT_APPLE_property = 0x3fed<br>
+};<br>
<br>
+enum Form LLVM_ENUM_INT_TYPE(uint16_t) {<br>
// Attribute form encodings<br>
DW_FORM_addr = 0x01,<br>
DW_FORM_block2 = 0x03,<br>
@@ -326,8 +325,10 @@ enum Constants {<br>
<br>
// Extensions for Fission proposal<br>
DW_FORM_GNU_addr_index = 0x1f01,<br>
- DW_FORM_GNU_str_index = 0x1f02,<br>
+ DW_FORM_GNU_str_index = 0x1f02<br>
+};<br>
<br>
+enum LocationAtom {<br>
// Operation encodings<br>
DW_OP_addr = 0x03,<br>
DW_OP_deref = 0x06,<br>
@@ -491,8 +492,10 @@ enum Constants {<br>
<br>
// Extensions for Fission proposal.<br>
DW_OP_GNU_addr_index = 0xfb,<br>
- DW_OP_GNU_const_index = 0xfc,<br>
+ DW_OP_GNU_const_index = 0xfc<br>
+};<br>
<br>
+enum TypeKind {<br>
// Encoding attribute values<br>
DW_ATE_address = 0x01,<br>
DW_ATE_boolean = 0x02,<br>
@@ -511,37 +514,49 @@ enum Constants {<br>
DW_ATE_decimal_float = 0x0f,<br>
DW_ATE_UTF = 0x10,<br>
DW_ATE_lo_user = 0x80,<br>
- DW_ATE_hi_user = 0xff,<br>
+ DW_ATE_hi_user = 0xff<br>
+};<br>
<br>
+enum DecimalSignEncoding {<br>
// Decimal sign attribute values<br>
DW_DS_unsigned = 0x01,<br>
DW_DS_leading_overpunch = 0x02,<br>
DW_DS_trailing_overpunch = 0x03,<br>
DW_DS_leading_separate = 0x04,<br>
- DW_DS_trailing_separate = 0x05,<br>
+ DW_DS_trailing_separate = 0x05<br>
+};<br>
<br>
+enum EndianityEncoding {<br>
// Endianity attribute values<br>
DW_END_default = 0x00,<br>
DW_END_big = 0x01,<br>
DW_END_little = 0x02,<br>
DW_END_lo_user = 0x40,<br>
- DW_END_hi_user = 0xff,<br>
+ DW_END_hi_user = 0xff<br>
+};<br>
<br>
+enum AccessAttribute {<br>
// Accessibility codes<br>
DW_ACCESS_public = 0x01,<br>
DW_ACCESS_protected = 0x02,<br>
- DW_ACCESS_private = 0x03,<br>
+ DW_ACCESS_private = 0x03<br>
+};<br>
<br>
+enum VisibilityAttribute {<br>
// Visibility codes<br>
DW_VIS_local = 0x01,<br>
DW_VIS_exported = 0x02,<br>
- DW_VIS_qualified = 0x03,<br>
+ DW_VIS_qualified = 0x03<br>
+};<br>
<br>
+enum VirtualityAttribute {<br>
// Virtuality codes<br>
DW_VIRTUALITY_none = 0x00,<br>
DW_VIRTUALITY_virtual = 0x01,<br>
- DW_VIRTUALITY_pure_virtual = 0x02,<br>
+ DW_VIRTUALITY_pure_virtual = 0x02<br>
+};<br>
<br>
+enum SourceLanguage {<br>
// Language names<br>
DW_LANG_C89 = 0x0001,<br>
DW_LANG_C = 0x0002,<br>
@@ -565,35 +580,47 @@ enum Constants {<br>
DW_LANG_Python = 0x0014,<br>
DW_LANG_lo_user = 0x8000,<br>
DW_LANG_Mips_Assembler = 0x8001,<br>
- DW_LANG_hi_user = 0xffff,<br>
+ DW_LANG_hi_user = 0xffff<br>
+};<br>
<br>
+enum CaseSensitivity {<br>
// Identifier case codes<br>
DW_ID_case_sensitive = 0x00,<br>
DW_ID_up_case = 0x01,<br>
DW_ID_down_case = 0x02,<br>
- DW_ID_case_insensitive = 0x03,<br>
+ DW_ID_case_insensitive = 0x03<br>
+};<br>
<br>
+enum CallingConvention {<br>
// Calling convention codes<br>
DW_CC_normal = 0x01,<br>
DW_CC_program = 0x02,<br>
DW_CC_nocall = 0x03,<br>
DW_CC_lo_user = 0x40,<br>
- DW_CC_hi_user = 0xff,<br>
+ DW_CC_hi_user = 0xff<br>
+};<br>
<br>
+enum InlineAttribute {<br>
// Inline codes<br>
DW_INL_not_inlined = 0x00,<br>
DW_INL_inlined = 0x01,<br>
DW_INL_declared_not_inlined = 0x02,<br>
- DW_INL_declared_inlined = 0x03,<br>
+ DW_INL_declared_inlined = 0x03<br>
+};<br>
<br>
+enum ArrayDimensionOrdering {<br>
// Array ordering<br>
DW_ORD_row_major = 0x00,<br>
- DW_ORD_col_major = 0x01,<br>
+ DW_ORD_col_major = 0x01<br>
+};<br>
<br>
+enum DiscriminantList {<br>
// Discriminant descriptor values<br>
DW_DSC_label = 0x00,<br>
- DW_DSC_range = 0x01,<br>
+ DW_DSC_range = 0x01<br>
+};<br>
<br>
+enum LineNumberOps {<br>
// Line Number Standard Opcode Encodings<br>
DW_LNS_extended_op = 0x00,<br>
DW_LNS_copy = 0x01,<br>
@@ -607,23 +634,29 @@ enum Constants {<br>
DW_LNS_fixed_advance_pc = 0x09,<br>
DW_LNS_set_prologue_end = 0x0a,<br>
DW_LNS_set_epilogue_begin = 0x0b,<br>
- DW_LNS_set_isa = 0x0c,<br>
+ DW_LNS_set_isa = 0x0c<br>
+};<br>
<br>
+enum LineNumberExtendedOps {<br>
// Line Number Extended Opcode Encodings<br>
DW_LNE_end_sequence = 0x01,<br>
DW_LNE_set_address = 0x02,<br>
DW_LNE_define_file = 0x03,<br>
DW_LNE_set_discriminator = 0x04,<br>
DW_LNE_lo_user = 0x80,<br>
- DW_LNE_hi_user = 0xff,<br>
+ DW_LNE_hi_user = 0xff<br>
+};<br>
<br>
+enum MacinfoRecordType {<br>
// Macinfo Type Encodings<br>
DW_MACINFO_define = 0x01,<br>
DW_MACINFO_undef = 0x02,<br>
DW_MACINFO_start_file = 0x03,<br>
DW_MACINFO_end_file = 0x04,<br>
- DW_MACINFO_vendor_ext = 0xff,<br>
+ DW_MACINFO_vendor_ext = 0xff<br>
+};<br>
<br>
+enum CallFrameInfo {<br>
// Call frame instruction encodings<br>
DW_CFA_extended = 0x00,<br>
DW_CFA_nop = 0x00,<br>
@@ -656,7 +689,13 @@ enum Constants {<br>
DW_CFA_GNU_window_save = 0x2d,<br>
DW_CFA_GNU_args_size = 0x2e,<br>
DW_CFA_lo_user = 0x1c,<br>
- DW_CFA_hi_user = 0x3f,<br>
+ DW_CFA_hi_user = 0x3f<br>
+};<br>
+<br>
+enum Constants {<br>
+ // Children flag<br>
+ DW_CHILDREN_no = 0x00,<br>
+ DW_CHILDREN_yes = 0x01,<br>
<br>
DW_EH_PE_absptr = 0x00,<br>
DW_EH_PE_omit = 0xff,<br>
@@ -674,8 +713,10 @@ enum Constants {<br>
DW_EH_PE_datarel = 0x30,<br>
DW_EH_PE_funcrel = 0x40,<br>
DW_EH_PE_aligned = 0x50,<br>
- DW_EH_PE_indirect = 0x80,<br>
+ DW_EH_PE_indirect = 0x80<br>
+};<br>
<br>
+enum ApplePropertyAttributes {<br>
// Apple Objective-C Property Attributes<br>
DW_APPLE_PROPERTY_readonly = 0x01,<br>
DW_APPLE_PROPERTY_readwrite = 0x02,<br>
<br>
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DIE.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DIE.cpp?rev=193091&r1=193090&r2=193091&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DIE.cpp?rev=193091&r1=193090&r2=193091&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/CodeGen/AsmPrinter/DIE.cpp (original)<br>
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DIE.cpp Mon Oct 21 12:28:37 2013<br>
@@ -187,7 +187,7 @@ void DIEValue::dump() const {<br>
<br>
/// EmitValue - Emit integer of appropriate size.<br>
///<br>
-void DIEInteger::EmitValue(AsmPrinter *Asm, uint16_t Form) const {<br>
+void DIEInteger::EmitValue(AsmPrinter *Asm, dwarf::Form Form) const {<br>
unsigned Size = ~0U;<br>
switch (Form) {<br>
case dwarf::DW_FORM_flag_present:<br>
@@ -219,7 +219,7 @@ void DIEInteger::EmitValue(AsmPrinter *A<br>
<br>
/// SizeOf - Determine size of integer value in bytes.<br>
///<br>
-unsigned DIEInteger::SizeOf(AsmPrinter *AP, uint16_t Form) const {<br>
+unsigned DIEInteger::SizeOf(AsmPrinter *AP, dwarf::Form Form) const {<br>
switch (Form) {<br>
case dwarf::DW_FORM_flag_present: return 0;<br>
case dwarf::DW_FORM_flag: // Fall thru<br>
@@ -254,13 +254,13 @@ void DIEInteger::print(raw_ostream &O) c<br>
<br>
/// EmitValue - Emit expression value.<br>
///<br>
-void DIEExpr::EmitValue(AsmPrinter *AP, uint16_t Form) const {<br>
+void DIEExpr::EmitValue(AsmPrinter *AP, dwarf::Form Form) const {<br>
AP->OutStreamer.EmitValue(Expr, SizeOf(AP, Form));<br>
}<br>
<br>
/// SizeOf - Determine size of expression value in bytes.<br>
///<br>
-unsigned DIEExpr::SizeOf(AsmPrinter *AP, uint16_t Form) const {<br>
+unsigned DIEExpr::SizeOf(AsmPrinter *AP, dwarf::Form Form) const {<br>
if (Form == dwarf::DW_FORM_data4) return 4;<br>
if (Form == dwarf::DW_FORM_sec_offset) return 4;<br>
if (Form == dwarf::DW_FORM_strp) return 4;<br>
@@ -280,15 +280,16 @@ void DIEExpr::print(raw_ostream &O) cons<br>
<br>
/// EmitValue - Emit label value.<br>
///<br>
-void DIELabel::EmitValue(AsmPrinter *AP, uint16_t Form) const {<br>
- AP->EmitLabelReference(Label, SizeOf(AP, Form), Form == dwarf::DW_FORM_strp<br>
- || Form == dwarf::DW_FORM_sec_offset || Form == dwarf::DW_OP_call_ref<br>
- || Form == dwarf::DW_FORM_ref_addr);<br>
+void DIELabel::EmitValue(AsmPrinter *AP, dwarf::Form Form) const {<br>
+ AP->EmitLabelReference(Label, SizeOf(AP, Form),<br>
+ Form == dwarf::DW_FORM_strp ||<br>
+ Form == dwarf::DW_FORM_sec_offset ||<br>
+ Form == dwarf::DW_FORM_ref_addr);<br>
}<br>
<br>
/// SizeOf - Determine size of label value in bytes.<br>
///<br>
-unsigned DIELabel::SizeOf(AsmPrinter *AP, uint16_t Form) const {<br>
+unsigned DIELabel::SizeOf(AsmPrinter *AP, dwarf::Form Form) const {<br>
if (Form == dwarf::DW_FORM_data4) return 4;<br>
if (Form == dwarf::DW_FORM_sec_offset) return 4;<br>
if (Form == dwarf::DW_FORM_strp) return 4;<br>
@@ -307,13 +308,13 @@ void DIELabel::print(raw_ostream &O) con<br>
<br>
/// EmitValue - Emit delta value.<br>
///<br>
-void DIEDelta::EmitValue(AsmPrinter *AP, uint16_t Form) const {<br>
+void DIEDelta::EmitValue(AsmPrinter *AP, dwarf::Form Form) const {<br>
AP->EmitLabelDifference(LabelHi, LabelLo, SizeOf(AP, Form));<br>
}<br>
<br>
/// SizeOf - Determine size of delta value in bytes.<br>
///<br>
-unsigned DIEDelta::SizeOf(AsmPrinter *AP, uint16_t Form) const {<br>
+unsigned DIEDelta::SizeOf(AsmPrinter *AP, dwarf::Form Form) const {<br>
if (Form == dwarf::DW_FORM_data4) return 4;<br>
if (Form == dwarf::DW_FORM_strp) return 4;<br>
return AP->getDataLayout().getPointerSize();<br>
@@ -331,13 +332,13 @@ void DIEDelta::print(raw_ostream &O) con<br>
<br>
/// EmitValue - Emit string value.<br>
///<br>
-void DIEString::EmitValue(AsmPrinter *AP, uint16_t Form) const {<br>
+void DIEString::EmitValue(AsmPrinter *AP, dwarf::Form Form) const {<br>
Access->EmitValue(AP, Form);<br>
}<br>
<br>
/// SizeOf - Determine size of delta value in bytes.<br>
///<br>
-unsigned DIEString::SizeOf(AsmPrinter *AP, uint16_t Form) const {<br>
+unsigned DIEString::SizeOf(AsmPrinter *AP, dwarf::Form Form) const {<br>
return Access->SizeOf(AP, Form);<br>
}<br>
<br>
@@ -354,7 +355,7 @@ void DIEString::print(raw_ostream &O) co<br>
<br>
/// EmitValue - Emit debug information entry offset.<br>
///<br>
-void DIEEntry::EmitValue(AsmPrinter *AP, uint16_t Form) const {<br>
+void DIEEntry::EmitValue(AsmPrinter *AP, dwarf::Form Form) const {<br>
AP->EmitInt32(Entry->getOffset());<br>
}<br>
<br>
@@ -392,7 +393,7 @@ unsigned DIEBlock::ComputeSize(AsmPrinte<br>
<br>
/// EmitValue - Emit block data.<br>
///<br>
-void DIEBlock::EmitValue(AsmPrinter *Asm, uint16_t Form) const {<br>
+void DIEBlock::EmitValue(AsmPrinter *Asm, dwarf::Form Form) const {<br>
switch (Form) {<br>
default: llvm_unreachable("Improper form for block");<br>
case dwarf::DW_FORM_block1: Asm->EmitInt8(Size); break;<br>
@@ -408,7 +409,7 @@ void DIEBlock::EmitValue(AsmPrinter *Asm<br>
<br>
/// SizeOf - Determine size of block data in bytes.<br>
///<br>
-unsigned DIEBlock::SizeOf(AsmPrinter *AP, uint16_t Form) const {<br>
+unsigned DIEBlock::SizeOf(AsmPrinter *AP, dwarf::Form Form) const {<br>
switch (Form) {<br>
case dwarf::DW_FORM_block1: return Size + sizeof(int8_t);<br>
case dwarf::DW_FORM_block2: return Size + sizeof(int16_t);<br>
<br>
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DIE.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DIE.h?rev=193091&r1=193090&r2=193091&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DIE.h?rev=193091&r1=193090&r2=193091&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/CodeGen/AsmPrinter/DIE.h (original)<br>
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DIE.h Mon Oct 21 12:28:37 2013<br>
@@ -33,17 +33,17 @@ namespace llvm {<br>
class DIEAbbrevData {<br>
/// Attribute - Dwarf attribute code.<br>
///<br>
- uint16_t Attribute;<br>
+ dwarf::Attribute Attribute;<br>
<br>
/// Form - Dwarf form code.<br>
///<br>
- uint16_t Form;<br>
+ dwarf::Form Form;<br>
public:<br>
- DIEAbbrevData(uint16_t A, uint16_t F) : Attribute(A), Form(F) {}<br>
+ DIEAbbrevData(dwarf::Attribute A, dwarf::Form F) : Attribute(A), Form(F) {}<br>
<br>
// Accessors.<br>
- uint16_t getAttribute() const { return Attribute; }<br>
- uint16_t getForm() const { return Form; }<br>
+ dwarf::Attribute getAttribute() const { return Attribute; }<br>
+ dwarf::Form getForm() const { return Form; }<br>
<br>
/// Profile - Used to gather unique data for the abbreviation folding set.<br>
///<br>
@@ -56,7 +56,7 @@ namespace llvm {<br>
class DIEAbbrev : public FoldingSetNode {<br>
/// Tag - Dwarf tag code.<br>
///<br>
- uint16_t Tag;<br>
+ dwarf::Tag Tag;<br>
<br>
/// ChildrenFlag - Dwarf children flag.<br>
///<br>
@@ -71,10 +71,10 @@ namespace llvm {<br>
SmallVector<DIEAbbrevData, 12> Data;<br>
<br>
public:<br>
- DIEAbbrev(uint16_t T, uint16_t C) : Tag(T), ChildrenFlag(C), Data() {}<br>
+ DIEAbbrev(dwarf::Tag T, uint16_t C) : Tag(T), ChildrenFlag(C), Data() {}<br>
<br>
// Accessors.<br>
- uint16_t getTag() const { return Tag; }<br>
+ dwarf::Tag getTag() const { return Tag; }<br>
unsigned getNumber() const { return Number; }<br>
uint16_t getChildrenFlag() const { return ChildrenFlag; }<br>
const SmallVectorImpl<DIEAbbrevData> &getData() const { return Data; }<br>
@@ -83,7 +83,7 @@ namespace llvm {<br>
<br>
/// AddAttribute - Adds another set of attribute information to the<br>
/// abbreviation.<br>
- void AddAttribute(uint16_t Attribute, uint16_t Form) {<br>
+ void AddAttribute(dwarf::Attribute Attribute, dwarf::Form Form) {<br>
Data.push_back(DIEAbbrevData(Attribute, Form));<br>
}<br>
<br>
@@ -136,13 +136,14 @@ namespace llvm {<br>
#endif<br>
public:<br>
explicit DIE(unsigned Tag)<br>
- : Offset(0), Size(0), Abbrev(Tag, dwarf::DW_CHILDREN_no), Parent(0) {}<br>
+ : Offset(0), Size(0), Abbrev((dwarf::Tag)Tag, dwarf::DW_CHILDREN_no),<br>
+ Parent(0) {}<br>
virtual ~DIE();<br>
<br>
// Accessors.<br>
DIEAbbrev &getAbbrev() { return Abbrev; }<br>
unsigned getAbbrevNumber() const { return Abbrev.getNumber(); }<br>
- uint16_t getTag() const { return Abbrev.getTag(); }<br>
+ dwarf::Tag getTag() const { return Abbrev.getTag(); }<br>
unsigned getOffset() const { return Offset; }<br>
unsigned getSize() const { return Size; }<br>
const std::vector<DIE *> &getChildren() const { return Children; }<br>
@@ -153,7 +154,8 @@ namespace llvm {<br>
<br>
/// addValue - Add a value and attributes to a DIE.<br>
///<br>
- void addValue(uint16_t Attribute, uint16_t Form, DIEValue *Value) {<br>
+ void addValue(dwarf::Attribute Attribute, dwarf::Form Form,<br>
+ DIEValue *Value) {<br>
Abbrev.AddAttribute(Attribute, Form);<br>
Values.push_back(Value);<br>
}<br>
@@ -205,11 +207,11 @@ namespace llvm {<br>
<br>
/// EmitValue - Emit value via the Dwarf writer.<br>
///<br>
- virtual void EmitValue(AsmPrinter *AP, uint16_t Form) const = 0;<br>
+ virtual void EmitValue(AsmPrinter *AP, dwarf::Form Form) const = 0;<br>
<br>
/// SizeOf - Return the size of a value in bytes.<br>
///<br>
- virtual unsigned SizeOf(AsmPrinter *AP, uint16_t Form) const = 0;<br>
+ virtual unsigned SizeOf(AsmPrinter *AP, dwarf::Form Form) const = 0;<br>
<br>
#ifndef NDEBUG<br>
virtual void print(raw_ostream &O) const = 0;<br>
@@ -227,7 +229,7 @@ namespace llvm {<br>
<br>
/// BestForm - Choose the best form for integer.<br>
///<br>
- static uint16_t BestForm(bool IsSigned, uint64_t Int) {<br>
+ static dwarf::Form BestForm(bool IsSigned, uint64_t Int) {<br>
if (IsSigned) {<br>
const int64_t SignedInt = Int;<br>
if ((char)Int == SignedInt) return dwarf::DW_FORM_data1;<br>
@@ -243,13 +245,13 @@ namespace llvm {<br>
<br>
/// EmitValue - Emit integer of appropriate size.<br>
///<br>
- virtual void EmitValue(AsmPrinter *AP, uint16_t Form) const;<br>
+ virtual void EmitValue(AsmPrinter *AP, dwarf::Form Form) const;<br>
<br>
uint64_t getValue() const { return Integer; }<br>
<br>
/// SizeOf - Determine size of integer value in bytes.<br>
///<br>
- virtual unsigned SizeOf(AsmPrinter *AP, uint16_t Form) const;<br>
+ virtual unsigned SizeOf(AsmPrinter *AP, dwarf::Form Form) const;<br>
<br>
// Implement isa/cast/dyncast.<br>
static bool classof(const DIEValue *I) { return I->getType() == isInteger; }<br>
@@ -269,7 +271,7 @@ namespace llvm {<br>
<br>
/// EmitValue - Emit expression value.<br>
///<br>
- virtual void EmitValue(AsmPrinter *AP, uint16_t Form) const;<br>
+ virtual void EmitValue(AsmPrinter *AP, dwarf::Form Form) const;<br>
<br>
/// getValue - Get MCExpr.<br>
///<br>
@@ -277,7 +279,7 @@ namespace llvm {<br>
<br>
/// SizeOf - Determine size of expression value in bytes.<br>
///<br>
- virtual unsigned SizeOf(AsmPrinter *AP, uint16_t Form) const;<br>
+ virtual unsigned SizeOf(AsmPrinter *AP, dwarf::Form Form) const;<br>
<br>
// Implement isa/cast/dyncast.<br>
static bool classof(const DIEValue *E) { return E->getType() == isExpr; }<br>
@@ -297,7 +299,7 @@ namespace llvm {<br>
<br>
/// EmitValue - Emit label value.<br>
///<br>
- virtual void EmitValue(AsmPrinter *AP, uint16_t Form) const;<br>
+ virtual void EmitValue(AsmPrinter *AP, dwarf::Form Form) const;<br>
<br>
/// getValue - Get MCSymbol.<br>
///<br>
@@ -305,7 +307,7 @@ namespace llvm {<br>
<br>
/// SizeOf - Determine size of label value in bytes.<br>
///<br>
- virtual unsigned SizeOf(AsmPrinter *AP, uint16_t Form) const;<br>
+ virtual unsigned SizeOf(AsmPrinter *AP, dwarf::Form Form) const;<br>
<br>
// Implement isa/cast/dyncast.<br>
static bool classof(const DIEValue *L) { return L->getType() == isLabel; }<br>
@@ -327,11 +329,11 @@ namespace llvm {<br>
<br>
/// EmitValue - Emit delta value.<br>
///<br>
- virtual void EmitValue(AsmPrinter *AP, uint16_t Form) const;<br>
+ virtual void EmitValue(AsmPrinter *AP, dwarf::Form Form) const;<br>
<br>
/// SizeOf - Determine size of delta value in bytes.<br>
///<br>
- virtual unsigned SizeOf(AsmPrinter *AP, uint16_t Form) const;<br>
+ virtual unsigned SizeOf(AsmPrinter *AP, dwarf::Form Form) const;<br>
<br>
// Implement isa/cast/dyncast.<br>
static bool classof(const DIEValue *D) { return D->getType() == isDelta; }<br>
@@ -357,11 +359,11 @@ namespace llvm {<br>
<br>
/// EmitValue - Emit delta value.<br>
///<br>
- virtual void EmitValue(AsmPrinter *AP, uint16_t Form) const;<br>
+ virtual void EmitValue(AsmPrinter *AP, dwarf::Form Form) const;<br>
<br>
/// SizeOf - Determine size of delta value in bytes.<br>
///<br>
- virtual unsigned SizeOf(AsmPrinter *AP, uint16_t Form) const;<br>
+ virtual unsigned SizeOf(AsmPrinter *AP, dwarf::Form Form) const;<br>
<br>
// Implement isa/cast/dyncast.<br>
static bool classof(const DIEValue *D) { return D->getType() == isString; }<br>
@@ -386,11 +388,11 @@ namespace llvm {<br>
<br>
/// EmitValue - Emit debug information entry offset.<br>
///<br>
- virtual void EmitValue(AsmPrinter *AP, uint16_t Form) const;<br>
+ virtual void EmitValue(AsmPrinter *AP, dwarf::Form Form) const;<br>
<br>
/// SizeOf - Determine size of debug information entry in bytes.<br>
///<br>
- virtual unsigned SizeOf(AsmPrinter *AP, uint16_t Form) const {<br>
+ virtual unsigned SizeOf(AsmPrinter *AP, dwarf::Form Form) const {<br>
return Form == dwarf::DW_FORM_ref_addr ? getRefAddrSize(AP)<br>
: sizeof(int32_t);<br>
}<br>
@@ -412,9 +414,7 @@ namespace llvm {<br>
class DIEBlock : public DIEValue, public DIE {<br>
unsigned Size; // Size in bytes excluding size header.<br>
public:<br>
- DIEBlock()<br>
- : DIEValue(isBlock), DIE(0), Size(0) {}<br>
- virtual ~DIEBlock() {}<br>
+ DIEBlock() : DIEValue(isBlock), DIE(0), Size(0) {}<br>
<br>
/// ComputeSize - calculate the size of the block.<br>
///<br>
@@ -422,7 +422,7 @@ namespace llvm {<br>
<br>
/// BestForm - Choose the best form for data.<br>
///<br>
- uint16_t BestForm() const {<br>
+ dwarf::Form BestForm() const {<br>
if ((unsigned char)Size == Size) return dwarf::DW_FORM_block1;<br>
if ((unsigned short)Size == Size) return dwarf::DW_FORM_block2;<br>
if ((unsigned int)Size == Size) return dwarf::DW_FORM_block4;<br>
@@ -431,11 +431,11 @@ namespace llvm {<br>
<br>
/// EmitValue - Emit block data.<br>
///<br>
- virtual void EmitValue(AsmPrinter *AP, uint16_t Form) const;<br>
+ virtual void EmitValue(AsmPrinter *AP, dwarf::Form Form) const;<br>
<br>
/// SizeOf - Determine size of block data in bytes.<br>
///<br>
- virtual unsigned SizeOf(AsmPrinter *AP, uint16_t Form) const;<br>
+ virtual unsigned SizeOf(AsmPrinter *AP, dwarf::Form Form) const;<br>
<br>
// Implement isa/cast/dyncast.<br>
static bool classof(const DIEValue *E) { return E->getType() == isBlock; }<br>
<br>
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp?rev=193091&r1=193090&r2=193091&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp?rev=193091&r1=193090&r2=193091&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp (original)<br>
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp Mon Oct 21 12:28:37 2013<br>
@@ -96,7 +96,7 @@ int64_t CompileUnit::getDefaultLowerBoun<br>
}<br>
<br>
/// addFlag - Add a flag that is true.<br>
-void CompileUnit::addFlag(DIE *Die, uint16_t Attribute) {<br>
+void CompileUnit::addFlag(DIE *Die, dwarf::Attribute Attribute) {<br>
if (DD->getDwarfVersion() >= 4)<br>
Die->addValue(Attribute, dwarf::DW_FORM_flag_present, DIEIntegerOne);<br>
else<br>
@@ -105,23 +105,32 @@ void CompileUnit::addFlag(DIE *Die, uint<br>
<br>
/// addUInt - Add an unsigned integer attribute data and value.<br>
///<br>
-void CompileUnit::addUInt(DIE *Die, uint16_t Attribute, uint16_t Form,<br>
- uint64_t Integer) {<br>
+void CompileUnit::addUInt(DIE *Die, dwarf::Attribute Attribute,<br>
+ Optional<dwarf::Form> Form, uint64_t Integer) {<br>
if (!Form)<br>
Form = DIEInteger::BestForm(false, Integer);<br>
DIEValue *Value = Integer == 1 ? DIEIntegerOne : new (DIEValueAllocator)<br>
DIEInteger(Integer);<br>
- Die->addValue(Attribute, Form, Value);<br>
+ Die->addValue(Attribute, *Form, Value);<br>
+}<br>
+<br>
+void CompileUnit::addUInt(DIEBlock *Block, dwarf::Form Form, uint64_t Integer) {<br>
+ addUInt(Block, (dwarf::Attribute)0, Form, Integer);<br>
}<br>
<br>
/// addSInt - Add an signed integer attribute data and value.<br>
///<br>
-void CompileUnit::addSInt(DIE *Die, uint16_t Attribute, uint16_t Form,<br>
- int64_t Integer) {<br>
+void CompileUnit::addSInt(DIE *Die, dwarf::Attribute Attribute,<br>
+ Optional<dwarf::Form> Form, int64_t Integer) {<br>
if (!Form)<br>
Form = DIEInteger::BestForm(true, Integer);<br>
DIEValue *Value = new (DIEValueAllocator) DIEInteger(Integer);<br>
- Die->addValue(Attribute, Form, Value);<br>
+ Die->addValue(Attribute, *Form, Value);<br>
+}<br>
+<br>
+void CompileUnit::addSInt(DIEBlock *Die, Optional<dwarf::Form> Form,<br>
+ int64_t Integer) {<br>
+ addSInt(Die, (dwarf::Attribute)0, Form, Integer);<br>
}<br>
<br>
/// addString - Add a string attribute data and value. We always emit a<br>
@@ -129,9 +138,9 @@ void CompileUnit::addSInt(DIE *Die, uint<br>
/// more predictable sizes. In the case of split dwarf we emit an index<br>
/// into another table which gets us the static offset into the string<br>
/// table.<br>
-void CompileUnit::addString(DIE *Die, uint16_t Attribute, StringRef String) {<br>
+void CompileUnit::addString(DIE *Die, dwarf::Attribute Attribute, StringRef String) {<br>
DIEValue *Value;<br>
- uint16_t Form;<br>
+ dwarf::Form Form;<br>
if (!DD->useSplitDwarf()) {<br>
MCSymbol *Symb = DU->getStringPoolEntry(String);<br>
if (Asm->needsRelocationsForDwarfStringPool())<br>
@@ -152,7 +161,7 @@ void CompileUnit::addString(DIE *Die, ui<br>
<br>
/// addLocalString - Add a string attribute data and value. This is guaranteed<br>
/// to be in the local string pool instead of indirected.<br>
-void CompileUnit::addLocalString(DIE *Die, uint16_t Attribute,<br>
+void CompileUnit::addLocalString(DIE *Die, dwarf::Attribute Attribute,<br>
StringRef String) {<br>
MCSymbol *Symb = DU->getStringPoolEntry(String);<br>
DIEValue *Value;<br>
@@ -167,24 +176,28 @@ void CompileUnit::addLocalString(DIE *Di<br>
<br>
/// addExpr - Add a Dwarf expression attribute data and value.<br>
///<br>
-void CompileUnit::addExpr(DIE *Die, uint16_t Attribute, uint16_t Form,<br>
- const MCExpr *Expr) {<br>
+void CompileUnit::addExpr(DIEBlock *Die, dwarf::Form Form, const MCExpr *Expr) {<br>
DIEValue *Value = new (DIEValueAllocator) DIEExpr(Expr);<br>
- Die->addValue(Attribute, Form, Value);<br>
+ Die->addValue((dwarf::Attribute)0, Form, Value);<br>
}<br>
<br>
/// addLabel - Add a Dwarf label attribute data and value.<br>
///<br>
-void CompileUnit::addLabel(DIE *Die, uint16_t Attribute, uint16_t Form,<br>
+void CompileUnit::addLabel(DIE *Die, dwarf::Attribute Attribute, dwarf::Form Form,<br>
const MCSymbol *Label) {<br>
DIEValue *Value = new (DIEValueAllocator) DIELabel(Label);<br>
Die->addValue(Attribute, Form, Value);<br>
}<br>
<br>
+void CompileUnit::addLabel(DIEBlock *Die, dwarf::Form Form,<br>
+ const MCSymbol *Label) {<br>
+ addLabel(Die, (dwarf::Attribute)0, Form, Label);<br>
+}<br>
+<br>
/// addLabelAddress - Add a dwarf label attribute data and value using<br>
/// DW_FORM_addr or DW_FORM_GNU_addr_index.<br>
///<br>
-void CompileUnit::addLabelAddress(DIE *Die, uint16_t Attribute,<br>
+void CompileUnit::addLabelAddress(DIE *Die, dwarf::Attribute Attribute,<br>
MCSymbol *Label) {<br>
if (Label)<br>
DD->addArangeLabel(SymbolCU(this, Label));<br>
@@ -207,20 +220,20 @@ void CompileUnit::addLabelAddress(DIE *D<br>
/// addOpAddress - Add a dwarf op address data and value using the<br>
/// form given and an op of either DW_FORM_addr or DW_FORM_GNU_addr_index.<br>
///<br>
-void CompileUnit::addOpAddress(DIE *Die, const MCSymbol *Sym) {<br>
+void CompileUnit::addOpAddress(DIEBlock *Die, const MCSymbol *Sym) {<br>
DD->addArangeLabel(SymbolCU(this, Sym));<br>
if (!DD->useSplitDwarf()) {<br>
- addUInt(Die, 0, dwarf::DW_FORM_data1, dwarf::DW_OP_addr);<br>
- addLabel(Die, 0, dwarf::DW_FORM_udata, Sym);<br>
+ addUInt(Die, dwarf::DW_FORM_data1, dwarf::DW_OP_addr);<br>
+ addLabel(Die, dwarf::DW_FORM_udata, Sym);<br>
} else {<br>
- addUInt(Die, 0, dwarf::DW_FORM_data1, dwarf::DW_OP_GNU_addr_index);<br>
- addUInt(Die, 0, dwarf::DW_FORM_GNU_addr_index, DU->getAddrPoolIndex(Sym));<br>
+ addUInt(Die, dwarf::DW_FORM_data1, dwarf::DW_OP_GNU_addr_index);<br>
+ addUInt(Die, dwarf::DW_FORM_GNU_addr_index, DU->getAddrPoolIndex(Sym));<br>
}<br>
}<br>
<br>
/// addDelta - Add a label delta attribute data and value.<br>
///<br>
-void CompileUnit::addDelta(DIE *Die, uint16_t Attribute, uint16_t Form,<br>
+void CompileUnit::addDelta(DIE *Die, dwarf::Attribute Attribute, dwarf::Form Form,<br>
const MCSymbol *Hi, const MCSymbol *Lo) {<br>
DIEValue *Value = new (DIEValueAllocator) DIEDelta(Hi, Lo);<br>
Die->addValue(Attribute, Form, Value);<br>
@@ -228,14 +241,14 @@ void CompileUnit::addDelta(DIE *Die, uin<br>
<br>
/// addDIEEntry - Add a DIE attribute data and value.<br>
///<br>
-void CompileUnit::addDIEEntry(DIE *Die, uint16_t Attribute, DIE *Entry) {<br>
+void CompileUnit::addDIEEntry(DIE *Die, dwarf::Attribute Attribute, DIE *Entry) {<br>
// We currently only use ref4.<br>
Die->addValue(Attribute, dwarf::DW_FORM_ref4, createDIEEntry(Entry));<br>
}<br>
<br>
/// addBlock - Add block data.<br>
///<br>
-void CompileUnit::addBlock(DIE *Die, uint16_t Attribute, uint16_t Form,<br>
+void CompileUnit::addBlock(DIE *Die, dwarf::Attribute Attribute,<br>
DIEBlock *Block) {<br>
Block->ComputeSize(Asm);<br>
DIEBlocks.push_back(Block); // Memoize so we can call the destructor later on.<br>
@@ -256,8 +269,8 @@ void CompileUnit::addSourceLine(DIE *Die<br>
DD->getOrCreateSourceID(V.getContext().getFilename(),<br>
V.getContext().getDirectory(), getUniqueID());<br>
assert(FileID && "Invalid file id");<br>
- addUInt(Die, dwarf::DW_AT_decl_file, 0, FileID);<br>
- addUInt(Die, dwarf::DW_AT_decl_line, 0, Line);<br>
+ addUInt(Die, dwarf::DW_AT_decl_file, None, FileID);<br>
+ addUInt(Die, dwarf::DW_AT_decl_line, None, Line);<br>
}<br>
<br>
/// addSourceLine - Add location information to specified debug information<br>
@@ -273,8 +286,8 @@ void CompileUnit::addSourceLine(DIE *Die<br>
unsigned FileID =<br>
DD->getOrCreateSourceID(G.getFilename(), G.getDirectory(), getUniqueID());<br>
assert(FileID && "Invalid file id");<br>
- addUInt(Die, dwarf::DW_AT_decl_file, 0, FileID);<br>
- addUInt(Die, dwarf::DW_AT_decl_line, 0, Line);<br>
+ addUInt(Die, dwarf::DW_AT_decl_file, None, FileID);<br>
+ addUInt(Die, dwarf::DW_AT_decl_line, None, Line);<br>
}<br>
<br>
/// addSourceLine - Add location information to specified debug information<br>
@@ -292,8 +305,8 @@ void CompileUnit::addSourceLine(DIE *Die<br>
unsigned FileID = DD->getOrCreateSourceID(SP.getFilename(), SP.getDirectory(),<br>
getUniqueID());<br>
assert(FileID && "Invalid file id");<br>
- addUInt(Die, dwarf::DW_AT_decl_file, 0, FileID);<br>
- addUInt(Die, dwarf::DW_AT_decl_line, 0, Line);<br>
+ addUInt(Die, dwarf::DW_AT_decl_file, None, FileID);<br>
+ addUInt(Die, dwarf::DW_AT_decl_line, None, Line);<br>
}<br>
<br>
/// addSourceLine - Add location information to specified debug information<br>
@@ -309,8 +322,8 @@ void CompileUnit::addSourceLine(DIE *Die<br>
unsigned FileID = DD->getOrCreateSourceID(Ty.getFilename(), Ty.getDirectory(),<br>
getUniqueID());<br>
assert(FileID && "Invalid file id");<br>
- addUInt(Die, dwarf::DW_AT_decl_file, 0, FileID);<br>
- addUInt(Die, dwarf::DW_AT_decl_line, 0, Line);<br>
+ addUInt(Die, dwarf::DW_AT_decl_file, None, FileID);<br>
+ addUInt(Die, dwarf::DW_AT_decl_line, None, Line);<br>
}<br>
<br>
/// addSourceLine - Add location information to specified debug information<br>
@@ -327,8 +340,8 @@ void CompileUnit::addSourceLine(DIE *Die<br>
unsigned FileID = DD->getOrCreateSourceID(File.getFilename(),<br>
File.getDirectory(), getUniqueID());<br>
assert(FileID && "Invalid file id");<br>
- addUInt(Die, dwarf::DW_AT_decl_file, 0, FileID);<br>
- addUInt(Die, dwarf::DW_AT_decl_line, 0, Line);<br>
+ addUInt(Die, dwarf::DW_AT_decl_file, None, FileID);<br>
+ addUInt(Die, dwarf::DW_AT_decl_line, None, Line);<br>
}<br>
<br>
/// addSourceLine - Add location information to specified debug information<br>
@@ -346,8 +359,8 @@ void CompileUnit::addSourceLine(DIE *Die<br>
unsigned FileID =<br>
DD->getOrCreateSourceID(FN, NS.getDirectory(), getUniqueID());<br>
assert(FileID && "Invalid file id");<br>
- addUInt(Die, dwarf::DW_AT_decl_file, 0, FileID);<br>
- addUInt(Die, dwarf::DW_AT_decl_line, 0, Line);<br>
+ addUInt(Die, dwarf::DW_AT_decl_file, None, FileID);<br>
+ addUInt(Die, dwarf::DW_AT_decl_line, None, Line);<br>
}<br>
<br>
/// addVariableAddress - Add DW_AT_location attribute for a<br>
@@ -364,37 +377,38 @@ void CompileUnit::addVariableAddress(con<br>
}<br>
<br>
/// addRegisterOp - Add register operand.<br>
-void CompileUnit::addRegisterOp(DIE *TheDie, unsigned Reg) {<br>
+void CompileUnit::addRegisterOp(DIEBlock *TheDie, unsigned Reg) {<br>
const TargetRegisterInfo *RI = Asm->TM.getRegisterInfo();<br>
unsigned DWReg = RI->getDwarfRegNum(Reg, false);<br>
if (DWReg < 32)<br>
- addUInt(TheDie, 0, dwarf::DW_FORM_data1, dwarf::DW_OP_reg0 + DWReg);<br>
+ addUInt(TheDie, dwarf::DW_FORM_data1, dwarf::DW_OP_reg0 + DWReg);<br>
else {<br>
- addUInt(TheDie, 0, dwarf::DW_FORM_data1, dwarf::DW_OP_regx);<br>
- addUInt(TheDie, 0, dwarf::DW_FORM_udata, DWReg);<br>
+ addUInt(TheDie, dwarf::DW_FORM_data1, dwarf::DW_OP_regx);<br>
+ addUInt(TheDie, dwarf::DW_FORM_udata, DWReg);<br>
}<br>
}<br>
<br>
/// addRegisterOffset - Add register offset.<br>
-void CompileUnit::addRegisterOffset(DIE *TheDie, unsigned Reg, int64_t Offset) {<br>
+void CompileUnit::addRegisterOffset(DIEBlock *TheDie, unsigned Reg,<br>
+ int64_t Offset) {<br>
const TargetRegisterInfo *RI = Asm->TM.getRegisterInfo();<br>
unsigned DWReg = RI->getDwarfRegNum(Reg, false);<br>
const TargetRegisterInfo *TRI = Asm->TM.getRegisterInfo();<br>
if (Reg == TRI->getFrameRegister(*Asm->MF))<br>
// If variable offset is based in frame register then use fbreg.<br>
- addUInt(TheDie, 0, dwarf::DW_FORM_data1, dwarf::DW_OP_fbreg);<br>
+ addUInt(TheDie, dwarf::DW_FORM_data1, dwarf::DW_OP_fbreg);<br>
else if (DWReg < 32)<br>
- addUInt(TheDie, 0, dwarf::DW_FORM_data1, dwarf::DW_OP_breg0 + DWReg);<br>
+ addUInt(TheDie, dwarf::DW_FORM_data1, dwarf::DW_OP_breg0 + DWReg);<br>
else {<br>
- addUInt(TheDie, 0, dwarf::DW_FORM_data1, dwarf::DW_OP_bregx);<br>
- addUInt(TheDie, 0, dwarf::DW_FORM_udata, DWReg);<br>
+ addUInt(TheDie, dwarf::DW_FORM_data1, dwarf::DW_OP_bregx);<br>
+ addUInt(TheDie, dwarf::DW_FORM_udata, DWReg);<br>
}<br>
- addSInt(TheDie, 0, dwarf::DW_FORM_sdata, Offset);<br>
+ addSInt(TheDie, dwarf::DW_FORM_sdata, Offset);<br>
}<br>
<br>
/// addAddress - Add an address attribute to a die based on the location<br>
/// provided.<br>
-void CompileUnit::addAddress(DIE *Die, uint16_t Attribute,<br>
+void CompileUnit::addAddress(DIE *Die, dwarf::Attribute Attribute,<br>
const MachineLocation &Location, bool Indirect) {<br>
DIEBlock *Block = new (DIEValueAllocator) DIEBlock();<br>
<br>
@@ -403,12 +417,12 @@ void CompileUnit::addAddress(DIE *Die, u<br>
else {<br>
addRegisterOffset(Block, Location.getReg(), Location.getOffset());<br>
if (Indirect && !Location.isReg()) {<br>
- addUInt(Block, 0, dwarf::DW_FORM_data1, dwarf::DW_OP_deref);<br>
+ addUInt(Block, dwarf::DW_FORM_data1, dwarf::DW_OP_deref);<br>
}<br>
}<br>
<br>
// Now attach the location information to the DIE.<br>
- addBlock(Die, Attribute, 0, Block);<br>
+ addBlock(Die, Attribute, Block);<br>
}<br>
<br>
/// addComplexAddress - Start with the address based on the location provided,<br>
@@ -417,7 +431,7 @@ void CompileUnit::addAddress(DIE *Die, u<br>
/// the starting location. Add the DWARF information to the die.<br>
///<br>
void CompileUnit::addComplexAddress(const DbgVariable &DV, DIE *Die,<br>
- uint16_t Attribute,<br>
+ dwarf::Attribute Attribute,<br>
const MachineLocation &Location) {<br>
DIEBlock *Block = new (DIEValueAllocator) DIEBlock();<br>
unsigned N = DV.getNumAddrElements();<br>
@@ -436,17 +450,17 @@ void CompileUnit::addComplexAddress(cons<br>
for (; i < N; ++i) {<br>
uint64_t Element = DV.getAddrElement(i);<br>
if (Element == DIBuilder::OpPlus) {<br>
- addUInt(Block, 0, dwarf::DW_FORM_data1, dwarf::DW_OP_plus_uconst);<br>
- addUInt(Block, 0, dwarf::DW_FORM_udata, DV.getAddrElement(++i));<br>
+ addUInt(Block, dwarf::DW_FORM_data1, dwarf::DW_OP_plus_uconst);<br>
+ addUInt(Block, dwarf::DW_FORM_udata, DV.getAddrElement(++i));<br>
} else if (Element == DIBuilder::OpDeref) {<br>
if (!Location.isReg())<br>
- addUInt(Block, 0, dwarf::DW_FORM_data1, dwarf::DW_OP_deref);<br>
+ addUInt(Block, dwarf::DW_FORM_data1, dwarf::DW_OP_deref);<br>
} else<br>
llvm_unreachable("unknown DIBuilder Opcode");<br>
}<br>
<br>
// Now attach the location information to the DIE.<br>
- addBlock(Die, Attribute, 0, Block);<br>
+ addBlock(Die, Attribute, Block);<br>
}<br>
<br>
/* Byref variables, in Blocks, are declared by the programmer as "SomeType<br>
@@ -510,7 +524,7 @@ void CompileUnit::addComplexAddress(cons<br>
/// more information, read large comment just above here.<br>
///<br>
void CompileUnit::addBlockByrefAddress(const DbgVariable &DV, DIE *Die,<br>
- uint16_t Attribute,<br>
+ dwarf::Attribute Attribute,<br>
const MachineLocation &Location) {<br>
DIType Ty = DV.getType();<br>
DIType TmpTy = Ty;<br>
@@ -560,30 +574,30 @@ void CompileUnit::addBlockByrefAddress(c<br>
// If we started with a pointer to the __Block_byref... struct, then<br>
// the first thing we need to do is dereference the pointer (DW_OP_deref).<br>
if (isPointer)<br>
- addUInt(Block, 0, dwarf::DW_FORM_data1, dwarf::DW_OP_deref);<br>
+ addUInt(Block, dwarf::DW_FORM_data1, dwarf::DW_OP_deref);<br>
<br>
// Next add the offset for the '__forwarding' field:<br>
// DW_OP_plus_uconst ForwardingFieldOffset. Note there's no point in<br>
// adding the offset if it's 0.<br>
if (forwardingFieldOffset > 0) {<br>
- addUInt(Block, 0, dwarf::DW_FORM_data1, dwarf::DW_OP_plus_uconst);<br>
- addUInt(Block, 0, dwarf::DW_FORM_udata, forwardingFieldOffset);<br>
+ addUInt(Block, dwarf::DW_FORM_data1, dwarf::DW_OP_plus_uconst);<br>
+ addUInt(Block, dwarf::DW_FORM_udata, forwardingFieldOffset);<br>
}<br>
<br>
// Now dereference the __forwarding field to get to the real __Block_byref<br>
// struct: DW_OP_deref.<br>
- addUInt(Block, 0, dwarf::DW_FORM_data1, dwarf::DW_OP_deref);<br>
+ addUInt(Block, dwarf::DW_FORM_data1, dwarf::DW_OP_deref);<br>
<br>
// Now that we've got the real __Block_byref... struct, add the offset<br>
// for the variable's field to get to the location of the actual variable:<br>
// DW_OP_plus_uconst varFieldOffset. Again, don't add if it's 0.<br>
if (varFieldOffset > 0) {<br>
- addUInt(Block, 0, dwarf::DW_FORM_data1, dwarf::DW_OP_plus_uconst);<br>
- addUInt(Block, 0, dwarf::DW_FORM_udata, varFieldOffset);<br>
+ addUInt(Block, dwarf::DW_FORM_data1, dwarf::DW_OP_plus_uconst);<br>
+ addUInt(Block, dwarf::DW_FORM_udata, varFieldOffset);<br>
}<br>
<br>
// Now attach the location information to the DIE.<br>
- addBlock(Die, Attribute, 0, Block);<br>
+ addBlock(Die, Attribute, Block);<br>
}<br>
<br>
/// isTypeSigned - Return true if the type is signed.<br>
@@ -654,7 +668,7 @@ void CompileUnit::addConstantValue(DIE *<br>
assert(MO.isImm() && "Invalid machine operand!");<br>
int SizeInBits = -1;<br>
bool SignedConstant = isTypeSigned(DD, Ty, &SizeInBits);<br>
- uint16_t Form;<br>
+ dwarf::Form Form;<br>
<br>
// If we're a signed constant definitely use sdata.<br>
if (SignedConstant) {<br>
@@ -702,10 +716,10 @@ void CompileUnit::addConstantFPValue(DIE<br>
<br>
// Output the constant to DWARF one byte at a time.<br>
for (; Start != Stop; Start += Incr)<br>
- addUInt(Block, 0, dwarf::DW_FORM_data1,<br>
+ addUInt(Block, dwarf::DW_FORM_data1,<br>
(unsigned char)0xFF & FltPtr[Start]);<br>
<br>
- addBlock(Die, dwarf::DW_AT_const_value, 0, Block);<br>
+ addBlock(Die, dwarf::DW_AT_const_value, Block);<br>
}<br>
<br>
/// addConstantFPValue - Add constant value entry in variable DIE.<br>
@@ -732,7 +746,7 @@ void CompileUnit::addConstantValue(DIE *<br>
}<br>
<br>
// Else use data for now unless it's larger than we can deal with.<br>
- uint16_t Form;<br>
+ dwarf::Form Form;<br>
switch (CIBitWidth) {<br>
case 8:<br>
Form = dwarf::DW_FORM_data1;<br>
@@ -770,10 +784,10 @@ void CompileUnit::addConstantValue(DIE *<br>
c = Ptr64[i / 8] >> (8 * (i & 7));<br>
else<br>
c = Ptr64[(NumBytes - 1 - i) / 8] >> (8 * ((NumBytes - 1 - i) & 7));<br>
- addUInt(Block, 0, dwarf::DW_FORM_data1, c);<br>
+ addUInt(Block, dwarf::DW_FORM_data1, c);<br>
}<br>
<br>
- addBlock(Die, dwarf::DW_AT_const_value, 0, Block);<br>
+ addBlock(Die, dwarf::DW_AT_const_value, Block);<br>
}<br>
<br>
/// addTemplateParams - Add template parameters into buffer.<br>
@@ -857,7 +871,7 @@ DIE *CompileUnit::getOrCreateTypeDIE(con<br>
}<br>
<br>
/// addType - Add a new type attribute to the specified entity.<br>
-void CompileUnit::addType(DIE *Entity, DIType Ty, uint16_t Attribute) {<br>
+void CompileUnit::addType(DIE *Entity, DIType Ty, dwarf::Attribute Attribute) {<br>
assert(Ty && "Trying to add a type that doesn't exist?");<br>
<br>
// Check for pre-existence.<br>
@@ -1001,7 +1015,7 @@ void CompileUnit::constructTypeDIE(DIE &<br>
BTy.getEncoding());<br>
<br>
uint64_t Size = BTy.getSizeInBits() >> 3;<br>
- addUInt(&Buffer, dwarf::DW_AT_byte_size, 0, Size);<br>
+ addUInt(&Buffer, dwarf::DW_AT_byte_size, None, Size);<br>
}<br>
<br>
/// constructTypeDIE - Construct derived type die from DIDerivedType.<br>
@@ -1022,7 +1036,7 @@ void CompileUnit::constructTypeDIE(DIE &<br>
<br>
// Add size if non-zero (derived types might be zero-sized.)<br>
if (Size && Tag != dwarf::DW_TAG_pointer_type)<br>
- addUInt(&Buffer, dwarf::DW_AT_byte_size, 0, Size);<br>
+ addUInt(&Buffer, dwarf::DW_AT_byte_size, None, Size);<br>
<br>
if (Tag == dwarf::DW_TAG_ptr_to_member_type)<br>
addDIEEntry(&Buffer, dwarf::DW_AT_containing_type,<br>
@@ -1182,7 +1196,7 @@ void CompileUnit::constructTypeDIE(DIE &<br>
if (Property.isNonAtomicObjCProperty())<br>
PropertyAttributes |= dwarf::DW_APPLE_PROPERTY_nonatomic;<br>
if (PropertyAttributes)<br>
- addUInt(ElemDie, dwarf::DW_AT_APPLE_property_attribute, 0,<br>
+ addUInt(ElemDie, dwarf::DW_AT_APPLE_property_attribute, None,<br>
PropertyAttributes);<br>
<br>
DIEEntry *Entry = getDIEEntry(Element);<br>
@@ -1228,10 +1242,10 @@ void CompileUnit::constructTypeDIE(DIE &<br>
// Add size if non-zero (derived types might be zero-sized.)<br>
// TODO: Do we care about size for enum forward declarations?<br>
if (Size)<br>
- addUInt(&Buffer, dwarf::DW_AT_byte_size, 0, Size);<br>
+ addUInt(&Buffer, dwarf::DW_AT_byte_size, None, Size);<br>
else if (!CTy.isForwardDecl())<br>
// Add zero size if it is not a forward declaration.<br>
- addUInt(&Buffer, dwarf::DW_AT_byte_size, 0, 0);<br>
+ addUInt(&Buffer, dwarf::DW_AT_byte_size, None, 0);<br>
<br>
// If we're a forward decl, say so.<br>
if (CTy.isForwardDecl())<br>
@@ -1301,8 +1315,8 @@ CompileUnit::getOrCreateTemplateValuePar<br>
addOpAddress(Block, Asm->Mang->getSymbol(GV));<br>
// Emit DW_OP_stack_value to use the address as the immediate value of the<br>
// parameter, rather than a pointer to it.<br>
- addUInt(Block, 0, dwarf::DW_FORM_data1, dwarf::DW_OP_stack_value);<br>
- addBlock(ParamDIE, dwarf::DW_AT_location, 0, Block);<br>
+ addUInt(Block, dwarf::DW_FORM_data1, dwarf::DW_OP_stack_value);<br>
+ addBlock(ParamDIE, dwarf::DW_AT_location, Block);<br>
} else if (VP.getTag() == dwarf::DW_TAG_GNU_template_template_param) {<br>
assert(isa<MDString>(Val));<br>
addString(ParamDIE, dwarf::DW_AT_GNU_template_name,<br>
@@ -1410,9 +1424,9 @@ DIE *CompileUnit::getOrCreateSubprogramD<br>
if (VK) {<br>
addUInt(SPDie, dwarf::DW_AT_virtuality, dwarf::DW_FORM_data1, VK);<br>
DIEBlock *Block = getDIEBlock();<br>
- addUInt(Block, 0, dwarf::DW_FORM_data1, dwarf::DW_OP_constu);<br>
- addUInt(Block, 0, dwarf::DW_FORM_udata, SP.getVirtualIndex());<br>
- addBlock(SPDie, dwarf::DW_AT_vtable_elem_location, 0, Block);<br>
+ addUInt(Block, dwarf::DW_FORM_data1, dwarf::DW_OP_constu);<br>
+ addUInt(Block, dwarf::DW_FORM_udata, SP.getVirtualIndex());<br>
+ addBlock(SPDie, dwarf::DW_AT_vtable_elem_location, Block);<br>
ContainingTypeMap.insert(std::make_pair(SPDie,<br>
resolve(SP.getContainingType())));<br>
}<br>
@@ -1539,18 +1553,17 @@ void CompileUnit::createGlobalVariableDI<br>
// Based on GCC's support for TLS:<br>
if (!DD->useSplitDwarf()) {<br>
// 1) Start with a constNu of the appropriate pointer size<br>
- addUInt(Block, 0, dwarf::DW_FORM_data1,<br>
+ addUInt(Block, dwarf::DW_FORM_data1,<br>
PointerSize == 4 ? dwarf::DW_OP_const4u : dwarf::DW_OP_const8u);<br>
// 2) containing the (relocated) offset of the TLS variable<br>
// within the module's TLS block.<br>
- addExpr(Block, 0, dwarf::DW_FORM_udata, Expr);<br>
+ addExpr(Block, dwarf::DW_FORM_udata, Expr);<br>
} else {<br>
- addUInt(Block, 0, dwarf::DW_FORM_data1, dwarf::DW_OP_GNU_const_index);<br>
- addUInt(Block, 0, dwarf::DW_FORM_udata, DU->getAddrPoolIndex(Expr));<br>
+ addUInt(Block, dwarf::DW_FORM_data1, dwarf::DW_OP_GNU_const_index);<br>
+ addUInt(Block, dwarf::DW_FORM_udata, DU->getAddrPoolIndex(Expr));<br>
}<br>
// 3) followed by a custom OP to make the debugger do a TLS lookup.<br>
- addUInt(Block, 0, dwarf::DW_FORM_data1,<br>
- dwarf::DW_OP_GNU_push_tls_address);<br>
+ addUInt(Block, dwarf::DW_FORM_data1, dwarf::DW_OP_GNU_push_tls_address);<br>
} else<br>
addOpAddress(Block, Sym);<br>
// Do not create specification DIE if context is either compile unit<br>
@@ -1560,13 +1573,13 @@ void CompileUnit::createGlobalVariableDI<br>
// Create specification DIE.<br>
VariableSpecDIE = new DIE(dwarf::DW_TAG_variable);<br>
addDIEEntry(VariableSpecDIE, dwarf::DW_AT_specification, VariableDIE);<br>
- addBlock(VariableSpecDIE, dwarf::DW_AT_location, 0, Block);<br>
+ addBlock(VariableSpecDIE, dwarf::DW_AT_location, Block);<br>
// A static member's declaration is already flagged as such.<br>
if (!SDMDecl.Verify())<br>
addFlag(VariableDIE, dwarf::DW_AT_declaration);<br>
addDie(VariableSpecDIE);<br>
} else {<br>
- addBlock(VariableDIE, dwarf::DW_AT_location, 0, Block);<br>
+ addBlock(VariableDIE, dwarf::DW_AT_location, Block);<br>
}<br>
// Add the linkage name.<br>
StringRef LinkageName = GV.getLinkageName();<br>
@@ -1591,12 +1604,12 @@ void CompileUnit::createGlobalVariableDI<br>
DIEBlock *Block = new (DIEValueAllocator) DIEBlock();<br>
Value *Ptr = CE->getOperand(0);<br>
addOpAddress(Block, Asm->Mang->getSymbol(cast<GlobalValue>(Ptr)));<br>
- addUInt(Block, 0, dwarf::DW_FORM_data1, dwarf::DW_OP_constu);<br>
+ addUInt(Block, dwarf::DW_FORM_data1, dwarf::DW_OP_constu);<br>
SmallVector<Value *, 3> Idx(CE->op_begin() + 1, CE->op_end());<br>
- addUInt(Block, 0, dwarf::DW_FORM_udata,<br>
+ addUInt(Block, dwarf::DW_FORM_udata,<br>
Asm->getDataLayout().getIndexedOffset(Ptr->getType(), Idx));<br>
- addUInt(Block, 0, dwarf::DW_FORM_data1, dwarf::DW_OP_plus);<br>
- addBlock(VariableDIE, dwarf::DW_AT_location, 0, Block);<br>
+ addUInt(Block, dwarf::DW_FORM_data1, dwarf::DW_OP_plus);<br>
+ addBlock(VariableDIE, dwarf::DW_AT_location, Block);<br>
}<br>
<br>
if (addToAccelTable) {<br>
@@ -1631,12 +1644,12 @@ void CompileUnit::constructSubrangeDIE(D<br>
int64_t Count = SR.getCount();<br>
<br>
if (DefaultLowerBound == -1 || LowerBound != DefaultLowerBound)<br>
- addUInt(DW_Subrange, dwarf::DW_AT_lower_bound, 0, LowerBound);<br>
+ addUInt(DW_Subrange, dwarf::DW_AT_lower_bound, None, LowerBound);<br>
<br>
if (Count != -1 && Count != 0)<br>
// FIXME: An unbounded array should reference the expression that defines<br>
// the array.<br>
- addUInt(DW_Subrange, dwarf::DW_AT_upper_bound, 0, LowerBound + Count - 1);<br>
+ addUInt(DW_Subrange, dwarf::DW_AT_upper_bound, None, LowerBound + Count - 1);<br>
<br>
Buffer.addChild(DW_Subrange);<br>
}<br>
@@ -1657,7 +1670,7 @@ void CompileUnit::constructArrayTypeDIE(<br>
// Construct an anonymous type for index type.<br>
IdxTy = new DIE(dwarf::DW_TAG_base_type);<br>
addString(IdxTy, dwarf::DW_AT_name, "int");<br>
- addUInt(IdxTy, dwarf::DW_AT_byte_size, 0, sizeof(int32_t));<br>
+ addUInt(IdxTy, dwarf::DW_AT_byte_size, None, sizeof(int32_t));<br>
addUInt(IdxTy, dwarf::DW_AT_encoding, dwarf::DW_FORM_data1,<br>
dwarf::DW_ATE_signed);<br>
addDie(IdxTy);<br>
@@ -1787,15 +1800,16 @@ DIE *CompileUnit::createMemberDIE(DIDeri<br>
addSourceLine(MemberDie, DT);<br>
<br>
DIEBlock *MemLocationDie = new (DIEValueAllocator) DIEBlock();<br>
- addUInt(MemLocationDie, 0, dwarf::DW_FORM_data1, dwarf::DW_OP_plus_uconst);<br>
+ addUInt(MemLocationDie, dwarf::DW_FORM_data1, dwarf::DW_OP_plus_uconst);<br>
<br>
uint64_t Size = DT.getSizeInBits();<br>
uint64_t FieldSize = getBaseTypeSize(DD, DT);<br>
<br>
if (Size != FieldSize) {<br>
// Handle bitfield.<br>
- addUInt(MemberDie, dwarf::DW_AT_byte_size, 0, getBaseTypeSize(DD, DT) >> 3);<br>
- addUInt(MemberDie, dwarf::DW_AT_bit_size, 0, DT.getSizeInBits());<br>
+ addUInt(MemberDie, dwarf::DW_AT_byte_size, None,<br>
+ getBaseTypeSize(DD, DT) >> 3);<br>
+ addUInt(MemberDie, dwarf::DW_AT_bit_size, None, DT.getSizeInBits());<br>
<br>
uint64_t Offset = DT.getOffsetInBits();<br>
uint64_t AlignMask = ~(DT.getAlignInBits() - 1);<br>
@@ -1806,15 +1820,15 @@ DIE *CompileUnit::createMemberDIE(DIDeri<br>
// Maybe we need to work from the other end.<br>
if (Asm->getDataLayout().isLittleEndian())<br>
Offset = FieldSize - (Offset + Size);<br>
- addUInt(MemberDie, dwarf::DW_AT_bit_offset, 0, Offset);<br>
+ addUInt(MemberDie, dwarf::DW_AT_bit_offset, None, Offset);<br>
<br>
// Here WD_AT_data_member_location points to the anonymous<br>
// field that includes this bit field.<br>
- addUInt(MemLocationDie, 0, dwarf::DW_FORM_udata, FieldOffset >> 3);<br>
+ addUInt(MemLocationDie, dwarf::DW_FORM_udata, FieldOffset >> 3);<br>
<br>
} else<br>
// This is not a bitfield.<br>
- addUInt(MemLocationDie, 0, dwarf::DW_FORM_udata, DT.getOffsetInBits() >> 3);<br>
+ addUInt(MemLocationDie, dwarf::DW_FORM_udata, DT.getOffsetInBits() >> 3);<br>
<br>
if (DT.getTag() == dwarf::DW_TAG_inheritance && DT.isVirtual()) {<br>
<br>
@@ -1823,17 +1837,17 @@ DIE *CompileUnit::createMemberDIE(DIDeri<br>
// BaseAddr = ObAddr + *((*ObAddr) - Offset)<br>
<br>
DIEBlock *VBaseLocationDie = new (DIEValueAllocator) DIEBlock();<br>
- addUInt(VBaseLocationDie, 0, dwarf::DW_FORM_data1, dwarf::DW_OP_dup);<br>
- addUInt(VBaseLocationDie, 0, dwarf::DW_FORM_data1, dwarf::DW_OP_deref);<br>
- addUInt(VBaseLocationDie, 0, dwarf::DW_FORM_data1, dwarf::DW_OP_constu);<br>
- addUInt(VBaseLocationDie, 0, dwarf::DW_FORM_udata, DT.getOffsetInBits());<br>
- addUInt(VBaseLocationDie, 0, dwarf::DW_FORM_data1, dwarf::DW_OP_minus);<br>
- addUInt(VBaseLocationDie, 0, dwarf::DW_FORM_data1, dwarf::DW_OP_deref);<br>
- addUInt(VBaseLocationDie, 0, dwarf::DW_FORM_data1, dwarf::DW_OP_plus);<br>
+ addUInt(VBaseLocationDie, dwarf::DW_FORM_data1, dwarf::DW_OP_dup);<br>
+ addUInt(VBaseLocationDie, dwarf::DW_FORM_data1, dwarf::DW_OP_deref);<br>
+ addUInt(VBaseLocationDie, dwarf::DW_FORM_data1, dwarf::DW_OP_constu);<br>
+ addUInt(VBaseLocationDie, dwarf::DW_FORM_udata, DT.getOffsetInBits());<br>
+ addUInt(VBaseLocationDie, dwarf::DW_FORM_data1, dwarf::DW_OP_minus);<br>
+ addUInt(VBaseLocationDie, dwarf::DW_FORM_data1, dwarf::DW_OP_deref);<br>
+ addUInt(VBaseLocationDie, dwarf::DW_FORM_data1, dwarf::DW_OP_plus);<br>
<br>
- addBlock(MemberDie, dwarf::DW_AT_data_member_location, 0, VBaseLocationDie);<br>
+ addBlock(MemberDie, dwarf::DW_AT_data_member_location, VBaseLocationDie);<br>
} else<br>
- addBlock(MemberDie, dwarf::DW_AT_data_member_location, 0, MemLocationDie);<br>
+ addBlock(MemberDie, dwarf::DW_AT_data_member_location, MemLocationDie);<br>
<br>
if (DT.isProtected())<br>
addUInt(MemberDie, dwarf::DW_AT_accessibility, dwarf::DW_FORM_data1,<br>
<br>
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h?rev=193091&r1=193090&r2=193091&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h?rev=193091&r1=193090&r2=193091&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h (original)<br>
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h Mon Oct 21 12:28:37 2013<br>
@@ -17,6 +17,7 @@<br>
#include "DIE.h"<br>
#include "DwarfDebug.h"<br>
#include "llvm/ADT/DenseMap.h"<br>
+#include "llvm/ADT/Optional.h"<br>
#include "llvm/ADT/OwningPtr.h"<br>
#include "llvm/ADT/StringMap.h"<br>
#include "llvm/DebugInfo.h"<br>
@@ -166,56 +167,63 @@ public:<br>
void addDie(DIE *Buffer) { CUDie->addChild(Buffer); }<br>
<br>
/// addFlag - Add a flag that is true to the DIE.<br>
- void addFlag(DIE *Die, uint16_t Attribute);<br>
+ void addFlag(DIE *Die, dwarf::Attribute Attribute);<br>
<br>
/// addUInt - Add an unsigned integer attribute data and value.<br>
///<br>
- void addUInt(DIE *Die, uint16_t Attribute, uint16_t Form, uint64_t Integer);<br>
+ void addUInt(DIE *Die, dwarf::Attribute Attribute, Optional<dwarf::Form> Form,<br>
+ uint64_t Integer);<br>
+<br>
+ void addUInt(DIEBlock *Block, dwarf::Form Form, uint64_t Integer);<br>
<br>
/// addSInt - Add an signed integer attribute data and value.<br>
///<br>
- void addSInt(DIE *Die, uint16_t Attribute, uint16_t Form, int64_t Integer);<br>
+ void addSInt(DIE *Die, dwarf::Attribute Attribute, Optional<dwarf::Form> Form,<br>
+ int64_t Integer);<br>
+<br>
+ void addSInt(DIEBlock *Die, Optional<dwarf::Form> Form, int64_t Integer);<br>
<br>
/// addString - Add a string attribute data and value.<br>
///<br>
- void addString(DIE *Die, uint16_t Attribute, const StringRef Str);<br>
+ void addString(DIE *Die, dwarf::Attribute Attribute, const StringRef Str);<br>
<br>
/// addLocalString - Add a string attribute data and value.<br>
///<br>
- void addLocalString(DIE *Die, uint16_t Attribute, const StringRef Str);<br>
+ void addLocalString(DIE *Die, dwarf::Attribute Attribute, const StringRef Str);<br>
<br>
/// addExpr - Add a Dwarf expression attribute data and value.<br>
///<br>
- void addExpr(DIE *Die, uint16_t Attribute, uint16_t Form, const MCExpr *Expr);<br>
+ void addExpr(DIEBlock *Die, dwarf::Form Form, const MCExpr *Expr);<br>
<br>
/// addLabel - Add a Dwarf label attribute data and value.<br>
///<br>
- void addLabel(DIE *Die, uint16_t Attribute, uint16_t Form,<br>
+ void addLabel(DIE *Die, dwarf::Attribute Attribute, dwarf::Form Form,<br>
const MCSymbol *Label);<br>
<br>
+ void addLabel(DIEBlock *Die, dwarf::Form Form, const MCSymbol *Label);<br>
+<br>
/// addLabelAddress - Add a dwarf label attribute data and value using<br>
/// either DW_FORM_addr or DW_FORM_GNU_addr_index.<br>
///<br>
- void addLabelAddress(DIE *Die, uint16_t Attribute, MCSymbol *Label);<br>
+ void addLabelAddress(DIE *Die, dwarf::Attribute Attribute, MCSymbol *Label);<br>
<br>
/// addOpAddress - Add a dwarf op address data and value using the<br>
/// form given and an op of either DW_FORM_addr or DW_FORM_GNU_addr_index.<br>
///<br>
- void addOpAddress(DIE *Die, const MCSymbol *Label);<br>
- void addOpAddress(DIE *Die, const MCSymbolRefExpr *Label);<br>
+ void addOpAddress(DIEBlock *Die, const MCSymbol *Label);<br>
<br>
/// addDelta - Add a label delta attribute data and value.<br>
///<br>
- void addDelta(DIE *Die, uint16_t Attribute, uint16_t Form, const MCSymbol *Hi,<br>
+ void addDelta(DIE *Die, dwarf::Attribute Attribute, dwarf::Form Form, const MCSymbol *Hi,<br>
const MCSymbol *Lo);<br>
<br>
/// addDIEEntry - Add a DIE attribute data and value.<br>
///<br>
- void addDIEEntry(DIE *Die, uint16_t Attribute, DIE *Entry);<br>
+ void addDIEEntry(DIE *Die, dwarf::Attribute Attribute, DIE *Entry);<br>
<br>
/// addBlock - Add block data.<br>
///<br>
- void addBlock(DIE *Die, uint16_t Attribute, uint16_t Form, DIEBlock *Block);<br>
+ void addBlock(DIE *Die, dwarf::Attribute Attribute, DIEBlock *Block);<br>
<br>
/// addSourceLine - Add location information to specified debug information<br>
/// entry.<br>
@@ -228,7 +236,7 @@ public:<br>
<br>
/// addAddress - Add an address attribute to a die based on the location<br>
/// provided.<br>
- void addAddress(DIE *Die, uint16_t Attribute, const MachineLocation &Location,<br>
+ void addAddress(DIE *Die, dwarf::Attribute Attribute, const MachineLocation &Location,<br>
bool Indirect = false);<br>
<br>
/// addConstantValue - Add constant value entry in variable DIE.<br>
@@ -244,17 +252,17 @@ public:<br>
void addTemplateParams(DIE &Buffer, DIArray TParams);<br>
<br>
/// addRegisterOp - Add register operand.<br>
- void addRegisterOp(DIE *TheDie, unsigned Reg);<br>
+ void addRegisterOp(DIEBlock *TheDie, unsigned Reg);<br>
<br>
/// addRegisterOffset - Add register offset.<br>
- void addRegisterOffset(DIE *TheDie, unsigned Reg, int64_t Offset);<br>
+ void addRegisterOffset(DIEBlock *TheDie, unsigned Reg, int64_t Offset);<br>
<br>
/// addComplexAddress - Start with the address based on the location provided,<br>
/// and generate the DWARF information necessary to find the actual variable<br>
/// (navigating the extra location information encoded in the type) based on<br>
/// the starting location. Add the DWARF information to the die.<br>
///<br>
- void addComplexAddress(const DbgVariable &DV, DIE *Die, uint16_t Attribute,<br>
+ void addComplexAddress(const DbgVariable &DV, DIE *Die, dwarf::Attribute Attribute,<br>
const MachineLocation &Location);<br>
<br>
// FIXME: Should be reformulated in terms of addComplexAddress.<br>
@@ -264,7 +272,7 @@ public:<br>
/// starting location. Add the DWARF information to the die. Obsolete,<br>
/// please use addComplexAddress instead.<br>
///<br>
- void addBlockByrefAddress(const DbgVariable &DV, DIE *Die, uint16_t Attribute,<br>
+ void addBlockByrefAddress(const DbgVariable &DV, DIE *Die, dwarf::Attribute Attribute,<br>
const MachineLocation &Location);<br>
<br>
/// addVariableAddress - Add DW_AT_location attribute for a<br>
@@ -278,7 +286,7 @@ public:<br>
/// addType - Add a new type attribute to the specified entity. This takes<br>
/// and attribute parameter because DW_AT_friend attributes are also<br>
/// type references.<br>
- void addType(DIE *Entity, DIType Ty, uint16_t Attribute = dwarf::DW_AT_type);<br>
+ void addType(DIE *Entity, DIType Ty, dwarf::Attribute Attribute = dwarf::DW_AT_type);<br>
<br>
/// getOrCreateNameSpace - Create a DIE for DINameSpace.<br>
DIE *getOrCreateNameSpace(DINameSpace NS);<br>
<br>
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=193091&r1=193090&r2=193091&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=193091&r1=193090&r2=193091&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original)<br>
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Mon Oct 21 12:28:37 2013<br>
@@ -558,10 +558,10 @@ DIE *DwarfDebug::constructInlinedScopeDI<br>
<br>
// Add the call site information to the DIE.<br>
DILocation DL(Scope->getInlinedAt());<br>
- TheCU->addUInt(ScopeDIE, dwarf::DW_AT_call_file, 0,<br>
+ TheCU->addUInt(ScopeDIE, dwarf::DW_AT_call_file, None,<br>
getOrCreateSourceID(DL.getFilename(), DL.getDirectory(),<br>
TheCU->getUniqueID()));<br>
- TheCU->addUInt(ScopeDIE, dwarf::DW_AT_call_line, 0, DL.getLineNumber());<br>
+ TheCU->addUInt(ScopeDIE, dwarf::DW_AT_call_line, None, DL.getLineNumber());<br>
<br>
// Add name to the name table, we do this here because we're guaranteed<br>
// to have concrete versions of our DW_TAG_inlined_subprogram nodes.<br>
@@ -886,8 +886,8 @@ void DwarfDebug::constructImportedEntity<br>
unsigned FileID = getOrCreateSourceID(Module.getContext().getFilename(),<br>
Module.getContext().getDirectory(),<br>
TheCU->getUniqueID());<br>
- TheCU->addUInt(IMDie, dwarf::DW_AT_decl_file, 0, FileID);<br>
- TheCU->addUInt(IMDie, dwarf::DW_AT_decl_line, 0, Module.getLineNumber());<br>
+ TheCU->addUInt(IMDie, dwarf::DW_AT_decl_file, None, FileID);<br>
+ TheCU->addUInt(IMDie, dwarf::DW_AT_decl_line, None, Module.getLineNumber());<br>
TheCU->addDIEEntry(IMDie, dwarf::DW_AT_import, EntityDie);<br>
StringRef Name = Module.getName();<br>
if (!Name.empty())<br>
@@ -955,14 +955,14 @@ void DwarfDebug::computeInlinedDIEs() {<br>
for (SmallPtrSet<DIE *, 4>::iterator AI = InlinedSubprogramDIEs.begin(),<br>
AE = InlinedSubprogramDIEs.end(); AI != AE; ++AI) {<br>
DIE *ISP = *AI;<br>
- FirstCU->addUInt(ISP, dwarf::DW_AT_inline, 0, dwarf::DW_INL_inlined);<br>
+ FirstCU->addUInt(ISP, dwarf::DW_AT_inline, None, dwarf::DW_INL_inlined);<br>
}<br>
for (DenseMap<const MDNode *, DIE *>::iterator AI = AbstractSPDies.begin(),<br>
AE = AbstractSPDies.end(); AI != AE; ++AI) {<br>
DIE *ISP = AI->second;<br>
if (InlinedSubprogramDIEs.count(ISP))<br>
continue;<br>
- FirstCU->addUInt(ISP, dwarf::DW_AT_inline, 0, dwarf::DW_INL_inlined);<br>
+ FirstCU->addUInt(ISP, dwarf::DW_AT_inline, None, dwarf::DW_INL_inlined);<br>
}<br>
}<br>
<br>
@@ -2047,8 +2047,8 @@ void DwarfDebug::emitDIE(DIE *Die, std::<br>
<br>
// Emit the DIE attribute values.<br>
for (unsigned i = 0, N = Values.size(); i < N; ++i) {<br>
- unsigned Attr = AbbrevData[i].getAttribute();<br>
- unsigned Form = AbbrevData[i].getForm();<br>
+ dwarf::Attribute Attr = AbbrevData[i].getAttribute();<br>
+ dwarf::Form Form = AbbrevData[i].getForm();<br>
assert(Form && "Too many attributes for DIE (check abbreviation)");<br>
<br>
if (Asm->isVerbose())<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div>Alexey Samsonov, MSK</div>
</div>