Open64 (mfef90, whirl2f, and IR tools)
TAG: version-openad; SVN changeset: 916
|
00001 /* 00002 00003 Copyright (C) 2000, 2001 Silicon Graphics, Inc. All Rights Reserved. 00004 00005 This program is free software; you can redistribute it and/or modify it 00006 under the terms of version 2 of the GNU General Public License as 00007 published by the Free Software Foundation. 00008 00009 This program is distributed in the hope that it would be useful, but 00010 WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 00012 00013 Further, this software is distributed without any warranty that it is 00014 free of the rightful claim of any third person regarding infringement 00015 or the like. Any license provided herein, whether implied or 00016 otherwise, applies only to this software file. Patent licenses, if 00017 any, provided herein do not apply to combinations of this program with 00018 other software, or any other product whatsoever. 00019 00020 You should have received a copy of the GNU General Public License along 00021 with this program; if not, write the Free Software Foundation, Inc., 59 00022 Temple Place - Suite 330, Boston MA 02111-1307, USA. 00023 00024 Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pky, 00025 Mountain View, CA 94043, or: 00026 00027 http://www.sgi.com 00028 00029 For further information regarding this notice, see: 00030 00031 http://oss.sgi.com/projects/GenInfo/NoticeExplan 00032 00033 */ 00034 00035 /* ------------------------------------------- 00036 Structure to track dummy arguments of a fn 00037 until can be converted into TYLIST 00038 */ 00039 00040 typedef struct parmlist { 00041 TY_IDX ty; 00042 struct parmlist *next; 00043 } PARMS; 00044 00045 #define PARMS_ty(o) ((o)->ty) 00046 #define PARMS_next(o) ((o)->next) 00047 00048 00049 /* ------------------------------------------- 00050 Structures to associate dummy arguments with 00051 an entry point ST. There doesn't happen to be 00052 any association with the procedure definition in 00053 the interface, and a little is needed for WN & dwarf. 00054 00055 - fe_given_args is number FE says to pass, including fn result address 00056 - Total_args includes hidden arguments eg: char lengths. 00057 - Args_seen - number of arg slots filled so far 00058 - Arg_lengths_index - index to character length arguments, but 00059 not including length of character function result. 00060 - Last_parm_ty_seen - TYLIST entry corresponding to Args_seen 00061 on TEXT TY for procedure. 00062 - Last_len_ty_seen - ditto for character lengths. 00063 - ret_type - function result TY, for those which pass result as dummy 00064 and are marked as subroutine. 00065 - orig_ret_type - function result TY that was sent from fe, to keep 00066 track of result by dummy and generate the correct 00067 TYLIST entry. 00068 00069 */ 00070 00071 typedef struct alist { 00072 INT32 total_args ; 00073 INT32 fe_given_args ; 00074 INT32 args_seen ; 00075 INT32 arg_lengths_index ; 00076 PARMS * last_parm_ty_seen; 00077 PARMS * last_len_ty_seen; 00078 struct alist * next_entry ; 00079 ST **arglist ; 00080 PARMS *parms; 00081 TY_IDX ret_type; 00082 TY_IDX orig_ret_type; 00083 } DUMMIES ; 00084 00085 00086 00087 /* ---------------------------------------------- 00088 00089 This defines an auxiliary struct for associating 00090 odds & ends with an ST. It's pointed to by the ST_temp 00091 field, and allocated in cwh_stab.c 00092 00093 - dummy: is a list of dummy args for a TEXT entry ST 00094 - pragma: is a WN pragma - host variables of internal procs use them. 00095 - stptr: pointer back to the ST, to clean up. 00096 - altentry:list of alternate entry point STs (DST) associated with procedure. 00097 - comlist: list of STs of elements of common block, associated with COMMON ST. (DST) 00098 - nlist: list of STs which comprise this namelist. 00099 - rlist: list of return varbl STs for a alternate entry point's shared temp 00100 - splitlist: list of child STs if this parent common block is split 00101 - stem: ST's DST name if internal or module procedure or MAIN 00102 - next: pointer to next AUXST, to clean up. 00103 - distr_preg: associated preg for distributed arrays 00104 - pos: declaration coordinates for this sym. 00105 - flags: defined in cwh_stab.h 00106 - eqvlist: list of st's of elements of equivalence blocks. 00107 - data_info: pointer to structure containing information for statically intialized symbols 00108 - dst_comms: list of commons in Global Symtab that require DST info in this PU. 00109 - dst_parms: list of parameters in Global Symtab that require DST info in PU. 00110 - cri_pointee: for a CRI_Pointer, the ST of its CRU_pointee. 00111 */ 00112 00113 00114 typedef struct auxst { 00115 DUMMIES * dummy ; 00116 WN * pragma ; 00117 ST * stptr ; 00118 LIST altentry ; 00119 LIST comlist ; 00120 LIST nlist ; 00121 LIST rlist ; 00122 LIST splitlist; 00123 LIST eqvlist; 00124 LIST dst_comms; 00125 LIST dst_parms; 00126 LIST derived_type_and_mod_var; 00127 char * stem ; 00128 struct auxst * next_auxst; 00129 USRCPOS pos ; 00130 INT32 assign_id; 00131 PREG_det distr_preg; 00132 ST * cri_pointee; 00133 struct data_info_s *data_info; 00134 UINT32 flags ; 00135 } AUXST ; 00136 00137 00138 #define Set_AUXST_Flag(o,f) ((o)->flags |= f) 00139 #define Clear_AUXST_Flag(o,f) ((o)->flags &= ~f) 00140 #define AUXST_Flag(o,f) ((o)->flags & f) 00141 00142 #define AUXST_AssignId(o) ((o)->assign_id) 00143 #define AUXST_CRIPointee(o) ((o)->cri_pointee) 00144 #define AUXST_DataInfo(o) ((o)->data_info) 00145 #define AUXST_Dummies(o) ((o)->dummy) 00146 #define AUXST_DstrReg(o) ((o)->distr_preg.preg) 00147 #define AUXST_DstrTY(o) ((o)->distr_preg.preg_ty) 00148 #define AUXST_DstrST(o) ((o)->distr_preg.preg_st) 00149 #define AUXST_DstrPreg(o) ((o)->distr_preg) 00150 #define AUXST_Flags(o) ((o)->flags) 00151 #define AUXST_Next(o) ((o)->next_auxst) 00152 #define AUXST_OwningST(o) ((o)->stptr) 00153 #define AUXST_Pragma(o) ((o)->pragma) 00154 #define AUXST_SrcPos(o) ((o)->pos) 00155 #define AUXST_Stem(o) ((o)->stem) 00156 00157 #define AUXST_Commons(o) ((LIST *) &(o)->comlist) 00158 #define AUXST_Namelist(o) ((LIST *) &(o)->nlist) 00159 #define AUXST_RtnTemps(o) ((LIST *) &(o)->rlist) 00160 #define AUXST_SplitCommons(o) ((LIST *) &(o)->splitlist) 00161 #define AUXST_Altentries(o) ((LIST *) &(o)->altentry) 00162 #define AUXST_Equivs(o) ((LIST *) &(o)->eqvlist) 00163 #define AUXST_Dstcomlist(o) ((LIST *) &(o)->dst_comms) 00164 #define AUXST_Dstparmlist(o) ((LIST *) &(o)->dst_parms) 00165 #define AUXST_TyMdlist(o) ((LIST *) &(o)->derived_type_and_mod_var) 00166 00167 00168 00169 /* For convenience in deallocation, an auxst list for each 00170 * scope level is maintained. 00171 */ 00172 00173 static AUXST * Top_Auxst[INTERNAL_LEVEL+1] = {NULL,NULL,NULL,NULL}; 00174 static AUXST * EP_Current ; 00175 00176 /*=================================================== 00177 * 00178 * The following declarations handle the creation of Auxst_Table which will 00179 * automatically grow and shrink with the St_Table. 00180 * 00181 *=================================================== 00182 */ 00183 00184 #define MAX_AUXST_LEVEL 8 00185 00186 typedef RELATED_SEGMENTED_ARRAY<AUXST *> AUXST_PTR_ARRAY; 00187 00188 struct AUXST_TAB { 00189 AUXST_PTR_ARRAY *Auxst_table; 00190 }; 00191 00192 extern AUXST_TAB *Auxst_tab = NULL; 00193 00194 struct AUXST_TAB_SYMTAB_ACCESS; 00195 00196 typedef TABLE_INDEXED_BY_LEVEL8_AND_INDEX24<AUXST *, ST_IDX, SYMTAB_IDX, 00197 AUXST_TAB *, &Auxst_tab, 00198 AUXST_TAB_SYMTAB_ACCESS> 00199 AUXST_TABLE; 00200 00201 struct AUXST_TAB_SYMTAB_ACCESS { 00202 AUXST_TAB_SYMTAB_ACCESS(void) { } 00203 00204 AUXST_PTR_ARRAY *operator()(AUXST_TAB **Auxst_tab_parm, SYMTAB_IDX level) 00205 { 00206 DevAssert((level < MAX_AUXST_LEVEL), ("AUXST table: leve overflow")); 00207 return (*Auxst_tab_parm)[level].Auxst_table; 00208 } 00209 }; 00210 00211 static AUXST_TABLE Auxst_Table; 00212 00213 /* auxiliary ST & Label tables */ 00214 00215 struct AUX_LABEL_INFO { 00216 INT32 assign_id; 00217 AUX_LABEL_INFO(void) : assign_id(-1) { } 00218 }; 00219 00220 typedef RELATED_SEGMENTED_ARRAY<AUX_LABEL_INFO> FE_LABEL_TAB; 00221 00222 FE_LABEL_TAB Auxlabel_Table; 00223 00224 00225 /* forward references */ 00226 00227 static LIST * cwh_auxst_find_list(AUXST * o, enum list_name list) ; 00228 static AUXST* cwh_auxst_find(ST *st, BOOL create) ; 00229 static DUMMIES * cwh_auxst_find_entry(ST * entry) ; 00230 static void cwh_auxst_dump_dummies(DUMMIES * d);