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 #ifndef wn_attr_INCLUDED 00037 #define wn_attr_INCLUDED 00038 /* ==================================================================== 00039 * ==================================================================== 00040 * 00041 * 00042 * Revision history: 00043 * 07-Mar-95 - Original Version 00044 * 00045 * Description: 00046 * 00047 * Access-macros and access-functions for obtaining attributes of 00048 * WN trees for general use in translating WN to another language 00049 * form (e.g. to C or Fortran). For the most part, this module 00050 * supplements common/com/wn_core.h. 00051 * 00052 * Macros yielding WN attributes: 00053 * ------------------------------ 00054 * 00055 * WN_agoto_addr: 00056 * TODO: is this an address or an index into a table of 00057 * addresses? 00058 * 00059 * WN_condbr_cond: 00060 * The conditional expression controlling the branch. 00061 * 00062 * WN_compgoto_num_cases: 00063 * WN_switch_num_cases: 00064 * The number of cases in a computed goto statement (C switch 00065 * statement). 00066 * 00067 * WN_compgoto_idx: 00068 * WN_switch_idx: 00069 * The expression, which value is the index into the goto table. 00070 * 00071 * WN_compgoto_table: 00072 * WN_switch_table: 00073 * The block of gotos representing the goto table. 00074 * 00075 * WN_compgoto_has_default_case: 00076 * WN_switch_has_default_case: 00077 * TRUE if the computed goto is blessed with a default case. 00078 * 00079 * WN_num_var_refs: 00080 * Return the number of references (LDID, STID, LDA) to the given 00081 * ST in the given WN tree. 00082 * 00083 * WN_is_constant_expr: 00084 * Return TRUE if we have an OPR_INTCONST or an OPR_CONST; otherwise 00085 * return FALSE. 00086 * 00087 * Macros yielding OPCODE information: 00088 * ----------------------------------- 00089 * 00090 * WN_opc_rtype: 00091 * The OPC result type. 00092 * 00093 * WN_opc_dtype: 00094 * The OPC descriptor type. 00095 * 00096 * WN_opc_operator: 00097 * The OPC operator (OPR). 00098 * 00099 * WN_opc_name: 00100 * The OPC name in the form of a string. 00101 * 00102 * INTR_is_adrtmp: 00103 * An ADRTMP intrinsic opcode. 00104 * 00105 * INTR_is_valtmp: 00106 * An VALTMP intrinsic opcode. 00107 * 00108 * Functions yielding WN subtree information 00109 * ---------------------------------------- 00110 * 00111 * WN_intrinsic_name: 00112 * The name of the function or macro representing the intrinsic. 00113 * Special handling is needed when the name is NULL. 00114 * 00115 * WN_intrinsic_return_ty: 00116 * Map the intrinsic code to a return type. If no return type 00117 * is known, then use the result type of the OPCODE as the 00118 * return type. 00119 * 00120 * WN_intrinsic_return_to_param: 00121 * TRUE when the given return type is returned through the first 00122 * parameter; FALSE when returning through pregs. 00123 * 00124 * Functions yielding WN subtree information 00125 * ---------------------------------------- 00126 * 00127 * WN_Get_PtrAdd_Intconst: 00128 * Given the two operands of an ADD expression, see if this 00129 * can be considered a pointer addition, and if it is return 00130 * a pointer to an INTCONST that can be normalized w.r.t. the 00131 * size of the pointed_ty; if the pointed_ty has size 1, then 00132 * just return the integral expression operand when this should 00133 * be considered a pointer addition; otherwise return NULL when 00134 * this should not be considered a pointer addition. 00135 * 00136 * WN_Tree_Type: 00137 * The TY denoting the type of a WN expression. For typeless 00138 * WNs (e.g. statements), the TY will be "void" in C terminology. 00139 * Similarly, there may be expression we cannot sensibly type, 00140 * e.g. for MLOADs, in which case we return an inaccurate type. 00141 * For MLOADs we return the type of a field at the given offset 00142 * and of the given size, provided the size is known statically; 00143 * otherwise we return the base-type. 00144 * 00145 * Functions modifying a WN subtree 00146 * -------------------------------- 00147 * 00148 * Remove_Skips: 00149 * Removes any sequences of statements marked to be skipped by 00150 * whirl2f or whirl2c (FLIST_SKIP_BEGIN/CLIST_SKIP_BEGIN). 00151 * 00152 * Restore_Skips: 00153 * Restores the modifications done in a call to Remove_Skips. 00154 * 00155 * ==================================================================== 00156 * ==================================================================== 00157 */ 00158 00159 typedef mINT64 STAB_OFFSET; 00160 00161 #define WN_agoto_addr(wn) WN_kid0(wn) 00162 00163 #define WN_condbr_cond(wn) WN_kid0(wn) 00164 00165 #define WN_compgoto_num_cases(wn) WN_num_entries(wn) 00166 #define WN_compgoto_idx(wn) WN_kid0(wn) 00167 #define WN_compgoto_table(wn) WN_kid1(wn) 00168 #define WN_compgoto_has_default_case(wn) (WN_kid_count(wn) == 3) 00169 00170 #define WN_switch_num_cases(wn) WN_num_entries(wn) 00171 #define WN_switch_has_default_case(wn) (WN_kid_count(wn) == 3) 00172 00173 extern UINT WN_num_var_refs(WN *wn, const ST *st, STAB_OFFSET st_ofst); 00174 00175 #define WN_opc_rtype(wn) WN_rtype(wn) 00176 #define WN_opc_operator(wn) WN_operator(wn) 00177 #define WN_opc_dtype(wn) WN_desc(wn) 00178 #define WN_opc_name(wn) OPCODE_name(WN_opcode(wn)) 00179 00180 #define WN_is_constant_expr(wn) \ 00181 (WN_opc_operator(wn) == OPR_INTCONST || WN_opc_operator(wn) == OPR_CONST) 00182 00183 #define INTR_is_adrtmp(intrn) \ 00184 ((intrn) == INTRN_U4I1ADRTMP || \ 00185 (intrn) == INTRN_U4I2ADRTMP || \ 00186 (intrn) == INTRN_U4I4ADRTMP || \ 00187 (intrn) == INTRN_U4I8ADRTMP || \ 00188 (intrn) == INTRN_U4F4ADRTMP || \ 00189 (intrn) == INTRN_U4F8ADRTMP || \ 00190 (intrn) == INTRN_U4FQADRTMP || \ 00191 (intrn) == INTRN_U4C4ADRTMP || \ 00192 (intrn) == INTRN_U4C8ADRTMP || \ 00193 (intrn) == INTRN_U4CQADRTMP || \ 00194 (intrn) == INTRN_U4VADRTMP || \ 00195 (intrn) == INTRN_U8I1ADRTMP || \ 00196 (intrn) == INTRN_U8I2ADRTMP || \ 00197 (intrn) == INTRN_U8I4ADRTMP || \ 00198 (intrn) == INTRN_U8I8ADRTMP || \ 00199 (intrn) == INTRN_U8F4ADRTMP || \ 00200 (intrn) == INTRN_U8F8ADRTMP || \ 00201 (intrn) == INTRN_U8FQADRTMP || \ 00202 (intrn) == INTRN_U8C4ADRTMP || \ 00203 (intrn) == INTRN_U8C8ADRTMP || \ 00204 (intrn) == INTRN_U8CQADRTMP || \ 00205 (intrn) == INTRN_U8VADRTMP) 00206 00207 #define INTR_is_valtmp(intrn) \ 00208 ((intrn) == INTRN_I4VALTMP || \ 00209 (intrn) == INTRN_I8VALTMP || \ 00210 (intrn) == INTRN_F4VALTMP || \ 00211 (intrn) == INTRN_F8VALTMP || \ 00212 (intrn) == INTRN_FQVALTMP || \ 00213 (intrn) == INTRN_C4VALTMP || \ 00214 (intrn) == INTRN_C8VALTMP || \ 00215 (intrn) == INTRN_CQVALTMP) 00216 00217 #define WN_Skip_Parm(arg) \ 00218 ((arg)!=NULL && WN_opc_operator(arg) == OPR_PARM? WN_kid0(arg) : arg) 00219 00220 extern TY_IDX Get_Field_Type(TY_IDX base, int field_id); 00221 00222 extern const char * WN_intrinsic_name(INTRINSIC intr_opc); 00223 extern TY_IDX WN_intrinsic_return_ty(OPCODE wn_opc, 00224 INTRINSIC intr_opc, 00225 const WN *call); 00226 extern BOOL WN_intrinsic_return_to_param(TY_IDX return_ty); 00227 00228 extern WN *WN_Get_PtrAdd_Intconst(WN *wn0, 00229 WN *wn1, 00230 TY_IDX pointed_ty); 00231 extern TY_IDX WN_Tree_Type(const WN *wn); 00232 00233 00234 typedef struct 00235 { 00236 WN *parent; /* Block node containing an xLIST_SKIP_BEGIN pragma */ 00237 WN *first; /* First node to be skipped */ 00238 WN *last; /* Last node to be skipped */ 00239 } W2CF_SKIP_ITEM; 00240 00241 extern void Remove_Skips(WN *ablock, 00242 W2CF_SKIP_ITEM *skip_info, 00243 INT *next_info_idx, 00244 INT max_info_idx, 00245 BOOL clist); 00246 00247 extern void Restore_Skips(const W2CF_SKIP_ITEM *skip_info, 00248 INT number_of_items, 00249 BOOL clist); 00250 00251 #endif /* wn_attr_INCLUDED */