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
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086 #ifndef CG_SWP_TARGET_INCLUDED
00087 #define CG_SWP_TARGET_INCLUDED
00088
00089 #include "tn.h"
00090 #include "op.h"
00091
00092 class CG_LOOP;
00093 class CG_LOOP_DEF;
00094
00095
00096
00097 enum BASE_UPDATE {
00098 NO_BASE_UPDATE = 0,
00099 REG_BASE_UPDATE = 1,
00100 IMM_BASE_UPDATE = 2,
00101 };
00102
00103 #ifdef TARG_IA64
00104
00105
00106
00107 extern void SWP_Exp_COPY(TN *result, TN *opnd, OPS *ops);
00108
00109 extern INT32 SWP_Max_Slots_Per_Cycle();
00110
00111 void SWP_Loop_Init_Fini(bool is_doloop,
00112 INT stage_count,
00113 OPS *prolog_ops,
00114 OPS *body_ops,
00115 OPS *epilog_ops);
00116
00117 extern BOOL Prepare_Loop_For_SWP_1(CG_LOOP& cl, bool trace);
00118
00119 extern BOOL Prepare_Loop_For_SWP_2(CG_LOOP& cl, bool trace);
00120
00121 extern void Convert_While_Loop_to_Fully_Predicated_Form(CG_LOOP& cl);
00122
00123 extern BOOL Remove_Non_Definite_Dependence(CG_LOOP &cl, bool cg_loop_init, bool trace);
00124
00125 extern BASE_UPDATE OP_base_update_kind(OP *op);
00126
00127 extern INT32 OP_base_opnd_num(OP *op);
00128
00129 extern INT32 OP_base_res_num(OP *op);
00130
00131 extern INT32 OP_incr_opnd_num(OP *op);
00132
00133 extern BOOL Imm_Value_In_Range(OP *op, INT64 imm);
00134
00135 extern void Gen_SWP_Branch(CG_LOOP &cl, bool is_doloop);
00136
00137 extern void Gen_SWP_Branch_Predict(BB *body, BB *prolog, BB *epilog);
00138
00139 extern void Undo_SWP_Branch(CG_LOOP &cl, bool is_doloop);
00140
00141 extern void Gen_Implicit_Prefetches(CG_LOOP &cl, bool trace);
00142
00143 inline TN* Base_update_tn(OP *op)
00144 {
00145 if (OP_load(op)) {
00146 if (OP_results(op) == 2)
00147 return OP_result(op,1);
00148 } else if (OP_store(op)) {
00149 if (OP_results(op) == 1)
00150 return OP_result(op,0);
00151 }
00152 return NULL;
00153 }
00154
00155 #else
00156
00157
00158
00159 #define SWP_Exp_COPY(x,y,z) Exp_COPY(x,y,z)
00160
00161 inline INT32 SWP_Max_Slots_Per_Cycle() {return 1;}
00162
00163
00164 void inline
00165 SWP_Loop_Init_Fini(bool is_doloop,
00166 INT stage_count,
00167 OPS *prolog_ops,
00168 OPS *body_ops,
00169 OPS *epilog_ops)
00170 {
00171 }
00172
00173
00174 inline BOOL Prepare_Loop_For_SWP_1(CG_LOOP& cl, bool trace)
00175 {
00176 return FALSE;
00177 }
00178
00179 inline BOOL Prepare_Loop_For_SWP_2(CG_LOOP& cl, bool trace)
00180 {
00181 return FALSE;
00182 }
00183
00184 inline void Convert_While_Loop_to_Fully_Predicated_Form(CG_LOOP& cl)
00185 {
00186 }
00187
00188 inline BOOL Remove_Non_Definite_Dependence(CG_LOOP &cl, bool cg_loop_init, bool trace)
00189 {
00190 return TRUE;
00191 }
00192
00193 inline BASE_UPDATE OP_base_update_kind(OP *op)
00194 {
00195 return NO_BASE_UPDATE;
00196 }
00197
00198 inline BOOL Imm_Value_In_Range(OP *op, INT64 imm)
00199 {
00200 return FALSE;
00201 }
00202
00203 inline void Gen_SWP_Branch(CG_LOOP &cl, bool is_doloop) { }
00204
00205 inline void Gen_SWP_Branch_Predict(BB *body, BB *prolog, BB *epilog) { }
00206
00207 inline void Undo_SWP_Branch(CG_LOOP &cl, bool is_doloop) { }
00208
00209 inline void Gen_Implicit_Prefetches(CG_LOOP &cl, bool trace) { }
00210
00211 inline TN* Base_update_tn(OP *op) { return NULL; }
00212
00213 #endif
00214
00215 #endif