Open64 (mfef90, whirl2f, and IR tools)  TAG: version-openad; SVN changeset: 916
p_globals.m
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 /* USMID:  "\n@(#)5.0_pl/macros/p_globals.m     5.1     04/29/99 21:22:31\n" */
00037  
00038 
00039 /*****************\
00040 |* MISCELLANEOUS *|
00041 \*****************/
00042 
00043 # define BLK_HEAD_IDX                   1
00044 
00045 
00046 /********************\
00047 |* SIZES AND LIMITS *|
00048 \********************/
00049 
00050 # define BLK_STK_SIZE                   20
00051 # define MAX_BLK_LOOP_NUM             4095
00052 
00053 
00054 /******************************\
00055 |* OBJECT REPLACEMENT STRINGS *|
00056 \******************************/
00057 
00058 # define CURR_BLK                       blk_stk[blk_stk_idx].fld.blk_type
00059 # define CURR_BLK_ERR                   blk_stk[blk_stk_idx].fld.blk_err
00060 # define CURR_BLK_FIRST_SH_IDX          blk_stk[blk_stk_idx].fld.first_sh_idx
00061 # define CURR_BLK_FND_DEFAULT           blk_stk[blk_stk_idx].fld.fnd_default
00062 # define CURR_BLK_LABEL                 blk_stk[blk_stk_idx].fld.label_idx
00063 # define CURR_BLK_NAME                  blk_stk[blk_stk_idx].fld.name_idx
00064 # define CURR_BLK_NO_EXEC               blk_stk[blk_stk_idx].fld.no_exec
00065 # define CURR_BLK_DEF_LINE              blk_stk[blk_stk_idx].fld.def_line
00066 # define CURR_BLK_DEF_COLUMN            blk_stk[blk_stk_idx].fld.def_column
00067 
00068 # define BLK_BLOCKABLE_DIR_SH_IDX(IDX)  blk_stk[IDX].fld.blkbl_dir_sh_idx
00069 # define BLK_BLOCKABLE_NEST_OK(IDX)     blk_stk[IDX].fld.blkbl_nest_ok
00070 # define BLK_BLOCKABLE_NUM_LCVS(IDX)    blk_stk[IDX].fld.blkbl_num_lcvs
00071 # define BLK_CASE_DEFAULT_LBL_COL_NUM(IDX)                                     \
00072                                         blk_stk[IDX].fld.multiuse_opnd.col_num
00073 # define BLK_CASE_DEFAULT_LBL_FLD(IDX)  blk_stk[IDX].fld.multiuse_opnd.fld
00074 # define BLK_CASE_DEFAULT_LBL_IDX(IDX)  blk_stk[IDX].fld.multiuse_opnd.idx
00075 # define BLK_CASE_DEFAULT_LBL_LINE_NUM(IDX)                                    \
00076                                         blk_stk[IDX].fld.multiuse_opnd.line_num
00077 # define BLK_CASE_DEFAULT_LBL_OPND(IDX) blk_stk[IDX].fld.multiuse_opnd
00078 # define BLK_CIF_SCOPE_ID(IDX)          blk_stk[IDX].fld.tc_temp_idx
00079 # define BLK_CYCLE_STMT(IDX)            blk_stk[IDX].fld.has_cycle_stmt
00080 # define BLK_DEF_COLUMN(IDX)            blk_stk[IDX].fld.def_column
00081 # define BLK_DEF_LINE(IDX)              blk_stk[IDX].fld.def_line
00082 # define BLK_DIR_NEST_CHECK_NUM_LCVS(IDX) blk_stk[IDX].fld.dir_nest_num_lcvs
00083 # define BLK_DIR_NEST_CHECK_SH_IDX(IDX) blk_stk[IDX].fld.dir_nest_ck_sh_idx
00084 # define BLK_DO_TYPE(IDX)               blk_stk[IDX].fld.do_type
00085 # define BLK_DO_VAR_COL_NUM(IDX)        blk_stk[IDX].fld.multiuse_opnd.col_num
00086 # define BLK_DO_VAR_FLD(IDX)            blk_stk[IDX].fld.multiuse_opnd.fld
00087 # define BLK_DO_VAR_IDX(IDX)            blk_stk[IDX].fld.multiuse_opnd.idx
00088 # define BLK_DO_VAR_LINE_NUM(IDX)       blk_stk[IDX].fld.multiuse_opnd.line_num
00089 # define BLK_DO_VAR_OPND(IDX)           blk_stk[IDX].fld.multiuse_opnd
00090 # define BLK_ENDDO_PARALLEL_SH_IDX(IDX) blk_stk[IDX].fld.multiuse_opnd.idx
00091 # define BLK_ENDPDO_SH_IDX(IDX)         blk_stk[IDX].fld.multiuse_opnd.idx
00092 # define BLK_ERR(IDX)                   blk_stk[IDX].fld.blk_err
00093 # define BLK_EXIT_STMT(IDX)             blk_stk[IDX].fld.has_exit_stmt
00094 # define BLK_FIRST_SH_IDX(IDX)          blk_stk[IDX].fld.first_sh_idx
00095 # define BLK_FND_DEFAULT(IDX)           blk_stk[IDX].fld.fnd_default
00096 # define BLK_HAS_NESTED_LOOP(IDX)       blk_stk[IDX].fld.has_nested_loop
00097 # define BLK_INC_TEMP_IDX(IDX)          blk_stk[IDX].fld.inc_temp_idx
00098 # define BLK_INDUC_TEMP_IDX(IDX)        blk_stk[IDX].fld.induc_temp_idx
00099 # define BLK_INTERCHANGE_NUM_LCVS(IDX)  blk_stk[IDX].fld.intchg_num_lcvs
00100 # define BLK_INTERCHANGE_DIR_SH_IDX(IDX)  blk_stk[IDX].fld.intchg_dir_sh_idx
00101 # define BLK_IS_PARALLEL_REGION(IDX)    blk_stk[IDX].fld.parallel_region
00102 # define BLK_LABEL(IDX)                 blk_stk[IDX].fld.label_idx
00103 # define BLK_LAST_CPNT_IDX(IDX)         blk_stk[IDX].fld_long.field32_5_1
00104 # define BLK_LOOP_NUM(IDX)              blk_stk[IDX].fld.loop_num
00105 # define BLK_NAME(IDX)                  blk_stk[IDX].fld.name_idx
00106 # define BLK_NO_EXEC(IDX)               blk_stk[IDX].fld.no_exec
00107 # define BLK_NUM_CASES(IDX)             blk_stk[IDX].fld.top_lbl_idx
00108 # define BLK_SKIP_LBL_IDX(IDX)          blk_stk[IDX].fld.skip_lbl_idx
00109 # define BLK_START_TEMP_IDX(IDX)        blk_stk[IDX].fld.start_temp_idx
00110 # define BLK_TC_TEMP_IDX(IDX)           blk_stk[IDX].fld.tc_temp_idx
00111 # define BLK_TOP_LBL_IDX(IDX)           blk_stk[IDX].fld.top_lbl_idx
00112 # define BLK_TYPE(IDX)                  blk_stk[IDX].fld.blk_type
00113 # define BLK_UNNAMED_INTERFACE(IDX)     blk_stk[IDX].fld.inc_temp_idx
00114 
00115 # define BLK_AT_IDX(IDX)                blk_stk[IDX].fld.top_lbl_idx
00116 # define BLK_BD_IDX(IDX)                blk_stk[IDX].fld_long.field32_5_1
00117 # define BLK_CN_IDX(IDX)                blk_stk[IDX].fld.induc_temp_idx
00118 # define BLK_CP_IDX(IDX)                blk_stk[IDX].fld.start_temp_idx
00119 # define BLK_NP_IDX(IDX)                blk_stk[IDX].fld.skip_lbl_idx
00120 # define BLK_SB_IDX(IDX)                blk_stk[IDX].fld_long.field32_5_2
00121 # define BLK_SN_IDX(IDX)                blk_stk[IDX].fld.label_idx
00122 # define BLK_TYP_IDX(IDX)               blk_stk[IDX].fld_long.field32_6_2
00123 
00124 /***********************************\
00125 |* CONDITIONAL REPLACEMENT STRINGS *|
00126 \***********************************/
00127 
00128 /* Nonzero = TRUE if statement can't be in current block */
00129 
00130 # define STMT_CANT_BE_IN_BLK(STMT, BLKTYPE)                                    \
00131                                 (((stmt_in_blk[STMT] >> BLKTYPE) & 1) != 0)
00132 
00133 /* Nonzero = TRUE if statement can be in current block */
00134 
00135 # define STMT_LEGAL_IN_BLK(STMT, BLKTYPE)                                      \
00136                                 (((stmt_in_blk[STMT] >> BLKTYPE) & 1) == 0)
00137 
00138 # define STMT_OUT_OF_ORDER(CNTXT,STMT)                                         \
00139                                 (CNTXT > stmt_top_cat[STMT])
00140 
00141 # define SET_DIRECTIVE_STATE(REGION)    directive_state |= (1 << REGION)
00142 
00143 # define CLEAR_DIRECTIVE_STATE(REGION)  directive_state &= (~(1 << REGION))
00144 
00145 
00146 # ifdef _SAVE_IO_STMT
00147 # define INSERT_IO_START                                                       \
00148         {int    _ir_idx; int    _cn_idx;                                       \
00149          _cn_idx = ntr_io_string_constant();                                   \
00150          NTR_IR_TBL(_ir_idx);                                                  \
00151          IR_OPR(_ir_idx)        = Start_Io_Opr;                                \
00152          IR_TYPE_IDX(_ir_idx)   = TYPELESS_DEFAULT_TYPE;                       \
00153          IR_LINE_NUM(_ir_idx)   = stmt_start_line;                             \
00154          IR_COL_NUM(_ir_idx)    = stmt_start_col;                              \
00155          IR_LINE_NUM_L(_ir_idx) = stmt_start_line;                             \
00156          IR_COL_NUM_L(_ir_idx)  = stmt_start_col;                              \
00157          IR_FLD_L(_ir_idx)      = CN_Tbl_Idx;                                  \
00158          IR_IDX_L(_ir_idx)      = _cn_idx;                                     \
00159          gen_sh(Before, stmt_type, stmt_start_line,                            \
00160                    stmt_start_col, FALSE, FALSE, TRUE);                        \
00161          SH_IR_IDX(SH_PREV_IDX(curr_stmt_sh_idx)) = _ir_idx;                   \
00162          SH_P2_SKIP_ME(SH_PREV_IDX(curr_stmt_sh_idx)) = TRUE;                  \
00163         }
00164 # else
00165 # define INSERT_IO_START
00166 # endif
00167 
00168 # ifdef _SAVE_IO_STMT
00169 # define INSERT_IO_END                                                         \
00170         {int    _ir_idx;                                                       \
00171          NTR_IR_TBL(_ir_idx);                                                  \
00172          IR_TYPE_IDX(_ir_idx) = TYPELESS_DEFAULT_TYPE;                         \
00173          IR_OPR(_ir_idx)      = End_Io_Opr;                                    \
00174          IR_LINE_NUM(_ir_idx) = stmt_start_line;                               \
00175          IR_COL_NUM(_ir_idx)  = stmt_start_col;                                \
00176          gen_sh(After, stmt_type, stmt_start_line,                             \
00177                    stmt_start_col, FALSE, FALSE, TRUE);                        \
00178          SH_IR_IDX(curr_stmt_sh_idx)     = _ir_idx;                            \
00179          SH_P2_SKIP_ME(curr_stmt_sh_idx) = TRUE;                               \
00180         }
00181 # else
00182 # define INSERT_IO_END
00183 # endif
00184 
00185 
00186 /***********************************************\
00187 |* STATEMENT/FUNCTION-LIKE REPLACEMENT STRINGS *|
00188 \***********************************************/
00189 
00190 # define MATCHED_TOKEN_CLASS(class)                                            \
00191                 get_token (class)
00192 
00193 # define POP_BLK_STK                                                           \
00194                 blk_stk_idx--;
00195 
00196 # define PUSH_BLK_STK(NEW_BLK)                                                 \
00197                 TBL_REALLOC_CK (blk_stk, 1);                                   \
00198                 CLEAR_TBL_NTRY(blk_stk, blk_stk_idx);                          \
00199                 CURR_BLK_DEF_LINE       = stmt_start_line;                     \
00200                 CURR_BLK_DEF_COLUMN     = stmt_start_col;                      \
00201                 CURR_BLK                = NEW_BLK;
00202 
00203 /* Only attach the current SH to a valid parent blocking stmt SH.  Note that  */
00204 /* blocking stmts at the procedure level have no parent because they are      */
00205 /* already at the outermost level.                                            */
00206 
00207 # define LINK_TO_PARENT_BLK                                                    \
00208                 { int   _blk_idx;                                              \
00209                 if (BLK_TYPE(blk_stk_idx - 1) == Doall_Blk ||                  \
00210                     BLK_TYPE(blk_stk_idx - 1) == Do_Parallel_Blk) {            \
00211                    _blk_idx = blk_stk_idx - 2;                                 \
00212                 } else {                                                       \
00213                    _blk_idx = blk_stk_idx - 1;                                 \
00214                 }                                                              \
00215                 if ((Do_Blk <= BLK_TYPE(_blk_idx)  &&                          \
00216                     BLK_TYPE(_blk_idx) <= Case_Blk) ||                         \
00217                    (Parallel_Blk <= BLK_TYPE(_blk_idx)  &&                     \
00218                     BLK_TYPE(_blk_idx) <= Parallel_Case_Blk)) {                \
00219                    SH_PARENT_BLK_IDX(curr_stmt_sh_idx) =                       \
00220                          BLK_FIRST_SH_IDX(_blk_idx);                           \
00221                 }}
00222 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines