#include "gspin-wgen-interface.h"#include <values.h>#include "defs.h"#include "glob.h"#include "config.h"#include "dwarf_DST_producer.h"#include "dwarf_DST_dump.h"#include "file_util.h"#include "srcpos.h"#include "symtab.h"#include "wgen_misc.h"#include "wgen_dst.h"#include "wgen_expr.h"#include "wgen_spin_symbol.h"#include <sys/types.h>#include <sys/stat.h>#include <sys/param.h>#include <unistd.h>#include <string>#include <vector>#include <map>

Go to the source code of this file.
Defines | |
| #define | MAX_CWD_CHARS (256 - (MAXHOSTNAMELEN+1)) |
| #define | DANAME(d) |
Typedefs | |
| typedef std::map< std::string, DST_INFO_IDX > | DST_Type_Map |
Functions/Subroutines | |
| static void | DST_enter_file (char *, UINT) |
| static DST_INFO_IDX | DST_Create_var (ST *var_st, gs_t decl) |
| static DST_INFO_IDX | DST_Create_Parmvar (ST *var_st, gs_t decl) |
| static DST_INFO_IDX | DST_Create_type (ST *typ_decl, gs_t decl) |
| static void | DST_enter_param_vars (gs_t fndecl, DST_INFO_IDX parent, gs_t parameter_list, int is_abstract_root, int is_declaration_only) |
| static DST_INFO_IDX | DST_get_context (gs_t intree) |
| static UINT | Get_Dir_Dst_Info (char *name) |
| static UINT | Get_File_Dst_Info (char *name, UINT dir) |
| static char * | drop_path (char *s) |
| static char * | DST_get_command_line_options (INT32 num_copts, char *copts[]) |
| static char * | Get_Name (gs_t node) |
| static void | DST_enter_static_data_mem (gs_t parent_tree, DST_INFO_IDX parent_idx, TY_IDX parent_ty_idx, gs_t field) |
| static void | DST_enter_member_function (gs_t parent_tree, DST_INFO_IDX parent_idx, TY_IDX parent_ty_idx, gs_t fndecl) |
| static void | DST_enter_normal_field (gs_t parent_tree, DST_INFO_IDX parent_idx, TY_IDX parent_ty_idx, gs_t field) |
| static void | DST_enter_struct_union_members (gs_t parent_tree, DST_INFO_IDX parent_idx) |
| static DST_INFO_IDX | DST_enter_struct_union (gs_t type_tree, TY_IDX ttidx, TY_IDX idx, INT tsize) |
| static DST_INFO_IDX | DST_enter_enum (gs_t type_tree, TY_IDX ttidx, TY_IDX idx, INT tsize) |
| static DST_INFO_IDX | DST_enter_array_type (gs_t type_tree, TY_IDX ttidx, TY_IDX idx, INT tsize) |
| static DST_INFO_IDX | DST_construct_pointer_to_member (gs_t type_tree) |
| DST_INFO_IDX | Create_DST_type_For_Tree (gs_t type_tree, TY_IDX ttidx, TY_IDX idx, bool ignoreconst, bool ignorevolatile) |
| DST_INFO_IDX | Create_DST_decl_For_Tree (gs_t decl, ST *var_st) |
| static DST_INFO_IDX | DST_find_class_member (char *linkage_name_in, gs_t myrecord) |
| DST_INFO_IDX | DST_Create_Subprogram (ST *func_st, gs_t fndecl) |
| DST_INFO_IDX | DST_Get_Comp_Unit (void) |
| void | DST_build (int num_copts, char *copts[]) |
| void | WGEN_Set_Line_And_File (UINT line, const char *f, bool check) |
Variables | |
| static char * | source_file = __FILE__ |
| static BOOL | dst_initialized = FALSE |
| static char | cwd_buffer [MAX_CWD_CHARS+MAXHOSTNAMELEN+1] |
| static char * | current_working_dir = &cwd_buffer[0] |
| static char * | current_host_dir = &cwd_buffer[0] |
| static DST_INFO_IDX | comp_unit_idx = DST_INVALID_INIT |
| static UINT | last_dir_num = 0 |
| static UINT | current_dir = 1 |
| static UINT | last_file_num = 0 |
| UINT | current_file = 1 |
| static std::vector< std::pair < char *, UINT > > | dir_dst_list |
| static DST_Type_Map | basetypes |
| static std::vector< std::pair < char *, UINT > > | file_dst_list |
| static const char * | current_file_name = NULL |
| #define DANAME | ( | d | ) |
Value:
((gs_tree_code_class(d) == GS_TCC_DECLARATION)? \ ((gs_decl_name(d))?gs_identifier_pointer(gs_decl_name(d)):"?"):\ "?2")
| #define MAX_CWD_CHARS (256 - (MAXHOSTNAMELEN+1)) |
Definition at line 134 of file wgen_dst.cxx.
| typedef std::map< std::string, DST_INFO_IDX > DST_Type_Map |
Definition at line 161 of file wgen_dst.cxx.
| DST_INFO_IDX Create_DST_decl_For_Tree | ( | gs_t | decl, | |
| ST * | var_st | |||
| ) |
Definition at line 2053 of file wgen_dst.cxx.
References DECL_DST_IDX(), DST_Create_Parmvar(), DST_Create_Subprogram(), DST_Create_type(), DST_Create_var(), DST_INVALID_INIT, DST_IS_NULL, GS_FUNCTION_DECL, GS_PARM_DECL, gs_tree_code(), GS_TYPE_DECL, and GS_VAR_DECL.
| DST_INFO_IDX Create_DST_type_For_Tree | ( | gs_t | type_tree, | |
| TY_IDX | ttidx, | |||
| TY_IDX | idx, | |||
| bool | ignoreconst, | |||
| bool | ignorevolatile | |||
| ) |
Definition at line 1661 of file wgen_dst.cxx.
References align, basetypes, Be_Type_Tbl, BOOL, Create_DST_type_For_Tree(), DevWarn, DST_append_child(), DST_construct_pointer_to_member(), DST_Create_type(), DST_enter_array_type(), DST_enter_enum(), DST_enter_struct_union(), DST_get_context(), DST_INFO_flag, DST_INFO_IDX_TO_PTR, DST_INVALID_INIT, DST_IS_NULL, DST_mk_basetype(), DST_mk_const_type(), DST_mk_pointer_type(), DST_mk_reference_type(), DST_mk_volatile_type(), DW_ADDR_none, DW_ATE_boolean, DW_ATE_complex_float, DW_ATE_float, DW_ATE_signed, DW_ATE_signed_char, DW_ATE_unsigned, DW_ATE_unsigned_char, Fail_FmtAssertion(), FALSE, FmtAssert, Get_Name(), Get_TY(), GS_ARRAY_TYPE, GS_BOOLEAN_TYPE, GS_CHAR_TYPE, GS_COMPLEX_TYPE, GS_ENUMERAL_TYPE, GS_FUNCTION_TYPE, gs_get_integer_value(), GS_INTEGER_CST, GS_INTEGER_TYPE, GS_LANG_TYPE, GS_METHOD_TYPE, GS_OFFSET_TYPE, GS_POINTER_TYPE, GS_REAL_TYPE, GS_RECORD_TYPE, GS_REFERENCE_TYPE, GS_TCC_TYPE, gs_tree_code(), gs_type_align(), GS_TYPE_DECL, GS_UNION_TYPE, GS_VECTOR_TYPE, GS_VOID_TYPE, INT, INT32, KIND_FUNCTION, lineno, mtype, MTYPE_M, MTYPE_UNKNOWN, names, New_TY(), New_TYLIST(), NULL, p, Set_TY_align, Set_TY_has_prototype, Set_TY_is_varargs, Set_TY_tylist(), Set_TYLIST_type(), strcmp(), string, strlen(), TREE_CHAIN, TREE_TYPE, TREE_VALUE, TRUE, TY_Init(), TY_mtype, TY_size, Tylist_Table, TYPE_ARG_TYPES, TYPE_DST_IDX(), TYPE_ID, TYPE_TY_IDX(), UINT, variable_size(), and WFE_Keep_Zero_Length_Structs.
| static char* drop_path | ( | char * | s | ) | [static] |
| void DST_build | ( | int | num_copts, | |
| char * | copts[] | |||
| ) |
Definition at line 2918 of file wgen_dst.cxx.
References current_host_dir, current_working_dir, cwd_buffer, Debug_Level, DST_get_command_line_options(), DST_Init(), dst_initialized, DST_mk_compile_unit(), dump_base_name, DW_ID_case_sensitive, DW_LANG_C89, DW_LANG_C_plus_plus, exit(), free(), Get_Current_Working_Directory(), getdomainname(), gethostname(), INCLUDE_STAMP, lang_cplus, Last_Pathname_Component(), malloc, NULL, Orig_Src_File_Name, perror(), Src_File_Name, strcat(), strchr, strcpy, strlen(), TRUE, and WGEN_Set_Line_And_File().
| static DST_INFO_IDX DST_construct_pointer_to_member | ( | gs_t | type_tree | ) | [static] |
Definition at line 1555 of file wgen_dst.cxx.
References Create_DST_type_For_Tree(), DevWarn, DST_INVALID_INIT, DST_mk_ptr_to_member_type(), FALSE, FmtAssert, Get_Name(), Get_TY(), GS_ERROR_MARK, GS_OFFSET_TYPE, GS_POINTER_TYPE, GS_TCC_TYPE, gs_tree_code(), TYPE_DST_IDX(), TYPE_TY_IDX(), USRCPOS_clear, and USRCPOS_srcpos.
| static DST_INFO_IDX DST_Create_Parmvar | ( | ST * | var_st, | |
| gs_t | decl | |||
| ) | [static] |
Definition at line 2226 of file wgen_dst.cxx.
References DECL_DST_IDX(), DST_INVALID_INIT, Get_ST, Get_TY(), USRCPOS_clear, and USRCPOS_srcpos.
| DST_INFO_IDX DST_Create_Subprogram | ( | ST * | func_st, | |
| gs_t | fndecl | |||
| ) |
Definition at line 2718 of file wgen_dst.cxx.
References basename, BOOL, cplus_demangle(), Debug_Level, DECL_DST_ABSTRACT_ROOT_IDX(), DECL_DST_IDX(), DevWarn, DMGL_ANSI, DMGL_PARAMS, DMGL_TYPES, dst, DST_add_linkage_name_to_subprogram(), DST_add_specification_to_subprogram(), DST_append_child(), DST_enter_param_vars(), DST_find_class_member(), DST_get_context(), DST_INFO_flag, DST_INFO_IDX_TO_PTR, DST_INVALID_IDX, DST_INVALID_INIT, DST_IS_NULL, DST_mk_subprogram(), DST_RESET_assoc_fe, DW_INL_not_inlined, DW_VIRTUALITY_none, FALSE, FmtAssert, Get_Name(), Get_TY(), gs_identifier_pointer(), GS_RECORD_TYPE, gs_tree_code(), Index_To_Str(), len, NULL, Save_Str2(), ST_is_export_local(), ST_name, ST_st_idx, strcmp(), strcpy, strlen(), strstr(), TRUE, TYPE_DST_IDX(), USRCPOS_clear, and USRCPOS_srcpos.
| static DST_INFO_IDX DST_Create_type | ( | ST * | typ_decl, | |
| gs_t | decl | |||
| ) | [static] |
Definition at line 2138 of file wgen_dst.cxx.
References base, basetypes, Create_DST_type_For_Tree(), DECL_RESULT, DevWarn, dst, DST_append_child(), DST_get_context(), DST_INVALID_IDX, DST_INVALID_INIT, DST_mk_typedef(), Get_Name(), Get_TY(), names, p, string, TYPE_DST_IDX(), USRCPOS_clear, and USRCPOS_srcpos.
| static DST_INFO_IDX DST_Create_var | ( | ST * | var_st, | |
| gs_t | decl | |||
| ) | [static] |
Definition at line 2320 of file wgen_dst.cxx.
References dst, DST_add_specification_to_variable(), DST_append_child(), DST_find_class_member(), DST_get_context(), DST_INVALID_IDX, DST_INVALID_INIT, DST_IS_NULL, DST_mk_variable(), FALSE, Get_Name(), GS_FIELD_DECL, gs_identifier_pointer(), GS_RECORD_TYPE, GS_TEMPLATE_DECL, gs_tree_code(), GS_UNION_TYPE, GS_VAR_DECL, Index_To_Str(), lang_cplus, len, NULL, Save_Str2(), ST_st_idx, strcmp(), strcpy, strlen(), TYPE_DST_IDX(), USRCPOS_clear, and USRCPOS_srcpos.
| static DST_INFO_IDX DST_enter_array_type | ( | gs_t | type_tree, | |
| TY_IDX | ttidx, | |||
| TY_IDX | idx, | |||
| INT | tsize | |||
| ) | [static] |
Definition at line 1466 of file wgen_dst.cxx.
References ARB_const_ubnd, ARB_ubnd_var(), Create_DST_type_For_Tree(), d, DevWarn, DST_append_child(), DST_INVALID_IDX, DST_IS_NULL, DST_mk_array_type(), GS_TCC_TYPE, index(), INT, KIND_INVALID, SCLASS_AUTO, ST_sclass, St_Table, TRUE, TY_AR_ndims, TY_arb(), TY_kind, Ty_Table, TYPE_DST_IDX(), TYPE_TY_IDX(), USRCPOS_clear, and USRCPOS_srcpos.
| static DST_INFO_IDX DST_enter_enum | ( | gs_t | type_tree, | |
| TY_IDX | ttidx, | |||
| TY_IDX | idx, | |||
| INT | tsize | |||
| ) | [static] |
Definition at line 1204 of file wgen_dst.cxx.
References DevWarn, DST_append_child(), DST_CONST_VALUE_form, DST_CONST_VALUE_form_data4, DST_CONST_VALUE_form_data8, DST_FORM_DATA4, DST_FORM_DATA8, DST_get_context(), DST_INVALID_IDX, DST_INVALID_INIT, DST_IS_NULL, DST_mk_enumeration_type(), DST_mk_enumerator(), Get_Name(), gs_get_integer_value(), gs_identifier_pointer(), GS_TCC_TYPE, NULL, src, TYPE_DST_IDX(), USRCPOS_clear, and USRCPOS_srcpos.
Definition at line 350 of file wgen_dst.cxx.
References DST_mk_file_name(), file_size, stat::st_mtime, stat::st_size, stat, and UINT64.
| static void DST_enter_member_function | ( | gs_t | parent_tree, | |
| DST_INFO_IDX | parent_idx, | |||
| TY_IDX | parent_ty_idx, | |||
| gs_t | fndecl | |||
| ) | [static] |
Definition at line 607 of file wgen_dst.cxx.
References base, basename, BOOL, cplus_demangle(), DECL_DST_FIELD_IDX(), DECL_DST_SPECIFICATION_IDX(), DevWarn, DMGL_ANSI, DMGL_PARAMS, DMGL_TYPES, dst, DST_add_linkage_name_to_subprogram(), DST_append_child(), DST_enter_param_vars(), DST_INFO_flag, DST_INFO_IDX_TO_PTR, DST_INVALID_IDX, DST_INVALID_INIT, DST_mk_subprogram(), DST_RESET_assoc_fe, DW_VIRTUALITY_none, DW_VIRTUALITY_pure_virtual, DW_VIRTUALITY_virtual, FmtAssert, Get_TY(), gs_identifier_pointer(), src, strcmp(), strstr(), TRUE, TYPE_DST_IDX(), and USRCPOS_srcpos.
| static void DST_enter_normal_field | ( | gs_t | parent_tree, | |
| DST_INFO_IDX | parent_idx, | |||
| TY_IDX | parent_ty_idx, | |||
| gs_t | field | |||
| ) | [static] |
Definition at line 754 of file wgen_dst.cxx.
References align, base, bitoff, Create_DST_type_For_Tree(), DST_append_child(), DST_INVALID_INIT, DST_mk_member(), Fail_FmtAssertion(), FALSE, Get_Name(), Get_TY(), GS_ARRAY_TYPE, gs_get_integer_value(), GS_INTEGER_CST, gs_tree_code(), gs_type_align(), GS_UNION_TYPE, INT, lineno, NULL, return, src, Target_Byte_Sex, TRUE, TY_size, UINT, USRCPOS_clear, and USRCPOS_srcpos.
| static void DST_enter_param_vars | ( | gs_t | fndecl, | |
| DST_INFO_IDX | parent, | |||
| gs_t | parameter_list, | |||
| int | is_abstract_root, | |||
| int | is_declaration_only | |||
| ) | [static] |
Definition at line 2517 of file wgen_dst.cxx.
References _gs_code(), BOOL, DECL_DST_ABSTRACT_ROOT_IDX(), DECL_DST_IDX(), DevWarn, DST_append_child(), DST_INFO_flag, DST_INFO_IDX_TO_PTR, DST_INVALID_IDX, DST_INVALID_INIT, DST_mk_formal_parameter(), DST_RESET_assoc_fe, DST_SET_deref, FALSE, Get_Name(), Get_ST, Get_TY(), GS_INDIRECT_REF, GS_PARM_DECL, GS_TCC_DECLARATION, gs_tree_code(), gs_tree_operand(), ST_IDX_ZERO, ST_st_idx, TRUE, TYPE_DST_IDX(), and USRCPOS_srcpos.
| static void DST_enter_static_data_mem | ( | gs_t | parent_tree, | |
| DST_INFO_IDX | parent_idx, | |||
| TY_IDX | parent_ty_idx, | |||
| gs_t | field | |||
| ) | [static] |
Definition at line 519 of file wgen_dst.cxx.
References base, Create_DST_type_For_Tree(), DECL_DST_FIELD_IDX(), DECL_DST_IDX(), DECL_DST_SPECIFICATION_IDX(), DST_append_child(), DST_INVALID_IDX, DST_INVALID_INIT, DST_mk_variable(), FALSE, Get_Name(), gs_identifier_pointer(), NULL, return, src, ST_IDX_ZERO, strcmp(), TRUE, USRCPOS_clear, and USRCPOS_srcpos.
| static DST_INFO_IDX DST_enter_struct_union | ( | gs_t | type_tree, | |
| TY_IDX | ttidx, | |||
| TY_IDX | idx, | |||
| INT | tsize | |||
| ) | [static] |
Definition at line 1025 of file wgen_dst.cxx.
References basetypes, Create_DST_type_For_Tree(), DST_append_child(), DST_enter_struct_union_members(), DST_get_context(), DST_INVALID_IDX, DST_IS_NULL, DST_mk_inheritance(), DST_mk_structure_type(), DST_mk_union_type(), DW_ACCESS_private, DW_ACCESS_protected, DW_ACCESS_public, DW_VIRTUALITY_none, DW_VIRTUALITY_virtual, EMPTY, Get_Name(), gs_get_integer_value(), gs_operand(), GS_RECORD_TYPE, gs_tree_code(), gs_type_align(), GS_UNION_TYPE, INT32, is_empty_base_class(), Is_True, lang_cplus, NULL, offset, Roundup, src, TY_IDX_ZERO, TYPE_DST_IDX(), Type_Size_Without_Vbases(), TYPE_TY_IDX(), USRCPOS_clear, and USRCPOS_srcpos.
| static void DST_enter_struct_union_members | ( | gs_t | parent_tree, | |
| DST_INFO_IDX | parent_idx | |||
| ) | [static] |
Definition at line 945 of file wgen_dst.cxx.
References DevWarn, DST_enter_member_function(), DST_enter_normal_field(), DST_enter_static_data_mem(), DST_INVALID_INIT, Get_TY(), GS_FIELD_DECL, GS_FUNCTION_DECL, GS_NAMESPACE_DECL, gs_tree_code(), GS_TYPE_DECL, GS_VAR_DECL, and NULL.
| static DST_INFO_IDX DST_find_class_member | ( | char * | linkage_name_in, | |
| gs_t | myrecord | |||
| ) | [static] |
Definition at line 2271 of file wgen_dst.cxx.
References DECL_DST_FIELD_IDX(), DST_INVALID_INIT, GS_FLAGS, GS_FUNCTION_DECL, gs_identifier_pointer(), gs_operand(), gs_tree_code(), GS_VAR_DECL, NULL, and strcmp().
| static char* DST_get_command_line_options | ( | INT32 | num_copts, | |
| char * | copts[] | |||
| ) | [static] |
| DST_INFO_IDX DST_Get_Comp_Unit | ( | void | ) |
Definition at line 2906 of file wgen_dst.cxx.
| static DST_INFO_IDX DST_get_context | ( | gs_t | intree | ) | [static] |
Definition at line 213 of file wgen_dst.cxx.
References DECL_DST_IDX(), DevWarn, DST_INVALID_INIT, DST_IS_NULL, GS_BLOCK, GS_FUNCTION_DECL, GS_FUNCTION_TYPE, GS_NAMESPACE_DECL, GS_QUAL_UNION_TYPE, GS_RECORD_TYPE, GS_REFERENCE_TYPE, GS_TCC_DECLARATION, GS_TCC_TYPE, GS_TRANSLATION_UNIT_DECL, gs_tree_code(), and GS_UNION_TYPE.
| static UINT Get_Dir_Dst_Info | ( | char * | name | ) | [static] |
Definition at line 275 of file wgen_dst.cxx.
References dir_dst_list, DST_mk_include_dir(), last_dir_num, make_pair(), malloc, strcmp(), strcpy, and strlen().
Definition at line 305 of file wgen_dst.cxx.
References DST_enter_file(), last_file_num, make_pair(), malloc, strcmp(), strcpy, and strlen().
| static char* Get_Name | ( | gs_t | node | ) | [static] |
Definition at line 440 of file wgen_dst.cxx.
References buf, GS_COMPLEX_TYPE, GS_IDENTIFIER_NODE, gs_identifier_pointer(), GS_INTEGER_TYPE, GS_REAL_TYPE, GS_TCC_DECLARATION, GS_TCC_TYPE, gs_tree_code(), GS_TYPE_DECL, gs_type_mode(), NULL, strcat(), strcmp(), and strcpy.
Definition at line 3019 of file wgen_dst.cxx.
References alloca, buf, current_dir, current_file, current_working_dir, dir, drop_path(), dst_initialized, file_name, Get_Dir_Dst_Info(), Get_File_Dst_Info(), NULL, strcmp(), strcpy, strlen(), and strncmp().
Referenced by DST_build(), WGEN_Expand_Stmt(), and WGEN_Start_Function().
DST_Type_Map basetypes [static] |
Definition at line 162 of file wgen_dst.cxx.
DST_INFO_IDX comp_unit_idx = DST_INVALID_INIT [static] |
Definition at line 145 of file wgen_dst.cxx.
UINT current_dir = 1 [static] |
Definition at line 150 of file wgen_dst.cxx.
| UINT current_file = 1 |
Definition at line 152 of file wgen_dst.cxx.
const char* current_file_name = NULL [static] |
char* current_host_dir = &cwd_buffer[0] [static] |
Definition at line 137 of file wgen_dst.cxx.
char* current_working_dir = &cwd_buffer[0] [static] |
Definition at line 136 of file wgen_dst.cxx.
char cwd_buffer[MAX_CWD_CHARS+MAXHOSTNAMELEN+1] [static] |
Definition at line 135 of file wgen_dst.cxx.
std::vector< std::pair< char *, UINT > > dir_dst_list [static] |
Definition at line 160 of file wgen_dst.cxx.
BOOL dst_initialized = FALSE [static] |
Definition at line 126 of file wgen_dst.cxx.
std::vector< std::pair< char *, UINT > > file_dst_list [static] |
Definition at line 300 of file wgen_dst.cxx.
UINT last_dir_num = 0 [static] |
Definition at line 149 of file wgen_dst.cxx.
UINT last_file_num = 0 [static] |
Definition at line 151 of file wgen_dst.cxx.
char* source_file = __FILE__ [static] |
Definition at line 79 of file wgen_dst.cxx.
1.5.6