Open64 (mfef90, whirl2f, and IR tools)  TAG: version-openad; SVN changeset: 916
wn_lower.h
Go to the documentation of this file.
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 #ifndef wn_lower_INCLUDED
00039 #define wn_lower_INCLUDED
00040 
00041 #include "opt_alias_interface.h"
00042 
00043 #ifdef __cplusplus
00044 extern "C" {
00045 #endif
00046 
00047 /* Note: LOWER_ACTIONS isn't an enum since we want to combine actions
00048  *       with |, which isn't allowed for enums under C++.
00049  */
00050 typedef INT64 LOWER_ACTIONS;
00051 
00052 #define LOWER_NULL                0x000000000000ll
00053 #define LOWER_DO_LOOP             0x000000000001ll
00054 #define LOWER_DO_WHILE            0x000000000002ll
00055 #define LOWER_WHILE_DO            0x000000000004ll
00056 #define LOWER_IF                  0x000000000008ll
00057 #define LOWER_COMPLEX             0x000000000010ll
00058 #define LOWER_ARRAY               0x000000000020ll
00059 #define LOWER_SPLIT_CONST_OFFSETS 0x000000000040ll
00060 #define LOWER_ENTRY_EXIT          0x000000000080ll
00061 #define LOWER_CALL                0x000000000100ll
00062 #define LOWER_SPLIT_SYM_ADDRS     0x000000000200ll
00063 #define LOWER_IO_STATEMENT        0x000000000400ll
00064 #define LOWER_MSTORE              0x000000000800ll
00065 #define LOWER_CVT                 0x000000001000ll
00066 #define LOWER_MP                  0x000000002000ll
00067 #define LOWER_8X_ARRAY            0x000000004000ll
00068 #define LOWER_REGION              0x000000008000ll
00069 #define LOWER_QUAD                0x000000010000ll
00070 #define LOWER_COMPGOTO            0x000000020000ll
00071 #define LOWER_MADD                0x000000040000ll
00072 #define LOWER_INTRINSIC           0x000000080000ll
00073 #define LOWER_INLINE_INTRINSIC    0x000000100000ll
00074 #define LOWER_TOP_LEVEL_ONLY      0x000000200000ll
00075 #define LOWER_REGION_EXITS        0x000000400000ll
00076 #define LOWER_INL_STACK_INTRINSIC 0x000000800000ll
00077 #define LOWER_PREFETCH_MAPS       0x000001000000ll
00078 #define LOWER_ALIAS_MAPS          0x000002000000ll
00079 #define LOWER_DEPGRAPH_MAPS       0x000004000000ll
00080 #define LOWER_PARITY_MAPS         0x000008000000ll
00081 #define LOWER_PICCALL             0x000010000000ll
00082 #define LOWER_BASE_INDEX          0x000020000000ll
00083 #define LOWER_ASSERT              0x000040000000ll
00084 #define LOWER_FREQUENCY_MAPS      0x000080000000ll
00085 #define LOWER_FORMAL_REF          0x000100000000ll
00086 #define LOWER_UPLEVEL             0x000200000000ll
00087 #define LOWER_ENTRY_FORMAL_REF    0x000400000000ll
00088 #define LOWER_SHORTCIRCUIT        0x000800000000ll
00089 #define LOWER_TREEHEIGHT          0x001000000000ll
00090 #define LOWER_RETURN_VAL          0x002000000000ll
00091 #define LOWER_MLDID_MSTID         0x004000000000ll
00092 #define LOWER_BIT_FIELD_ID        0x008000000000ll
00093 #define LOWER_BITS_OP             0x010000000000ll 
00094 #define LOWER_UPC_TO_INTR         0x020000000000ll
00095 #define LOWER_UPC_INTRINSIC       0x040000000000ll
00096 #define LOWER_UPC_CONSISTENCY     0x080000000000ll
00097 #define LOWER_UPC_FORALL          0x100000000000ll
00098 #define LOWER_UPC_MFIELD          0x200000000000ll
00099 
00100 
00101 #define LOWER_TO_CG               0x800000000000ll
00102 
00103 
00104 /* 
00105  * LOWER_TOP_LEVEL_ONLY applies to scf nodes.  If it's set, we don't
00106  * call the lowerer recursively 
00107  */
00108 
00109 /*
00110  * LOWER_REGION removes the hierarchy from the tree but
00111  * preserves information by keeping the region id (RID) for
00112  * the nearest enclosing REGION in the RID_map of each statement.
00113  * We may change the interface to CG so that this lowering is
00114  * not required.  We use any call to WN_Lower
00115  * to compute the REGION_tree which is kept in the parent, first_kid,
00116  * next, last_kid fields of the RID.  This tree could also be computed
00117  * on the fly when the optimizer is emitting REGION nodes.
00118  */
00119 
00120 #define LOWER_SCF       (LOWER_DO_LOOP | LOWER_DO_WHILE | LOWER_WHILE_DO | LOWER_IF)
00121 
00122 #define LOWER_ALL_MAPS  (LOWER_PREFETCH_MAPS | LOWER_ALIAS_MAPS | LOWER_DEPGRAPH_MAPS | LOWER_PARITY_MAPS | LOWER_FREQUENCY_MAPS)
00123 
00124 /*
00125  * During map lowering (if enabled) complex  [real, imag] and quad [hi, lo]
00126  * are marked using these qualities
00127  *
00128  * This allows the CG dep graph builder (or LNO, wopt alias analysis) to
00129  * disambiguate using these qualities.
00130  *
00131  */
00132 typedef enum
00133 {
00134   PARITY_UNKNOWN=       ~0x0,
00135   PARITY_COMPLEX_REAL=  0x01,
00136   PARITY_COMPLEX_IMAG=  0x02,
00137   PARITY_QUAD_HI=       0x04,
00138   PARITY_QUAD_LO=       0x08
00139 } PARITY;
00140 
00141 
00142 /* return the parity associated with a WN */
00143 extern PARITY WN_parity(WN *tree);
00144 
00145 /* return true if parity shows independence */
00146 extern BOOL WN_parity_independent(WN *wn1, WN *wn2);
00147 
00148 /*
00149  * lowering specific initialization
00150  */
00151 extern void Lower_Init(void);
00152 extern void Lowering_Finalize(void);
00153 
00154 extern FLD_HANDLE FLD_And_Offset_From_Field_Id (TY_IDX  struct_ty_idx, 
00155                                                 UINT    field_id, 
00156                                                 UINT&   cur_field_id,
00157                                                 UINT64& offset);
00158 
00159 extern WN *WN_Lower(WN *tree, LOWER_ACTIONS actions, struct ALIAS_MANAGER *alias, char *msg);
00160 
00161 /*
00162  * lower an scf node but not things underneath it 
00163  */
00164 extern WN *lower_scf_non_recursive(WN *block, WN *tree, LOWER_ACTIONS actions);
00165 
00166 /* 
00167  * lower a block node and everything underneath it  
00168  */
00169 extern WN *lower_block(WN *tree, LOWER_ACTIONS actions);
00170 
00171 /*
00172  * character string for action
00173  */
00174 extern const char *LOWER_ACTIONS_name(LOWER_ACTIONS action);
00175 
00176 #ifdef __cplusplus
00177 }
00178 #endif
00179 
00180 /*
00181  * return alignment consistant with offset and alignment
00182  */
00183 extern UINT32 compute_offset_alignment(INT32 offset, UINT32 align);
00184 
00185 /*
00186  * return alignment consistant with TY, ST and offset
00187  */
00188 extern TY *compute_alignment_type(WN *tree, TY *type, INT64 offset);
00189 
00190 /*
00191  * check trace flags and generate appropriate dumps
00192  */
00193 extern void WN_Lower_Checkdump(char *msg, WN *tree, LOWER_ACTIONS actions);
00194 
00195 /*
00196  * lower M or lower WHIRL to conform to unsigned 64-bit instruction only ISA
00197  */
00198 extern void U64_lower_wn(WN *, BOOL);
00199 
00200 #endif /* wn_lower_INCLUDED */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines