00001 /* 00002 Copyright 2003, 2004, 2005, 2006 PathScale, Inc. All Rights Reserved. 00003 File modified June 20, 2003 by PathScale, Inc. to update Open64 C/C++ 00004 front-ends to GNU 3.2.2 release. 00005 */ 00006 00007 /* 00008 00009 Copyright (C) 2000, 2001 Silicon Graphics, Inc. All Rights Reserved. 00010 00011 This program is free software; you can redistribute it and/or modify it 00012 under the terms of version 2 of the GNU General Public License as 00013 published by the Free Software Foundation. 00014 00015 This program is distributed in the hope that it would be useful, but 00016 WITHOUT ANY WARRANTY; without even the implied warranty of 00017 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 00018 00019 Further, this software is distributed without any warranty that it is 00020 free of the rightful claim of any third person regarding infringement 00021 or the like. Any license provided herein, whether implied or 00022 otherwise, applies only to this software file. Patent licenses, if 00023 any, provided herein do not apply to combinations of this program with 00024 other software, or any other product whatsoever. 00025 00026 You should have received a copy of the GNU General Public License along 00027 with this program; if not, write the Free Software Foundation, Inc., 59 00028 Temple Place - Suite 330, Boston MA 02111-1307, USA. 00029 00030 Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pky, 00031 Mountain View, CA 94043, or: 00032 00033 http://www.sgi.com 00034 00035 For further information regarding this notice, see: 00036 00037 http://oss.sgi.com/projects/GenInfo/NoticeExplan 00038 00039 */ 00040 00041 00042 /* translate gnu decl trees to symtab references */ 00043 00044 #ifndef tree_symtab_INCLUDED 00045 #define tree_symtab_INCLUDED 00046 00047 #include "wfe_dst.h" 00048 00049 extern TY_IDX Create_TY_For_Tree (tree, TY_IDX idx = TY_IDX_ZERO); 00050 extern "C" ST* Create_ST_For_Tree (tree); 00051 00052 00053 #ifdef EXTRA_WORD_IN_TREE_NODES 00054 00055 /* 00056 * Hacked macro defintions to get things to compile. 00057 * DECL_NAME was chosen completely arbitrarily. 00058 */ 00059 00060 #define TYPE_TY_IDX(tree) ((TY_IDX) DECL_NAME(tree)) 00061 #define DECL_ST(tree) ((ST *) DECL_NAME(tree)) 00062 #define DECL_SYMTAB_IDX(tree) ((SYMTAB_IDX) DECL_NAME(tree)) 00063 #define DECL_LABEL_IDX(tree) ((LABEL_IDX) DECL_NAME(tree)) 00064 #define TREE_STRING_ST(tree) ((ST *) DECL_NAME(tree)) 00065 #define DECL_LABEL_DEFINED(tree) ((BOOL) DECL_NAME(tree)) 00066 #define DECL_FIELD_ID(tree) ((INT32) DECL_NAME(tree)) 00067 #define DECL_DST_IDX(tree) ((INT32) DECL_NAME(tree)) 00068 #define DECL_DST_FIELD_IDX(tree) ((INT32) DECL_NAME(tree)) 00069 #define DECL_DST_ABSTRACT_ROOT_IDX(tree) ((INT32) DECL_NAME(tree)) 00070 #define DECL_DST_SPECIFICATION_IDX(tree) ((INT32) DECL_NAME(tree)) 00071 #define TYPE_DST_IDX(tree) ((INT32) DECL_NAME(tree)) 00072 00073 00074 #else /* EXTRA_WORD_IN_TREE_NODES */ 00075 00076 // These are defined in tree.h. 00077 #undef TREE_STRING_ST 00078 #undef TYPE_TY_IDX 00079 #undef TYPE_FIELD_IDS_USED 00080 #undef TYPE_DST_IDX 00081 #undef DECL_ST 00082 #undef DECL_FIELD_ID 00083 #undef DECL_DST_IDX 00084 00085 TY_IDX& TYPE_TY_IDX(tree); 00086 #ifdef KEY 00087 extern "C" void add_duplicates (tree, tree); 00088 extern "C" void erase_duplicates (tree); 00089 void set_DECL_ST(tree, ST*); 00090 ST*& get_DECL_ST(tree); 00091 BOOL& expanded_decl(tree); 00092 BOOL& func_PU_uplevel(tree); 00093 #define DECL_ST(x) get_DECL_ST(x) 00094 #else 00095 ST*& DECL_ST(tree); 00096 #endif 00097 SYMTAB_IDX& DECL_SYMTAB_IDX(tree); 00098 LABEL_IDX& DECL_LABEL_IDX(tree); 00099 ST*& TREE_STRING_ST(tree); 00100 BOOL& DECL_LABEL_DEFINED(tree); 00101 INT32& DECL_FIELD_ID(tree); 00102 INT32& TYPE_FIELD_IDS_USED(tree); 00103 INT32& SCOPE_NUMBER(tree); 00104 tree& LABEL_SCOPE(tree); 00105 DST_INFO_IDX& DECL_DST_IDX(tree); 00106 DST_INFO_IDX& DECL_DST_FIELD_IDX(tree); 00107 DST_INFO_IDX& TYPE_DST_IDX(tree); 00108 DST_INFO_IDX& DECL_DST_SPECIFICATION_IDX(tree); 00109 DST_INFO_IDX& DECL_DST_ABSTRACT_ROOT_IDX(tree); 00110 LABEL_IDX& HANDLER_LABEL(tree); 00111 #ifdef KEY 00112 tree& PARENT_SCOPE(tree); 00113 INT32& WEAK_WORKAROUND(ST*); 00114 #endif 00115 00116 00117 #endif /* EXTRA_WORD_IN_TREE_NODES */ 00118 00119 #ifdef KEY 00120 // States for tracking whether we want to make a symbol weak as a workaround 00121 // for emitting all symbols referenced in cleanup code. 00122 #define WEAK_WORKAROUND_unknown 0 00123 #define WEAK_WORKAROUND_dont_make_weak 1 00124 #define WEAK_WORKAROUND_made_weak 2 00125 #endif 00126 00127 /* 00128 * either return a previously created TY_IDX associated with a type, 00129 * or create a new one. 00130 */ 00131 inline TY_IDX 00132 Get_TY (tree type_tree) 00133 { 00134 #ifdef KEY 00135 // If the type is a nested record and we are generating DSTs, then 00136 // create the type for the enclosing record first, so that the current 00137 // record can be specified as a child of the parent in the DST. 00138 // Bug 4168. 00139 if (TYPE_CONTEXT(type_tree) && 00140 (TREE_CODE(type_tree) == RECORD_TYPE || 00141 TREE_CODE(type_tree) == UNION_TYPE) && 00142 (TREE_CODE(TYPE_CONTEXT(type_tree)) == RECORD_TYPE || 00143 TREE_CODE(TYPE_CONTEXT(type_tree)) == UNION_TYPE) && 00144 !TYPE_TY_IDX(TYPE_CONTEXT(type_tree))) { 00145 Get_TY(TYPE_CONTEXT(type_tree)); // get type for parent record 00146 } 00147 #endif 00148 TY_IDX idx = TYPE_TY_IDX(type_tree); 00149 if (idx > 1) { 00150 if (TREE_CODE(type_tree) == RECORD_TYPE || 00151 TREE_CODE(type_tree) == UNION_TYPE) { 00152 FLD_HANDLE elt_fld = TY_fld(idx); 00153 if (elt_fld.Is_Null() && TYPE_METHODS(type_tree) == NULL) 00154 return Create_TY_For_Tree (type_tree, idx); // forward declared 00155 else return idx; 00156 } 00157 else return idx; 00158 } 00159 return Create_TY_For_Tree (type_tree, TY_IDX_ZERO); 00160 } 00161 00162 /* 00163 * either return a previously created ST associated with a 00164 * var-decl/parm-decl/function_decl, or create a new one. 00165 */ 00166 inline ST * 00167 Get_ST (tree decl_tree) 00168 { 00169 ST *st = DECL_ST(decl_tree); 00170 if (st != NULL) { 00171 if (TREE_CODE(decl_tree) == VAR_DECL && 00172 ST_sclass(st) == SCLASS_EXTERN && 00173 !DECL_EXTERNAL(decl_tree) && 00174 !DECL_INITIAL(decl_tree)) 00175 Set_ST_sclass (st, SCLASS_UGLOBAL); 00176 #ifdef KEY // the earlier definition may not have the complete type 00177 if (TREE_CODE(decl_tree) == VAR_DECL) { 00178 TY_IDX ty_idx = Get_TY(TREE_TYPE(decl_tree)); 00179 if (ty_idx && TY_IDX_index(ty_idx) != TY_IDX_index(st->u2.type)) { 00180 // Preserve volatile. 00181 if (TY_is_volatile(ST_type(st))) 00182 Set_TY_is_volatile(ty_idx); 00183 st->u2.type = ty_idx; 00184 } 00185 } 00186 #endif 00187 } 00188 else st = Create_ST_For_Tree (decl_tree); 00189 #ifdef KEY 00190 if (ST_is_thread_private(st) && CURRENT_SYMTAB != GLOBAL_SYMTAB) 00191 Set_PU_has_mp(Get_Current_PU()); 00192 #endif 00193 return st; 00194 } 00195 00196 bool is_empty_base_class (tree type_tree); 00197 tree next_real_or_virtual_field (tree type_tree, tree field); 00198 size_t Roundup (size_t offset, int alignment); 00199 size_t Type_Size_Without_Vbases (tree type_tree); 00200 00201 #endif
1.5.6