00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037 #ifndef ff_utils_INCLUDED
00038 #define ff_utils_INCLUDED
00039
00054 #ifdef _KEEP_RCS_ID
00055 static char *ff_utils_rcs_id = "$Source$ $Revision$";
00056 #endif
00057
00058 #include "wn_core.h"
00059 #include "name.h"
00060 #include "dep_graph.h"
00061 #include "lwn_util.h"
00062 #include "reduc.h"
00063 #include "btree.h"
00064 #include "lno_bv.h"
00065
00066 #define Gather_Scalar_Refs 0x0001
00067 #define Gather_Array_Refs 0x0002
00068 #define Gather_Params 0x0004
00069 #define Gather_Other_Refs 0x0008
00070 #define Gather_Calls 0x0010
00071 #define Gather_IOs 0x0020
00072 #define Reset_Ref_Counter 0x1000
00073
00074 typedef enum {
00075 Failed=0,
00076 Succeeded=1,
00077 Succeeded_and_Inner_Loop_Removed=2,
00078
00079 Partially_fused=3,
00080
00081 Try_Level_By_Level=4
00082 } FISSION_FUSION_STATUS;
00083
00084 typedef STACK<SCALAR_REF> SCALAR_REF_STACK;
00085
00086
00087
00088
00089
00090 extern UINT Get_Stmt_For_Stmt_Dep_Graph(
00091 WN* source_wn, WN* sink_wn,
00092 WN** source_stmt_out, WN** sink_stmt_out);
00093
00094 extern INT Map_Stmt_To_Level_Graph(WN* wn, ARRAY_DIRECTED_GRAPH16 *sdg);
00095 extern void toplogical_reordering(WN* loop, UINT depth,
00096 ARRAY_DIRECTED_GRAPH16* adg);
00097
00098
00099
00100 extern BOOL Scalar_Variable_Renaming(WN* loop);
00101
00102 extern BOOL scalar_rename(WN* ref, HASH_TABLE<WN*,INT>* checked=NULL);
00103
00104
00105
00106
00107
00108
00109 extern void Fission_DU_Update(DU_MANAGER* Du_Mgr, REDUCTION_MANAGER* Red_Mgr,
00110 WN** wn_starts, WN** wn_ends, WN** wn_steps,
00111 UINT total_loops, WN** loop, BOOL index_DU_to_first=FALSE);
00112
00113
00114
00115
00116
00117
00118
00119 extern INT Lexical_Order(WN* wn1, WN* wn2);
00120
00121
00122
00123
00124 extern WN* Find_SCF_Inside(WN* parent_wn, OPCODE opc);
00125
00126 extern void FF_Mark_Inner_Loop_Info(WN* loop);
00127
00128 extern void Init_Ref_Stmt_Counter();
00129
00130 extern INT32 New_Gather_References(WN *wn, REF_LIST_STACK *writes,
00131 REF_LIST_STACK *reads, DOLOOP_STACK *stack,
00132 SCALAR_STACK *scalar_writes, SCALAR_STACK *scalar_reads,
00133 SCALAR_REF_STACK *params, MEM_POOL *pool,
00134 INT mode=Gather_Array_Refs | Gather_Scalar_Refs | Gather_Params);
00135
00136 BOOL Generate_Scalar_Dependence_For_Statement_Dependence_Graph(
00137 WN* in_loop,
00138 SCALAR_STACK *scalar_reads,
00139 SCALAR_STACK *scalar_writes,
00140 SCALAR_REF_STACK *params,
00141 ARRAY_DIRECTED_GRAPH16* sdg,
00142 REDUCTION_MANAGER* Red_Mgr,
00143 BIT_VECTOR *Expandable_Scalar_Set=NULL,
00144 BINARY_TREE<NAME2BIT> *mapping_dictionary=NULL
00145
00146
00147 );
00148
00149 BOOL Generate_Array_Dependence_For_Statement_Dependence_Graph(
00150 WN* in_loop,
00151 REF_LIST_STACK *reads,
00152 REF_LIST_STACK *writes,
00153 ARRAY_DIRECTED_GRAPH16* sdg,
00154 REDUCTION_MANAGER* Red_Mgr,
00155 ARRAY_DIRECTED_GRAPH16* adg);
00156
00157 extern ARRAY_DIRECTED_GRAPH16* Statement_Dependence_Graph;
00158
00159 extern ARRAY_DIRECTED_GRAPH16* Build_Statement_Dependence_Graph(
00160 WN* in_loop, REDUCTION_MANAGER* Red_Mgr,
00161 ARRAY_DIRECTED_GRAPH16* adg, WN_MAP sdm, MEM_POOL* pool);
00162
00163
00164 extern BOOL Edge_Is_Reduction_Dependence(EINDEX16 edge,
00165 ARRAY_DIRECTED_GRAPH16 *dg,
00166 REDUCTION_MANAGER *Red_Mgr);
00167
00168 #endif // ff_utils_INCLUDED
00169