LLVM  mainline
Dwarf.h
Go to the documentation of this file.
00001 //===-- llvm/Support/Dwarf.h ---Dwarf Constants------------------*- C++ -*-===//
00002 //
00003 //                     The LLVM Compiler Infrastructure
00004 //
00005 // This file is distributed under the University of Illinois Open Source
00006 // License. See LICENSE.TXT for details.
00007 //
00008 //===----------------------------------------------------------------------===//
00009 //
00010 // \file
00011 // \brief This file contains constants used for implementing Dwarf
00012 // debug support.
00013 //
00014 // For details on the Dwarf specfication see the latest DWARF Debugging
00015 // Information Format standard document on http://www.dwarfstd.org. This
00016 // file often includes support for non-released standard features.
00017 //
00018 //===----------------------------------------------------------------------===//
00019 
00020 #ifndef LLVM_SUPPORT_DWARF_H
00021 #define LLVM_SUPPORT_DWARF_H
00022 
00023 #include "llvm/ADT/StringRef.h"
00024 #include "llvm/Support/Compiler.h"
00025 #include "llvm/Support/DataTypes.h"
00026 
00027 namespace llvm {
00028 
00029 namespace dwarf {
00030 
00031 //===----------------------------------------------------------------------===//
00032 // Dwarf constants as gleaned from the DWARF Debugging Information Format V.4
00033 // reference manual http://www.dwarfstd.org/.
00034 //
00035 
00036 // Do not mix the following two enumerations sets.  DW_TAG_invalid changes the
00037 // enumeration base type.
00038 
00039 enum LLVMConstants : uint32_t {
00040   // LLVM mock tags (see also llvm/Support/Dwarf.def).
00041   DW_TAG_invalid = ~0U,        // Tag for invalid results.
00042   DW_VIRTUALITY_invalid = ~0U, // Virtuality for invalid results.
00043 
00044   // Other constants.
00045   DWARF_VERSION = 4,       // Default dwarf version we output.
00046   DW_PUBTYPES_VERSION = 2, // Section version number for .debug_pubtypes.
00047   DW_PUBNAMES_VERSION = 2, // Section version number for .debug_pubnames.
00048   DW_ARANGES_VERSION = 2   // Section version number for .debug_aranges.
00049 };
00050 
00051 // Special ID values that distinguish a CIE from a FDE in DWARF CFI.
00052 // Not inside an enum because a 64-bit value is needed.
00053 const uint32_t DW_CIE_ID = UINT32_MAX;
00054 const uint64_t DW64_CIE_ID = UINT64_MAX;
00055 
00056 enum Tag : uint16_t {
00057 #define HANDLE_DW_TAG(ID, NAME) DW_TAG_##NAME = ID,
00058 #include "llvm/Support/Dwarf.def"
00059   DW_TAG_lo_user = 0x4080,
00060   DW_TAG_hi_user = 0xffff,
00061   DW_TAG_user_base = 0x1000 // Recommended base for user tags.
00062 };
00063 
00064 inline bool isType(Tag T) {
00065   switch (T) {
00066   case DW_TAG_array_type:
00067   case DW_TAG_class_type:
00068   case DW_TAG_interface_type:
00069   case DW_TAG_enumeration_type:
00070   case DW_TAG_pointer_type:
00071   case DW_TAG_reference_type:
00072   case DW_TAG_rvalue_reference_type:
00073   case DW_TAG_string_type:
00074   case DW_TAG_structure_type:
00075   case DW_TAG_subroutine_type:
00076   case DW_TAG_union_type:
00077   case DW_TAG_ptr_to_member_type:
00078   case DW_TAG_set_type:
00079   case DW_TAG_subrange_type:
00080   case DW_TAG_base_type:
00081   case DW_TAG_const_type:
00082   case DW_TAG_file_type:
00083   case DW_TAG_packed_type:
00084   case DW_TAG_volatile_type:
00085   case DW_TAG_typedef:
00086     return true;
00087   default:
00088     return false;
00089   }
00090 }
00091 
00092 enum Attribute : uint16_t {
00093   // Attributes
00094   DW_AT_sibling = 0x01,
00095   DW_AT_location = 0x02,
00096   DW_AT_name = 0x03,
00097   DW_AT_ordering = 0x09,
00098   DW_AT_byte_size = 0x0b,
00099   DW_AT_bit_offset = 0x0c,
00100   DW_AT_bit_size = 0x0d,
00101   DW_AT_stmt_list = 0x10,
00102   DW_AT_low_pc = 0x11,
00103   DW_AT_high_pc = 0x12,
00104   DW_AT_language = 0x13,
00105   DW_AT_discr = 0x15,
00106   DW_AT_discr_value = 0x16,
00107   DW_AT_visibility = 0x17,
00108   DW_AT_import = 0x18,
00109   DW_AT_string_length = 0x19,
00110   DW_AT_common_reference = 0x1a,
00111   DW_AT_comp_dir = 0x1b,
00112   DW_AT_const_value = 0x1c,
00113   DW_AT_containing_type = 0x1d,
00114   DW_AT_default_value = 0x1e,
00115   DW_AT_inline = 0x20,
00116   DW_AT_is_optional = 0x21,
00117   DW_AT_lower_bound = 0x22,
00118   DW_AT_producer = 0x25,
00119   DW_AT_prototyped = 0x27,
00120   DW_AT_return_addr = 0x2a,
00121   DW_AT_start_scope = 0x2c,
00122   DW_AT_bit_stride = 0x2e,
00123   DW_AT_upper_bound = 0x2f,
00124   DW_AT_abstract_origin = 0x31,
00125   DW_AT_accessibility = 0x32,
00126   DW_AT_address_class = 0x33,
00127   DW_AT_artificial = 0x34,
00128   DW_AT_base_types = 0x35,
00129   DW_AT_calling_convention = 0x36,
00130   DW_AT_count = 0x37,
00131   DW_AT_data_member_location = 0x38,
00132   DW_AT_decl_column = 0x39,
00133   DW_AT_decl_file = 0x3a,
00134   DW_AT_decl_line = 0x3b,
00135   DW_AT_declaration = 0x3c,
00136   DW_AT_discr_list = 0x3d,
00137   DW_AT_encoding = 0x3e,
00138   DW_AT_external = 0x3f,
00139   DW_AT_frame_base = 0x40,
00140   DW_AT_friend = 0x41,
00141   DW_AT_identifier_case = 0x42,
00142   DW_AT_macro_info = 0x43,
00143   DW_AT_namelist_item = 0x44,
00144   DW_AT_priority = 0x45,
00145   DW_AT_segment = 0x46,
00146   DW_AT_specification = 0x47,
00147   DW_AT_static_link = 0x48,
00148   DW_AT_type = 0x49,
00149   DW_AT_use_location = 0x4a,
00150   DW_AT_variable_parameter = 0x4b,
00151   DW_AT_virtuality = 0x4c,
00152   DW_AT_vtable_elem_location = 0x4d,
00153   DW_AT_allocated = 0x4e,
00154   DW_AT_associated = 0x4f,
00155   DW_AT_data_location = 0x50,
00156   DW_AT_byte_stride = 0x51,
00157   DW_AT_entry_pc = 0x52,
00158   DW_AT_use_UTF8 = 0x53,
00159   DW_AT_extension = 0x54,
00160   DW_AT_ranges = 0x55,
00161   DW_AT_trampoline = 0x56,
00162   DW_AT_call_column = 0x57,
00163   DW_AT_call_file = 0x58,
00164   DW_AT_call_line = 0x59,
00165   DW_AT_description = 0x5a,
00166   DW_AT_binary_scale = 0x5b,
00167   DW_AT_decimal_scale = 0x5c,
00168   DW_AT_small = 0x5d,
00169   DW_AT_decimal_sign = 0x5e,
00170   DW_AT_digit_count = 0x5f,
00171   DW_AT_picture_string = 0x60,
00172   DW_AT_mutable = 0x61,
00173   DW_AT_threads_scaled = 0x62,
00174   DW_AT_explicit = 0x63,
00175   DW_AT_object_pointer = 0x64,
00176   DW_AT_endianity = 0x65,
00177   DW_AT_elemental = 0x66,
00178   DW_AT_pure = 0x67,
00179   DW_AT_recursive = 0x68,
00180   DW_AT_signature = 0x69,
00181   DW_AT_main_subprogram = 0x6a,
00182   DW_AT_data_bit_offset = 0x6b,
00183   DW_AT_const_expr = 0x6c,
00184   DW_AT_enum_class = 0x6d,
00185   DW_AT_linkage_name = 0x6e,
00186 
00187   // New in DWARF 5:
00188   DW_AT_string_length_bit_size = 0x6f,
00189   DW_AT_string_length_byte_size = 0x70,
00190   DW_AT_rank = 0x71,
00191   DW_AT_str_offsets_base = 0x72,
00192   DW_AT_addr_base = 0x73,
00193   DW_AT_ranges_base = 0x74,
00194   DW_AT_dwo_id = 0x75,
00195   DW_AT_dwo_name = 0x76,
00196   DW_AT_reference = 0x77,
00197   DW_AT_rvalue_reference = 0x78,
00198 
00199   DW_AT_lo_user = 0x2000,
00200   DW_AT_hi_user = 0x3fff,
00201 
00202   DW_AT_MIPS_loop_begin = 0x2002,
00203   DW_AT_MIPS_tail_loop_begin = 0x2003,
00204   DW_AT_MIPS_epilog_begin = 0x2004,
00205   DW_AT_MIPS_loop_unroll_factor = 0x2005,
00206   DW_AT_MIPS_software_pipeline_depth = 0x2006,
00207   DW_AT_MIPS_linkage_name = 0x2007,
00208   DW_AT_MIPS_stride = 0x2008,
00209   DW_AT_MIPS_abstract_name = 0x2009,
00210   DW_AT_MIPS_clone_origin = 0x200a,
00211   DW_AT_MIPS_has_inlines = 0x200b,
00212   DW_AT_MIPS_stride_byte = 0x200c,
00213   DW_AT_MIPS_stride_elem = 0x200d,
00214   DW_AT_MIPS_ptr_dopetype = 0x200e,
00215   DW_AT_MIPS_allocatable_dopetype = 0x200f,
00216   DW_AT_MIPS_assumed_shape_dopetype = 0x2010,
00217 
00218   // This one appears to have only been implemented by Open64 for
00219   // fortran and may conflict with other extensions.
00220   DW_AT_MIPS_assumed_size = 0x2011,
00221 
00222   // GNU extensions
00223   DW_AT_sf_names = 0x2101,
00224   DW_AT_src_info = 0x2102,
00225   DW_AT_mac_info = 0x2103,
00226   DW_AT_src_coords = 0x2104,
00227   DW_AT_body_begin = 0x2105,
00228   DW_AT_body_end = 0x2106,
00229   DW_AT_GNU_vector = 0x2107,
00230   DW_AT_GNU_template_name = 0x2110,
00231 
00232   DW_AT_GNU_odr_signature = 0x210f,
00233 
00234   // Extensions for Fission proposal.
00235   DW_AT_GNU_dwo_name = 0x2130,
00236   DW_AT_GNU_dwo_id = 0x2131,
00237   DW_AT_GNU_ranges_base = 0x2132,
00238   DW_AT_GNU_addr_base = 0x2133,
00239   DW_AT_GNU_pubnames = 0x2134,
00240   DW_AT_GNU_pubtypes = 0x2135,
00241 
00242   // Apple extensions.
00243   DW_AT_APPLE_optimized = 0x3fe1,
00244   DW_AT_APPLE_flags = 0x3fe2,
00245   DW_AT_APPLE_isa = 0x3fe3,
00246   DW_AT_APPLE_block = 0x3fe4,
00247   DW_AT_APPLE_major_runtime_vers = 0x3fe5,
00248   DW_AT_APPLE_runtime_class = 0x3fe6,
00249   DW_AT_APPLE_omit_frame_ptr = 0x3fe7,
00250   DW_AT_APPLE_property_name = 0x3fe8,
00251   DW_AT_APPLE_property_getter = 0x3fe9,
00252   DW_AT_APPLE_property_setter = 0x3fea,
00253   DW_AT_APPLE_property_attribute = 0x3feb,
00254   DW_AT_APPLE_objc_complete_type = 0x3fec,
00255   DW_AT_APPLE_property = 0x3fed
00256 };
00257 
00258 enum Form : uint16_t {
00259   // Attribute form encodings
00260   DW_FORM_addr = 0x01,
00261   DW_FORM_block2 = 0x03,
00262   DW_FORM_block4 = 0x04,
00263   DW_FORM_data2 = 0x05,
00264   DW_FORM_data4 = 0x06,
00265   DW_FORM_data8 = 0x07,
00266   DW_FORM_string = 0x08,
00267   DW_FORM_block = 0x09,
00268   DW_FORM_block1 = 0x0a,
00269   DW_FORM_data1 = 0x0b,
00270   DW_FORM_flag = 0x0c,
00271   DW_FORM_sdata = 0x0d,
00272   DW_FORM_strp = 0x0e,
00273   DW_FORM_udata = 0x0f,
00274   DW_FORM_ref_addr = 0x10,
00275   DW_FORM_ref1 = 0x11,
00276   DW_FORM_ref2 = 0x12,
00277   DW_FORM_ref4 = 0x13,
00278   DW_FORM_ref8 = 0x14,
00279   DW_FORM_ref_udata = 0x15,
00280   DW_FORM_indirect = 0x16,
00281   DW_FORM_sec_offset = 0x17,
00282   DW_FORM_exprloc = 0x18,
00283   DW_FORM_flag_present = 0x19,
00284   DW_FORM_ref_sig8 = 0x20,
00285 
00286   // Extensions for Fission proposal
00287   DW_FORM_GNU_addr_index = 0x1f01,
00288   DW_FORM_GNU_str_index = 0x1f02,
00289 
00290   // Alternate debug sections proposal (output of "dwz" tool).
00291   DW_FORM_GNU_ref_alt = 0x1f20,
00292   DW_FORM_GNU_strp_alt = 0x1f21
00293 };
00294 
00295 enum LocationAtom {
00296 #define HANDLE_DW_OP(ID, NAME) DW_OP_##NAME = ID,
00297 #include "llvm/Support/Dwarf.def"
00298   DW_OP_lo_user = 0xe0,
00299   DW_OP_hi_user = 0xff
00300 };
00301 
00302 enum TypeKind {
00303 #define HANDLE_DW_ATE(ID, NAME) DW_ATE_##NAME = ID,
00304 #include "llvm/Support/Dwarf.def"
00305   DW_ATE_lo_user = 0x80,
00306   DW_ATE_hi_user = 0xff
00307 };
00308 
00309 enum DecimalSignEncoding {
00310   // Decimal sign attribute values
00311   DW_DS_unsigned = 0x01,
00312   DW_DS_leading_overpunch = 0x02,
00313   DW_DS_trailing_overpunch = 0x03,
00314   DW_DS_leading_separate = 0x04,
00315   DW_DS_trailing_separate = 0x05
00316 };
00317 
00318 enum EndianityEncoding {
00319   // Endianity attribute values
00320   DW_END_default = 0x00,
00321   DW_END_big = 0x01,
00322   DW_END_little = 0x02,
00323   DW_END_lo_user = 0x40,
00324   DW_END_hi_user = 0xff
00325 };
00326 
00327 enum AccessAttribute {
00328   // Accessibility codes
00329   DW_ACCESS_public = 0x01,
00330   DW_ACCESS_protected = 0x02,
00331   DW_ACCESS_private = 0x03
00332 };
00333 
00334 enum VisibilityAttribute {
00335   // Visibility codes
00336   DW_VIS_local = 0x01,
00337   DW_VIS_exported = 0x02,
00338   DW_VIS_qualified = 0x03
00339 };
00340 
00341 enum VirtualityAttribute {
00342 #define HANDLE_DW_VIRTUALITY(ID, NAME) DW_VIRTUALITY_##NAME = ID,
00343 #include "llvm/Support/Dwarf.def"
00344   DW_VIRTUALITY_max = 0x02
00345 };
00346 
00347 enum SourceLanguage {
00348 #define HANDLE_DW_LANG(ID, NAME) DW_LANG_##NAME = ID,
00349 #include "llvm/Support/Dwarf.def"
00350   DW_LANG_lo_user = 0x8000,
00351   DW_LANG_hi_user = 0xffff
00352 };
00353 
00354 enum CaseSensitivity {
00355   // Identifier case codes
00356   DW_ID_case_sensitive = 0x00,
00357   DW_ID_up_case = 0x01,
00358   DW_ID_down_case = 0x02,
00359   DW_ID_case_insensitive = 0x03
00360 };
00361 
00362 enum CallingConvention {
00363   // Calling convention codes
00364   DW_CC_normal = 0x01,
00365   DW_CC_program = 0x02,
00366   DW_CC_nocall = 0x03,
00367   DW_CC_lo_user = 0x40,
00368   DW_CC_hi_user = 0xff
00369 };
00370 
00371 enum InlineAttribute {
00372   // Inline codes
00373   DW_INL_not_inlined = 0x00,
00374   DW_INL_inlined = 0x01,
00375   DW_INL_declared_not_inlined = 0x02,
00376   DW_INL_declared_inlined = 0x03
00377 };
00378 
00379 enum ArrayDimensionOrdering {
00380   // Array ordering
00381   DW_ORD_row_major = 0x00,
00382   DW_ORD_col_major = 0x01
00383 };
00384 
00385 enum DiscriminantList {
00386   // Discriminant descriptor values
00387   DW_DSC_label = 0x00,
00388   DW_DSC_range = 0x01
00389 };
00390 
00391 enum LineNumberOps {
00392   // Line Number Standard Opcode Encodings
00393   DW_LNS_extended_op = 0x00,
00394   DW_LNS_copy = 0x01,
00395   DW_LNS_advance_pc = 0x02,
00396   DW_LNS_advance_line = 0x03,
00397   DW_LNS_set_file = 0x04,
00398   DW_LNS_set_column = 0x05,
00399   DW_LNS_negate_stmt = 0x06,
00400   DW_LNS_set_basic_block = 0x07,
00401   DW_LNS_const_add_pc = 0x08,
00402   DW_LNS_fixed_advance_pc = 0x09,
00403   DW_LNS_set_prologue_end = 0x0a,
00404   DW_LNS_set_epilogue_begin = 0x0b,
00405   DW_LNS_set_isa = 0x0c
00406 };
00407 
00408 enum LineNumberExtendedOps {
00409   // Line Number Extended Opcode Encodings
00410   DW_LNE_end_sequence = 0x01,
00411   DW_LNE_set_address = 0x02,
00412   DW_LNE_define_file = 0x03,
00413   DW_LNE_set_discriminator = 0x04,
00414   DW_LNE_lo_user = 0x80,
00415   DW_LNE_hi_user = 0xff
00416 };
00417 
00418 enum MacinfoRecordType {
00419   // Macinfo Type Encodings
00420   DW_MACINFO_define = 0x01,
00421   DW_MACINFO_undef = 0x02,
00422   DW_MACINFO_start_file = 0x03,
00423   DW_MACINFO_end_file = 0x04,
00424   DW_MACINFO_vendor_ext = 0xff
00425 };
00426 
00427 enum CallFrameInfo {
00428   // Call frame instruction encodings
00429   DW_CFA_extended = 0x00,
00430   DW_CFA_nop = 0x00,
00431   DW_CFA_advance_loc = 0x40,
00432   DW_CFA_offset = 0x80,
00433   DW_CFA_restore = 0xc0,
00434   DW_CFA_set_loc = 0x01,
00435   DW_CFA_advance_loc1 = 0x02,
00436   DW_CFA_advance_loc2 = 0x03,
00437   DW_CFA_advance_loc4 = 0x04,
00438   DW_CFA_offset_extended = 0x05,
00439   DW_CFA_restore_extended = 0x06,
00440   DW_CFA_undefined = 0x07,
00441   DW_CFA_same_value = 0x08,
00442   DW_CFA_register = 0x09,
00443   DW_CFA_remember_state = 0x0a,
00444   DW_CFA_restore_state = 0x0b,
00445   DW_CFA_def_cfa = 0x0c,
00446   DW_CFA_def_cfa_register = 0x0d,
00447   DW_CFA_def_cfa_offset = 0x0e,
00448   DW_CFA_def_cfa_expression = 0x0f,
00449   DW_CFA_expression = 0x10,
00450   DW_CFA_offset_extended_sf = 0x11,
00451   DW_CFA_def_cfa_sf = 0x12,
00452   DW_CFA_def_cfa_offset_sf = 0x13,
00453   DW_CFA_val_offset = 0x14,
00454   DW_CFA_val_offset_sf = 0x15,
00455   DW_CFA_val_expression = 0x16,
00456   DW_CFA_MIPS_advance_loc8 = 0x1d,
00457   DW_CFA_GNU_window_save = 0x2d,
00458   DW_CFA_GNU_args_size = 0x2e,
00459   DW_CFA_lo_user = 0x1c,
00460   DW_CFA_hi_user = 0x3f
00461 };
00462 
00463 enum Constants {
00464   // Children flag
00465   DW_CHILDREN_no = 0x00,
00466   DW_CHILDREN_yes = 0x01,
00467 
00468   DW_EH_PE_absptr = 0x00,
00469   DW_EH_PE_omit = 0xff,
00470   DW_EH_PE_uleb128 = 0x01,
00471   DW_EH_PE_udata2 = 0x02,
00472   DW_EH_PE_udata4 = 0x03,
00473   DW_EH_PE_udata8 = 0x04,
00474   DW_EH_PE_sleb128 = 0x09,
00475   DW_EH_PE_sdata2 = 0x0A,
00476   DW_EH_PE_sdata4 = 0x0B,
00477   DW_EH_PE_sdata8 = 0x0C,
00478   DW_EH_PE_signed = 0x08,
00479   DW_EH_PE_pcrel = 0x10,
00480   DW_EH_PE_textrel = 0x20,
00481   DW_EH_PE_datarel = 0x30,
00482   DW_EH_PE_funcrel = 0x40,
00483   DW_EH_PE_aligned = 0x50,
00484   DW_EH_PE_indirect = 0x80
00485 };
00486 
00487 // Constants for debug_loc.dwo in the DWARF5 Split Debug Info Proposal
00488 enum LocationListEntry : unsigned char {
00489   DW_LLE_end_of_list_entry,
00490   DW_LLE_base_address_selection_entry,
00491   DW_LLE_start_end_entry,
00492   DW_LLE_start_length_entry,
00493   DW_LLE_offset_pair_entry
00494 };
00495 
00496 /// Contstants for the DW_APPLE_PROPERTY_attributes attribute.
00497 /// Keep this list in sync with clang's DeclSpec.h ObjCPropertyAttributeKind.
00498 enum ApplePropertyAttributes {
00499   // Apple Objective-C Property Attributes
00500   DW_APPLE_PROPERTY_readonly = 0x01,
00501   DW_APPLE_PROPERTY_getter = 0x02,
00502   DW_APPLE_PROPERTY_assign = 0x04,
00503   DW_APPLE_PROPERTY_readwrite = 0x08,
00504   DW_APPLE_PROPERTY_retain = 0x10,
00505   DW_APPLE_PROPERTY_copy = 0x20,
00506   DW_APPLE_PROPERTY_nonatomic = 0x40,
00507   DW_APPLE_PROPERTY_setter = 0x80,
00508   DW_APPLE_PROPERTY_atomic = 0x100,
00509   DW_APPLE_PROPERTY_weak =   0x200,
00510   DW_APPLE_PROPERTY_strong = 0x400,
00511   DW_APPLE_PROPERTY_unsafe_unretained = 0x800
00512 };
00513 
00514 // Constants for the DWARF5 Accelerator Table Proposal
00515 enum AcceleratorTable {
00516   // Data layout descriptors.
00517   DW_ATOM_null = 0u,       // Marker as the end of a list of atoms.
00518   DW_ATOM_die_offset = 1u, // DIE offset in the debug_info section.
00519   DW_ATOM_cu_offset = 2u, // Offset of the compile unit header that contains the
00520                           // item in question.
00521   DW_ATOM_die_tag = 3u,   // A tag entry.
00522   DW_ATOM_type_flags = 4u, // Set of flags for a type.
00523 
00524   // DW_ATOM_type_flags values.
00525 
00526   // Always set for C++, only set for ObjC if this is the @implementation for a
00527   // class.
00528   DW_FLAG_type_implementation = 2u,
00529 
00530   // Hash functions.
00531 
00532   // Daniel J. Bernstein hash.
00533   DW_hash_function_djb = 0u
00534 };
00535 
00536 // Constants for the GNU pubnames/pubtypes extensions supporting gdb index.
00537 enum GDBIndexEntryKind {
00538   GIEK_NONE,
00539   GIEK_TYPE,
00540   GIEK_VARIABLE,
00541   GIEK_FUNCTION,
00542   GIEK_OTHER,
00543   GIEK_UNUSED5,
00544   GIEK_UNUSED6,
00545   GIEK_UNUSED7
00546 };
00547 
00548 enum GDBIndexEntryLinkage {
00549   GIEL_EXTERNAL,
00550   GIEL_STATIC
00551 };
00552 
00553 /// \defgroup DwarfConstantsDumping Dwarf constants dumping functions
00554 ///
00555 /// All these functions map their argument's value back to the
00556 /// corresponding enumerator name or return nullptr if the value isn't
00557 /// known.
00558 ///
00559 /// @{
00560 const char *TagString(unsigned Tag);
00561 const char *ChildrenString(unsigned Children);
00562 const char *AttributeString(unsigned Attribute);
00563 const char *FormEncodingString(unsigned Encoding);
00564 const char *OperationEncodingString(unsigned Encoding);
00565 const char *AttributeEncodingString(unsigned Encoding);
00566 const char *DecimalSignString(unsigned Sign);
00567 const char *EndianityString(unsigned Endian);
00568 const char *AccessibilityString(unsigned Access);
00569 const char *VisibilityString(unsigned Visibility);
00570 const char *VirtualityString(unsigned Virtuality);
00571 const char *LanguageString(unsigned Language);
00572 const char *CaseString(unsigned Case);
00573 const char *ConventionString(unsigned Convention);
00574 const char *InlineCodeString(unsigned Code);
00575 const char *ArrayOrderString(unsigned Order);
00576 const char *DiscriminantString(unsigned Discriminant);
00577 const char *LNStandardString(unsigned Standard);
00578 const char *LNExtendedString(unsigned Encoding);
00579 const char *MacinfoString(unsigned Encoding);
00580 const char *CallFrameString(unsigned Encoding);
00581 const char *ApplePropertyString(unsigned);
00582 const char *AtomTypeString(unsigned Atom);
00583 const char *GDBIndexEntryKindString(GDBIndexEntryKind Kind);
00584 const char *GDBIndexEntryLinkageString(GDBIndexEntryLinkage Linkage);
00585 /// @}
00586 
00587 /// \defgroup DwarfConstantsParsing Dwarf constants parsing functions
00588 ///
00589 /// These functions map their strings back to the corresponding enumeration
00590 /// value or return 0 if there is none, except for these exceptions:
00591 ///
00592 /// \li \a getTag() returns \a DW_TAG_invalid on invalid input.
00593 /// \li \a getVirtuality() returns \a DW_VIRTUALITY_invalid on invalid input.
00594 ///
00595 /// @{
00596 unsigned getTag(StringRef TagString);
00597 unsigned getOperationEncoding(StringRef OperationEncodingString);
00598 unsigned getVirtuality(StringRef VirtualityString);
00599 unsigned getLanguage(StringRef LanguageString);
00600 unsigned getAttributeEncoding(StringRef EncodingString);
00601 /// @}
00602 
00603 /// \brief Returns the symbolic string representing Val when used as a value
00604 /// for attribute Attr.
00605 const char *AttributeValueString(uint16_t Attr, unsigned Val);
00606 
00607 /// \brief Decsribes an entry of the various gnu_pub* debug sections.
00608 /// 
00609 /// The gnu_pub* kind looks like:
00610 ///
00611 /// 0-3  reserved
00612 /// 4-6  symbol kind
00613 /// 7    0 == global, 1 == static
00614 ///
00615 /// A gdb_index descriptor includes the above kind, shifted 24 bits up with the
00616 /// offset of the cu within the debug_info section stored in those 24 bits.
00617 struct PubIndexEntryDescriptor {
00618   GDBIndexEntryKind Kind;
00619   GDBIndexEntryLinkage Linkage;
00620   PubIndexEntryDescriptor(GDBIndexEntryKind Kind, GDBIndexEntryLinkage Linkage)
00621       : Kind(Kind), Linkage(Linkage) {}
00622   /* implicit */ PubIndexEntryDescriptor(GDBIndexEntryKind Kind)
00623       : Kind(Kind), Linkage(GIEL_EXTERNAL) {}
00624   explicit PubIndexEntryDescriptor(uint8_t Value)
00625       : Kind(static_cast<GDBIndexEntryKind>((Value & KIND_MASK) >>
00626                                             KIND_OFFSET)),
00627         Linkage(static_cast<GDBIndexEntryLinkage>((Value & LINKAGE_MASK) >>
00628                                                   LINKAGE_OFFSET)) {}
00629   uint8_t toBits() { return Kind << KIND_OFFSET | Linkage << LINKAGE_OFFSET; }
00630 
00631 private:
00632   enum {
00633     KIND_OFFSET = 4,
00634     KIND_MASK = 7 << KIND_OFFSET,
00635     LINKAGE_OFFSET = 7,
00636     LINKAGE_MASK = 1 << LINKAGE_OFFSET
00637   };
00638 };
00639 
00640 
00641 } // End of namespace dwarf
00642 
00643 } // End of namespace llvm
00644 
00645 #endif