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 /* ==================================================================== 00037 * ==================================================================== 00038 * 00039 * 00040 * Revision history: 00041 * dd-mmm-95 - Original Version 00042 * 00043 * Description: Holds translation defintions used by all modules. 00044 * 00045 * ==================================================================== 00046 * ==================================================================== 00047 */ 00048 00049 #ifndef CWH_DEFINES_INCLUDED 00050 #define CWH_DEFINES_INCLUDED 00051 00052 #include "defs.h" /* for mUINT32 */ 00053 00054 /* dubious casts and types for use with PDGCS */ 00055 00056 typedef INT64 OFFSET_64 ; 00057 typedef unsigned long ULONG ; 00058 typedef long SLONG ; 00059 #define cast_to_TY(x) ((TY_IDX) (mUINT32)x) /* eraxxon: replace (void *) */ 00060 #define cast_to_WN(x) ((WN *) (void *)x) 00061 #define cast_to_ST(x) ((ST *) (void *)x) 00062 #define cast_to_LB(x) ((LABEL_IDX) (mUINT32)x) /* eraxxon: replace (void *) */ 00063 #define cast_to_uint(x) ((unsigned long) (void *)x) 00064 #define cast_to_int(x) ((long ) (void *)x) 00065 #define cast_to_void(x) ((void *)x) 00066 #define cast_to_STB(x) ((STB_pkt *) (void *)x) 00067 00068 00069 /* dump macros */ 00070 00071 #define DUMP_TY(ty) dump_ty(ty) 00072 #define DUMP_ST(st) dump_st(st) 00073 #define DUMP_LB(lb) dump_label(lb) 00074 #define DUMP_WN(wn) fdump_tree(stdout,wn); 00075 #define DUMP_STK cwh_stk_dump() 00076 00077 00078 extern void dump_ty (TY_IDX ty); 00079 extern void dump_st (ST * st); 00080 extern void dump_label(LABEL_IDX lb); 00081 00082 /* macros for operations on PDGCS arguments */ 00083 00084 #define bit_to_byte(a) (a >> 3) 00085 #define bit_to_byte_WN(a) (cwh_expr_bincalc(OPR_DIV,WN_COPY_Tree(a),WN_CreateIntconst (OPC_U4INTCONST,8))) 00086 #define byte_to_bit(a) (a << 3) 00087 #define test_flag(f,sh) ((INT32)((f >> sh) & 1)) 00088 00089 /* Symbol table levels */ 00090 00091 #define GLOBAL_LEVEL 1 00092 #define HOST_LEVEL GLOBAL_LEVEL + 1 00093 #define INTERNAL_LEVEL HOST_LEVEL + 1 00094 00095 /* Handy macros */ 00096 00097 #define WNOPR(w) (WN_operator(w)) 00098 #define WNRTY(w) (WN_rtype(w)) 00099 #define IS_GLOBAL_SYMTAB(s) (SYMTAB_level(s) == GLOBAL_LEVEL) 00100 #define IN_HOST_PU (CURRENT_SYMTAB == HOST_LEVEL) 00101 #define IN_NESTED_PU (CURRENT_SYMTAB >= INTERNAL_LEVEL) 00102 00103 #define RESULT_SIZE 16 00104 #define RESULT_ALIGN 8 00105 00106 00107 /* 00108 A WN and TY pair. The TY is that of the item the WN addresses because 00109 when a structure component is addressed, the TY of the LDA/LDID is the 00110 structure's, so the component's TY is recorded here. 00111 */ 00112 00113 typedef struct { 00114 WN * wn ; 00115 TY_IDX ty ; 00116 } W_node ; 00117 00118 #define W_wn(a) (a.wn) 00119 #define W_ty(a) (a.ty) 00120 #define iW_wn(a) (a->wn) 00121 #define iW_ty(a) (a->ty) 00122 00123 00124 /* 00125 structures to associate a list of ST's with a parent 00126 ST, eg: the elements of a COMMON with the common ST, 00127 or alternate entry points of a procedure. 00128 Just for DST information. 00129 */ 00130 00131 typedef struct blist { 00132 ST * element ; 00133 struct blist * nxt ; 00134 } ITEM ; 00135 00136 #define I_element(i) ((i)->element) 00137 #define I_next(i) ((i)->nxt) 00138 00139 typedef struct clist { 00140 ITEM * first ; 00141 ITEM * last ; 00142 INT32 nitems ; 00143 } LIST ; 00144 00145 #define L_first(l) ((l)->first) 00146 #define L_last(l) ((l)->last) 00147 #define L_num(l) ((l)->nitems) 00148 00149 00150 /* local constants */ 00151 00152 #define OPC_UNKNOWN 0 00153 #define MAX_ARY_DIMS 7 00154 #define NUM_LOG_KINDS 4 00155 00156 #define ANULL -1 00157 00158 /* Memory management */ 00159 extern MEM_POOL *FE_Mempool; 00160 00161 00162 /* 00163 * Calling convention for structure results. TODO: fix in FE. 00164 * 00165 * Would like to defer manipulation of ABI calling convention to BE. Unfortunately 00166 * both the MIPS and IA64 ABIs want to return small structure results in registers. 00167 * The BE handles this, but for structure results where the structure contains a 00168 * dope vector, the FE doesn't know how to initialize the dope (with eg: n_dim,type, 00169 * flags), if the function result is not passed as the first dummy argument. 00170 * It's easier to fix this in the conversion to whirl for now, & the macros 00171 * below control this. Example... 00172 * 00173 * TYPE VARYING_STRING 00174 * CHARACTER,DIMENSION(:),POINTER :: chars 00175 * ENDTYPE VARYING_STRING 00176 * 00177 * FUNCTION s_concat_c(.... 00178 * type(VARYING_STRING) :: s_concat_c 00179 * ALLOCATE(s_concat_c%chars(1:la+lb)) 00180 * iia = SIZE(s_concat_c%chars) 00181 * 00182 * Note this isn't in globals.m, because the size of the dope could be smaller than 00183 * the struct-in-regs size. (eg: scalar pointer on IA64). In that case, the result 00184 * will have to be passed as the 1st dummy. 00185 */ 00186 00187 00188 /* 00189 * Solaris workaround 00190 * when target machine is sparc, we want to keep "RESULT_SIZE" 00191 * original definition, otherwise it became a undefined symbol. 00192 */ 00193 00194 #ifdef TARG_MIPS 00195 #undef RESULT_SIZE 00196 #define RESULT_SIZE 16 00197 #endif 00198 00199 #ifndef SOURCE_TO_SOURCE 00200 #define SOURCE_TO_SOURCE 1 00201 #endif 00202 #ifdef TARG_IA32 00203 #undef RESULT_SIZE 00204 #define RESULT_SIZE 0 00205 #endif 00206 #ifdef TARG_IA64 00207 #undef RESULT_SIZE 00208 #define RESULT_SIZE 64 00209 #endif 00210 00211 #define STRUCT_BY_VALUE(ty) ((TY_kind(ty) == KIND_STRUCT) \ 00212 && (TY_size(ty) <= RESULT_SIZE) \ 00213 && !cwh_types_contains_dope(ty)) 00214 00215 00216 #endif /* CWH_DEFINES_INCLUDED */ 00217