Open64 (mfef90, whirl2f, and IR tools)
TAG: version-openad; SVN changeset: 916
|
00001 /* 00002 * Copyright 2004 PathScale, Inc. All Rights Reserved. 00003 */ 00004 00005 /* 00006 00007 Copyright (C) 2000, 2001 Silicon Graphics, Inc. All Rights Reserved. 00008 00009 This program is free software; you can redistribute it and/or modify it 00010 under the terms of version 2 of the GNU General Public License as 00011 published by the Free Software Foundation. 00012 00013 This program is distributed in the hope that it would be useful, but 00014 WITHOUT ANY WARRANTY; without even the implied warranty of 00015 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 00016 00017 Further, this software is distributed without any warranty that it is 00018 free of the rightful claim of any third person regarding infringement 00019 or the like. Any license provided herein, whether implied or 00020 otherwise, applies only to this software file. Patent licenses, if 00021 any, provided herein do not apply to combinations of this program with 00022 other software, or any other product whatsoever. 00023 00024 You should have received a copy of the GNU General Public License along 00025 with this program; if not, write the Free Software Foundation, Inc., 59 00026 Temple Place - Suite 330, Boston MA 02111-1307, USA. 00027 00028 Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pky, 00029 Mountain View, CA 94043, or: 00030 00031 http://www.sgi.com 00032 00033 For further information regarding this notice, see: 00034 00035 http://oss.sgi.com/projects/GenInfo/NoticeExplan 00036 00037 */ 00038 00039 00040 #ifndef dwarf_DST_producer_INCLUDED 00041 #define dwarf_DST_producer_INCLUDED 00042 00043 /* ==================================================================== 00044 * ==================================================================== 00045 * 00046 * 00047 * Revision history: 00048 * 25-Apr-93 - Original Version 00049 * 00050 * Description: 00051 * 00052 * The interface to be used for generation of debugging information 00053 * by the front-end, where the resulting information is used by the 00054 * back-end (see dwarf_DST_consumer.h) to generate dwarf debugging 00055 * sections in the object code. Note that we currently only generate 00056 * the C specific DST_INFO forms, i.e. some of the forms of DST_INFO 00057 * entries defined in "dwarf_DST.h" are not currently generated (e.g. 00058 * DW_TAG_constant entries). This interface may be enhanced to also 00059 * support other languages, such as C++ and Fortran. 00060 * ==================================================================== 00061 * ==================================================================== 00062 */ 00063 00064 00065 #ifdef _KEEP_RCS_ID 00066 #endif /* _KEEP_RCS_ID */ 00067 00068 00069 #include "dwarf_DST.h" 00070 00071 #ifdef __cplusplus 00072 extern "C" { 00073 #endif 00074 00075 /*-------------------------- 00076 * Initiation & Finalization 00077 *---------------------------*/ 00078 00079 00080 /* Must be called first! Initiates the memory system used to hold 00081 * DST structures. 00082 */ 00083 extern void DST_init_mem(void); 00084 00085 00086 00087 /* Must be called last! Writes all blocks in memory to the .B file 00088 * and resets the memory system. 00089 */ 00090 extern void DST_final_write(void); 00091 00092 00093 /*----------------------------------------------------------- 00094 * Creation of ordered list of directories for include files 00095 *-----------------------------------------------------------*/ 00096 00097 00098 /* The entries will be listed in the order in which they are created. 00099 */ 00100 extern DST_DIR_IDX DST_mk_include_dir(char *path); 00101 00102 00103 /* The number of include directories entered thus far. 00104 */ 00105 extern mUINT16 DST_number_of_include_dirs(void); 00106 00107 00108 /*--------------------------------------- 00109 * Creation of ordered listof file_names 00110 *---------------------------------------*/ 00111 00112 00113 /* The entries will be listed in the order in which they are created. 00114 * The incl_dir is the ordinal position of the dir in the include_dirs 00115 * list, the size is in bytes (zero if abscent), the modt is the last 00116 * modification time (e.g. a time_t from <sys/time.h>). 00117 * Returns the ordinal position of the file-name in the list 00118 * of file-names. 00119 */ 00120 extern DST_FILE_IDX DST_mk_file_name(char *file_name, 00121 mUINT16 incl_dir, 00122 UINT64 size, 00123 UINT64 modt); 00124 00125 00126 /* The number of file_names entered thus far. 00127 */ 00128 extern mUINT16 DST_number_of_files(void); 00129 00130 00131 /*------------------------------------------------ 00132 * Creation of .debug_macinfo section information 00133 *------------------------------------------------*/ 00134 00135 /* To be done! */ 00136 00137 00138 /*--------------------------------------------- 00139 * Creation of .debug_info section information 00140 *---------------------------------------------*/ 00141 00142 /* The first two routines will force all new info entries to be 00143 * allocated in the file_scope memory region. Take care not to call 00144 * DST_begin_PU() or DST_end_PU() while a lock is in effect. A call 00145 * to DST_begin_PU() will not take effect until the lock to file_scope 00146 * memory is released, and a call to DST_end_PU() may not end the 00147 * PU memory region if it is followed by a release of this lock. Use 00148 * the next three routines to handle situations where it becomes 00149 * necessary temporarily to reset all locks. 00150 */ 00151 extern void DST_lock_to_file_scope_mem(void); 00152 extern void DST_release_from_file_scope_mem(void); 00153 00154 extern mINT32 DST_unwind_locks(void); 00155 extern void DST_wind_up_locks(mINT32 number_of_locks); 00156 extern BOOL DST_is_locked_to_file_scope_mem(void); 00157 00158 00159 /* Creates a DW_TAG_compile_unit node and must be called before creating 00160 * any nodes for file_scope decls/defs. Thus, this is the first 00161 * information recorded for the .debug_info section of the object file. 00162 * "src_path" is the relative or full path to the primary source file, 00163 * "comp_dir" is the current working directory when the compilation 00164 * command was issued, "comp_info" is information about the version of 00165 * compiler used, and "language" is a DW_LANG code (see dwarf.h). 00166 * Returns an index to the created DW_TAG_compile_unit entry. 00167 */ 00168 extern DST_INFO_IDX DST_mk_compile_unit(char *src_path, 00169 char *comp_dir, 00170 char *comp_info, 00171 DST_language language, 00172 DST_identifier_case id_case); 00173 00174 00175 00176 /* Must be called to allow memory allocation on a program unit (PU) 00177 * basis in the back-end. Will start a new memory region with the 00178 * subsequent _mk_. No nesting of PUs are allowed. When all entries 00179 * for the PU have been made, return to earlier memory region by 00180 * calling "DST_end_PU()". 00181 */ 00182 extern void DST_begin_PU(void); 00183 00184 00185 extern DST_STR_IDX DST_mk_string(const char *s); 00186 00187 00188 /* Must be called after all symbols local to a PU have been created 00189 * and before any more file-scope symbols are created. 00190 */ 00191 extern void DST_end_PU(void); 00192 00193 00194 00195 /* Creates a DW_TAG_inlined_subroutine entry and returns its idx. 00196 */ 00197 extern DST_INFO_IDX 00198 DST_mk_inlined_subroutine(void * low_pc, 00199 void * high_pc, 00200 DST_INFO_IDX abstract_origin); 00201 00202 00203 /* Creates a DW_TAG_subprogram entry and returns its idx. 00204 */ 00205 extern DST_INFO_IDX 00206 DST_mk_subprogram_memdef(USRCPOS decl, /* Source location */ 00207 void *subpr, /* front-end routine */ 00208 BOOL is_prototyped, 00209 DST_INFO_IDX spec); /* decl in class */ 00210 00211 00212 /* Creates a DW_TAG_subprogram entry and returns its idx 00213 * (for a regular declaration/definition). 00214 */ 00215 extern DST_INFO_IDX 00216 DST_mk_subprogram(USRCPOS decl, 00217 char *name, 00218 DST_INFO_IDX type, 00219 DST_INFO_IDX origin, 00220 void *subpr, /* front-end routine */ 00221 DST_inline inlin, 00222 DST_virtuality virtuality, 00223 DST_vtable_elem_location vtable_elem_location, 00224 BOOL is_declaration, 00225 BOOL is_prototyped, 00226 BOOL is_artificial, 00227 BOOL is_external); 00228 00229 /* Adds a pubname pseudo-attribute to the given subprogram. Called for C++ 00230 * member functions whose name in pubnames is class::function 00231 */ 00232 extern void 00233 DST_add_pubname_to_subprogram (DST_INFO_IDX subprogram, 00234 char *pubname); 00235 00236 /* Adds a linkage_name (i.e. a mangled name) attribute to the given 00237 * subprogram. Called for C++ functions. 00238 */ 00239 extern void 00240 DST_add_linkage_name_to_subprogram(DST_INFO_IDX subprogram, 00241 char *linkage_name); 00242 00243 00244 /* Adds a DW_AT_specification attribute linking the body definition of a 00245 * member function to its definition within a class. 00246 */ 00247 extern void 00248 DST_add_specification_to_subprogram (DST_INFO_IDX subprogram_def, 00249 DST_INFO_IDX subprogram_decl); 00250 00251 /* Adds a DW_AT specification attribute linking the definition of a static 00252 * member variable to its declaration within a class. 00253 */ 00254 extern void 00255 DST_add_specification_to_variable (DST_INFO_IDX variable_def, 00256 DST_INFO_IDX field_decl); 00257 00258 /* Adds a linkage_name (i.e. a mangled name) attribute to the given 00259 * subprogram. Called for C++ functions. 00260 */ 00261 extern void 00262 DST_add_linkage_name_to_variable(DST_INFO_IDX variable_def, 00263 char *linkage_name); 00264 00265 /* Creates a DW_TAG_entry_point and returns its idx 00266 * (Fortran specific) 00267 */ 00268 extern DST_INFO_IDX 00269 DST_mk_entry_point(USRCPOS decl, 00270 char *name, 00271 DST_INFO_IDX type, 00272 void *subpr); /* front-end routine */ 00273 00274 00275 /* create a DW_TAG_common_block entry and return its index 00276 * 00277 */ 00278 DST_INFO_IDX 00279 DST_mk_common_block(char *name, 00280 void *subpr); 00281 00282 /* create a DW_TAG_common_inclusion and return its idx 00283 * 00284 */ 00285 DST_INFO_IDX 00286 DST_mk_common_incl( USRCPOS decl, 00287 DST_INFO_IDX comblk); 00288 00289 00290 /* Creates a DW_TAG_lexical_block entry and returns its idx. 00291 */ 00292 extern DST_INFO_IDX 00293 DST_mk_lexical_block(char *name, /* NULL if unnamed */ 00294 void *low_pc, /* ptr to front-end label */ 00295 void *high_pc, /* ptr to front-end label */ 00296 DST_INFO_IDX abstract_origin); /* NULL if none */ 00297 00298 00299 00300 /* Creates a DW_TAG_label entry and returns its idx. 00301 */ 00302 extern DST_INFO_IDX 00303 DST_mk_label(char *name, /* NULL if unnamed */ 00304 void *low_pc, /* front-end label */ 00305 DST_INFO_IDX abstract_origin); /* NULL if none */ 00306 00307 00308 00309 /* Creates a DW_TAG_variable entry for a constant variable and returns 00310 * its idx. Only use this if the constant variable has no allocated 00311 * memory location. 00312 */ 00313 extern DST_INFO_IDX 00314 DST_mk_variable_const(USRCPOS decl, /* Source location */ 00315 char *name, /* Name of const variable */ 00316 DST_INFO_IDX type, /* Type of const variable */ 00317 BOOL is_automatic, 00318 BOOL is_external, 00319 DST_CONST_VALUE cval); /* Constant value */ 00320 00321 00322 /* creates a DW_TAG+variable entry for a variable within a common 00323 * block. feptr is a front end pointer to the common block, offset 00324 * is an offset from the beginning of the common block. 00325 */ 00326 extern DST_INFO_IDX 00327 DST_mk_variable_comm( USRCPOS decl, /* Source location */ 00328 char *name, /* Name of const variable */ 00329 DST_INFO_IDX type, /* Type of const variable */ 00330 void *feptr, /* front end pointer */ 00331 UINT64 offset); /* offset from common block */ 00332 00333 00334 /* Creates a DW_TAG_variable entry for the definition for a member of 00335 * class and returns its idx. 00336 */ 00337 extern DST_INFO_IDX 00338 DST_mk_variable_memdef(USRCPOS decl, /* Source location */ 00339 void *var, /* front-end variable */ 00340 DST_INFO_IDX spec); /* Class member decl */ 00341 00342 00343 00344 /* Creates a DW_TAG_variable entry for the definition/declaration 00345 * for other forms of variables than those handled above. 00346 */ 00347 extern DST_INFO_IDX 00348 DST_mk_variable(USRCPOS decl, /* Source location */ 00349 char *name, /* Name of variable */ 00350 DST_INFO_IDX type, /* Type of variable */ 00351 UINT64 offs, /* offset from front end variable */ 00352 void *var, /* front-end variable */ 00353 DST_INFO_IDX abstract_origin, /* For inlined proc */ 00354 BOOL is_declaration, 00355 BOOL is_automatic, 00356 BOOL is_external, 00357 BOOL is_artificial); 00358 00359 00360 00361 /* Creates a DW_TAG_formal_parameter entry. 00362 */ 00363 extern DST_INFO_IDX 00364 DST_mk_formal_parameter(USRCPOS decl, /* Source location */ 00365 char *name, /* Name of parm */ 00366 DST_INFO_IDX type, /* Type of parm */ 00367 void *parm, /* front-end parameter */ 00368 DST_INFO_IDX abstract_origin, /* For inlined proc */ 00369 DST_INFO_IDX default_val, /* (C++) param value */ 00370 BOOL is_optional, /* Optional param (C++) */ 00371 BOOL is_variable, /* Variable param */ 00372 // is_variable TRUE where the 00373 // language says a change 00374 // in the argument changes the caller 00375 // value. FALSE for C, C++. 00376 BOOL is_artificial, // compiler inserted 00377 BOOL is_declaration_only); // Param is 00378 // declaration 00379 // because function is decl only. 00380 00381 /* Creates a DW_TAG_unspecified_parameters entry. 00382 */ 00383 extern DST_INFO_IDX 00384 DST_mk_unspecified_parameters(USRCPOS decl, /* Source location */ 00385 DST_INFO_IDX abstract_origin); /* For inlined */ 00386 00387 00388 00389 /* Creates a DW_TAG_constant entry. 00390 */ 00391 DST_INFO_IDX 00392 DST_mk_constant_def(USRCPOS decl, /* Source location */ 00393 char *name, /* Name of constant */ 00394 DST_INFO_IDX type, /* Type of constant */ 00395 DST_CONST_VALUE cval, /* Value of constant */ 00396 BOOL is_external); /* External? */ 00397 00398 00399 00400 /* Creates a DW_TAG_constant entry. 00401 */ 00402 extern DST_INFO_IDX 00403 DST_mk_constant_decl(USRCPOS decl, /* Source location */ 00404 char *name, /* Name of constant */ 00405 DST_INFO_IDX type, /* Type of constant */ 00406 BOOL is_external); /* External? */ 00407 00408 00409 00410 /* Creates a DW_TAG_basetype entry. 00411 */ 00412 extern DST_INFO_IDX 00413 DST_mk_basetype(char *name, /* Name of type */ 00414 DST_ATE_encoding encoding, /* How to encode/interpret data */ 00415 DST_size_t byte_size);/* Size of object */ 00416 00417 00418 00419 /* Creates a DW_TAG_const_type entry. 00420 */ 00421 extern DST_INFO_IDX 00422 DST_mk_const_type(DST_INFO_IDX type); /* Qualified type */ 00423 00424 00425 00426 /* Creates a DW_TAG_volatile_type entry. 00427 */ 00428 extern DST_INFO_IDX 00429 DST_mk_volatile_type(DST_INFO_IDX type); /* Qualified type */ 00430 00431 00432 00433 /* Creates a DW_TAG_pointer_type entry. 00434 */ 00435 extern DST_INFO_IDX 00436 DST_mk_pointer_type(DST_INFO_IDX type, /* Type pointed to */ 00437 DST_addr_class address_class, /* How to dereference */ 00438 DST_size_t byte_size); /* Size */ 00439 00440 00441 00442 /* Creates a DW_TAG_reference_type entry. 00443 */ 00444 extern DST_INFO_IDX 00445 DST_mk_reference_type(DST_INFO_IDX type, /* Type pointed to */ 00446 DST_addr_class address_class, /* How to dereference */ 00447 DST_size_t byte_size); /* Size */ 00448 00449 00450 00451 /* Creates a DW_TAG_typedef entry. 00452 */ 00453 extern DST_INFO_IDX 00454 DST_mk_typedef(USRCPOS decl, /* Source location */ 00455 char *name, /* Name of type */ 00456 DST_INFO_IDX type, /* Defining type */ 00457 DST_INFO_IDX abstract_origin); /* In scope of inlined proc */ 00458 00459 /* Creates a DW_TAG_ptr_to_member_type entry. 00460 */ 00461 extern DST_INFO_IDX 00462 DST_mk_ptr_to_member_type(USRCPOS decl, /* Source location */ 00463 char *name, /* Name of type */ 00464 DST_INFO_IDX type, /* Type of member */ 00465 DST_INFO_IDX class_type); /* Type of class */ 00466 00467 /* Creates a DW_TAG_array_type entry. 00468 */ 00469 extern DST_INFO_IDX 00470 DST_mk_array_type(USRCPOS decl, /* Source location */ 00471 char *name, /* Name of type */ 00472 DST_INFO_IDX type, /* Element type */ 00473 DST_size_t byte_size, /* Size of array, if known */ 00474 DST_INFO_IDX abstract_origin, /* In scope of inlined */ 00475 BOOL is_incomplete); /* Incomplete array */ 00476 00477 00478 00479 /* Creates a DW_TAG_subrange_type entry. 00480 */ 00481 extern DST_INFO_IDX 00482 DST_mk_subrange_type(DST_flag is_lb_cval, 00483 DST_cval_ref low, /* lower bound */ 00484 DST_flag is_ub_cval, 00485 DST_cval_ref high); /* upper bound */ 00486 00487 00488 00489 /* Creates a DW_TAG_string_type entry. 00490 */ 00491 extern DST_INFO_IDX 00492 DST_mk_string_type(USRCPOS decl, /* Source location */ 00493 char *name, /* Name of type */ 00494 DST_flag is_len_cval, /* if length is a constant */ 00495 DST_cval_ref len); /* Length of string */ 00496 00497 00498 00499 /* Creates a DW_TAG_structure_type entry. 00500 */ 00501 extern DST_INFO_IDX 00502 DST_mk_structure_type(USRCPOS decl, /* Source location */ 00503 char *name, /* Name of type */ 00504 DST_size_t byte_size, /* Size of struct, if known */ 00505 DST_INFO_IDX abstract_origin, 00506 BOOL is_incomplete); 00507 00508 00509 00510 /* Creates a DW_TAG_union_type entry. 00511 */ 00512 extern DST_INFO_IDX 00513 DST_mk_union_type(USRCPOS decl, /* Source location */ 00514 char *name, /* Name of type */ 00515 DST_size_t byte_size, /* Size of union, if known */ 00516 DST_INFO_IDX abstract_origin, 00517 BOOL is_incomplete); 00518 00519 00520 00521 /* Creates a DW_TAG_class_type entry. 00522 */ 00523 extern DST_INFO_IDX 00524 DST_mk_class_type(USRCPOS decl, /* Source location */ 00525 char *name, /* Name of type */ 00526 DST_size_t byte_size, /* Size of class, if known */ 00527 DST_INFO_IDX abstract_origin, 00528 BOOL is_incomplete); 00529 00530 00531 00532 /* Creates a DW_TAG_member entry. Note that memb_loc is the field- 00533 * offset within the struct for non-bitfields. The byte_size, bit- 00534 * offset, and bit_size only apply to bitfields, while memb_loc is the 00535 * location of the block containing (properly aligned) the bitfield. 00536 */ 00537 extern DST_INFO_IDX 00538 DST_mk_member(USRCPOS decl, /* Source location */ 00539 char *name, /* Name of member */ 00540 DST_INFO_IDX type, /* Type of member */ 00541 DST_size_t memb_loc, /* Byte-offset of member container */ 00542 DST_size_t byte_size, /* Byte-size of container */ 00543 DST_bitsize bit_offset, /* Offset within container */ 00544 DST_bitsize bit_size, /* Size of bitfield member; will be 00545 zero for non-bitfield members. */ 00546 BOOL is_bitfield, 00547 BOOL is_static, 00548 BOOL is_declaration, 00549 BOOL is_artificial); 00550 00551 00552 00553 /* Creates a DW_TAG_inheritance entry. 00554 */ 00555 extern DST_INFO_IDX 00556 DST_mk_inheritance(USRCPOS decl, /* Source location */ 00557 DST_INFO_IDX type, /* Type of member */ 00558 DST_virtuality virtuality, /* AT_virtuality code */ 00559 DST_size_t memb_loc); /* Byte-offset of member container */ 00560 00561 /* Creates a DW_TAG_template_type_parameter entry. 00562 */ 00563 extern DST_INFO_IDX 00564 DST_mk_template_type_parameter(USRCPOS decl, /* Source location */ 00565 char *name, /* Name of formal */ 00566 DST_INFO_IDX type); /* Actual type */ 00567 00568 /* Creates a DW_TAG_template_value_parameter entry. 00569 */ 00570 extern DST_INFO_IDX 00571 DST_mk_template_value_parameter(USRCPOS decl, /* Source location */ 00572 char *name, /* Name of formal */ 00573 DST_INFO_IDX type, /* Actual type */ 00574 DST_CONST_VALUE cval); /* Actual type */ 00575 00576 00577 /* Creates a DW_TAG_enumeration_type entry. 00578 */ 00579 extern DST_INFO_IDX 00580 DST_mk_enumeration_type(USRCPOS decl, /* Source location */ 00581 char *name, /* Name of type */ 00582 DST_size_t byte_size, /* Size, if known */ 00583 DST_INFO_IDX abstract_origin, /* In inlined inst. */ 00584 BOOL is_incomplete); 00585 00586 00587 00588 /* Creates a DW_TAG_enumerator entry. 00589 */ 00590 extern DST_INFO_IDX 00591 DST_mk_enumerator(USRCPOS decl, /* Source location */ 00592 char *name, /* Name of enumerator */ 00593 DST_CONST_VALUE cval); /* Value of enumerator */ 00594 00595 00596 00597 /* Creates a DW_TAG_subroutine_type entry, with the parameter types 00598 * as children. 00599 */ 00600 extern DST_INFO_IDX 00601 DST_mk_subroutine_type(USRCPOS decl, /* Source location */ 00602 char *name, /* Name */ 00603 DST_INFO_IDX type, /* Return type */ 00604 DST_INFO_IDX abstract_origin, /* In inlined instance */ 00605 BOOL is_prototyped); 00606 00607 00608 #if defined(_SUPPORT_IPA) || defined(_STANDALONE_INLINER) 00609 extern void 00610 DST_label_add_name(DST_LABEL *, char *); 00611 00612 extern void 00613 DST_lexical_block_add_name(DST_LEXICAL_BLOCK *, char *); 00614 00615 extern char * 00616 DST_get_file(mUINT16 , UINT64 *, UINT64 *, char **); 00617 00618 extern void 00619 DST_subprogram_concrete_to_abstract(DST_INFO_IDX); 00620 00621 extern mUINT16 00622 DST_get_cross_inlined_file_id(char *, 00623 char *, 00624 UINT64, 00625 UINT64); 00626 00627 extern DST_INFO_IDX 00628 DST_mk_cross_inlined_subroutine( 00629 void *, 00630 void *, 00631 char *, 00632 mUINT16 *, 00633 UINT64 , 00634 UINT64 , 00635 USRCPOS , 00636 char *, 00637 char *); 00638 #endif 00639 00640 #if defined(_SUPPORT_IPA) || defined(_STANDALONE_INLINER) || defined(_LEGO_CLONER) 00641 extern DST_INFO_IDX 00642 DST_mk_cloned_subprogram(USRCPOS, 00643 char *, 00644 DST_INFO_IDX , 00645 DST_INFO_IDX , 00646 void *, /* front-end st */ 00647 DST_inline , 00648 DST_virtuality ); 00649 00650 #endif 00651 00652 #ifdef __cplusplus 00653 } 00654 #endif 00655 #endif /* dwarf_DST_producer_INCLUDED */