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 #define INST_BYTES 16
00049 #define DEFAULT_LONG_BRANCH_LIMIT (2000000 * INST_BYTES)
00050
00051
00052
00053 #define DEFAULT_BRP_BRANCH_LIMIT (256 * INST_BYTES)
00054 #define MIN_BRANCH_DISP (2097151 * INST_BYTES)
00055
00056 inline INT32 CGTARG_Branch_Taken_Penalty(void)
00057 {
00058 return CGTARG_branch_taken_penalty_overridden ?
00059 CGTARG_branch_taken_penalty : 1;
00060 }
00061
00062 inline INT32 CGTARG_Issue_Width(void)
00063 {
00064 return Is_Target_Itanium() ? 6 : 1;
00065 }
00066
00067 inline BOOL
00068 CGTARG_Use_Brlikely(float branch_taken_probability)
00069 {
00070 return FALSE;
00071 }
00072
00073 inline BOOL
00074 CGTARG_Can_Predicate_Calls()
00075 {
00076 return TRUE;
00077 }
00078
00079
00080 inline BOOL
00081 CGTARG_Can_Predicate_Returns()
00082 {
00083 return TRUE;
00084 }
00085
00086 inline BOOL
00087 CGTARG_Can_Predicate_Branches()
00088 {
00089 return TRUE;
00090 }
00091
00092 inline INT
00093 CGTARG_Text_Alignment (void)
00094 {
00095 return 32;
00096 }
00097
00098 inline TOP
00099 CGTARG_Noop_Top(void)
00100 {
00101 return TOP_nop;
00102 }
00103
00104 inline TOP
00105 CGTARG_Noop_Top(ISA_EXEC_UNIT_PROPERTY unit)
00106 {
00107 switch (unit) {
00108 case ISA_EXEC_PROPERTY_I_Unit:
00109 case ISA_EXEC_PROPERTY_I2_Unit:
00110 return TOP_nop_i;
00111 case ISA_EXEC_PROPERTY_M_Unit:
00112 return TOP_nop_m;
00113 case ISA_EXEC_PROPERTY_B_Unit:
00114 case ISA_EXEC_PROPERTY_B2_Unit:
00115 return TOP_nop_b;
00116 case ISA_EXEC_PROPERTY_F_Unit:
00117 return TOP_nop_f;
00118 default:
00119 return TOP_nop;
00120 }
00121 }
00122
00123 inline TOP
00124 CGTARG_Simulated_Top(OP *op, ISA_EXEC_UNIT_PROPERTY unit)
00125 {
00126
00127 TOP top = OP_code(op);
00128
00129
00130 if (!TOP_is_simulated(top)) return top;
00131
00132
00133 switch (top) {
00134 case TOP_mov_t_ar_r:
00135 switch (unit) {
00136 case ISA_EXEC_PROPERTY_I_Unit:
00137 case ISA_EXEC_PROPERTY_I2_Unit:
00138 return TOP_mov_t_ar_r_i;
00139 case ISA_EXEC_PROPERTY_M_Unit:
00140 return TOP_mov_t_ar_r_m;
00141 default:
00142 FmtAssert(FALSE, ("unexpected ISA_EXEC_UNIT_PROPERTY type"));
00143 }
00144 case TOP_mov_t_ar_i:
00145 switch (unit) {
00146 case ISA_EXEC_PROPERTY_I_Unit:
00147 case ISA_EXEC_PROPERTY_I2_Unit:
00148 return TOP_mov_t_ar_i_i;
00149 case ISA_EXEC_PROPERTY_M_Unit:
00150 return TOP_mov_t_ar_i_m;
00151 default:
00152 FmtAssert(FALSE, ("unexpected ISA_EXEC_UNIT_PROPERTY type"));
00153 }
00154 case TOP_mov_f_ar:
00155 switch (unit) {
00156 case ISA_EXEC_PROPERTY_I_Unit:
00157 case ISA_EXEC_PROPERTY_I2_Unit:
00158 return TOP_mov_f_ar_i;
00159 case ISA_EXEC_PROPERTY_M_Unit:
00160 return TOP_mov_f_ar_m;
00161 default:
00162 FmtAssert(FALSE, ("unexpected ISA_EXEC_UNIT_PROPERTY type"));
00163 }
00164 case TOP_break:
00165 switch (unit) {
00166 case ISA_EXEC_PROPERTY_I_Unit:
00167 case ISA_EXEC_PROPERTY_I2_Unit:
00168 return TOP_break_i;
00169 case ISA_EXEC_PROPERTY_M_Unit:
00170 return TOP_break_m;
00171 case ISA_EXEC_PROPERTY_B_Unit:
00172 case ISA_EXEC_PROPERTY_B2_Unit:
00173 return TOP_break_b;
00174 case ISA_EXEC_PROPERTY_F_Unit:
00175 return TOP_break_f;
00176 default:
00177 FmtAssert(FALSE, ("unexpected ISA_EXEC_UNIT_PROPERTY type"));
00178 }
00179 case TOP_chk_s:
00180 switch (unit) {
00181 case ISA_EXEC_PROPERTY_I_Unit:
00182 case ISA_EXEC_PROPERTY_I2_Unit:
00183 return TOP_chk_s_i;
00184 case ISA_EXEC_PROPERTY_M_Unit:
00185 return TOP_chk_s_m;
00186 default:
00187 FmtAssert(FALSE, ("unexpected ISA_EXEC_UNIT_PROPERTY type"));
00188 }
00189 case TOP_cmp_lt_and:
00190 case TOP_cmp_lt_or:
00191 case TOP_cmp_lt_or_andcm:
00192 case TOP_cmp_le_and:
00193 case TOP_cmp_le_or:
00194 case TOP_cmp_le_or_andcm:
00195 case TOP_cmp_gt_and:
00196 case TOP_cmp_gt_or:
00197 case TOP_cmp_gt_or_andcm:
00198 case TOP_cmp_ge_and:
00199 case TOP_cmp_ge_or:
00200 case TOP_cmp_ge_or_andcm:
00201 case TOP_cmp_lt_orcm:
00202 case TOP_cmp_lt_andcm:
00203 case TOP_cmp_lt_and_orcm:
00204 case TOP_cmp_le_orcm:
00205 case TOP_cmp_le_andcm:
00206 case TOP_cmp_le_and_orcm:
00207 case TOP_cmp_gt_orcm:
00208 case TOP_cmp_gt_andcm:
00209 case TOP_cmp_gt_and_orcm:
00210 case TOP_cmp_ge_orcm:
00211 case TOP_cmp_ge_andcm:
00212 case TOP_cmp_ge_and_orcm:
00213 case TOP_cmp4_lt_and:
00214 case TOP_cmp4_lt_or:
00215 case TOP_cmp4_lt_or_andcm:
00216 case TOP_cmp4_le_and:
00217 case TOP_cmp4_le_or:
00218 case TOP_cmp4_le_or_andcm:
00219 case TOP_cmp4_gt_and:
00220 case TOP_cmp4_gt_or:
00221 case TOP_cmp4_gt_or_andcm:
00222 case TOP_cmp4_ge_and:
00223 case TOP_cmp4_ge_or:
00224 case TOP_cmp4_ge_or_andcm:
00225 case TOP_cmp4_lt_orcm:
00226 case TOP_cmp4_lt_andcm:
00227 case TOP_cmp4_lt_and_orcm:
00228 case TOP_cmp4_le_orcm:
00229 case TOP_cmp4_le_andcm:
00230 case TOP_cmp4_le_and_orcm:
00231 case TOP_cmp4_gt_orcm:
00232 case TOP_cmp4_gt_andcm:
00233 case TOP_cmp4_gt_and_orcm:
00234 case TOP_cmp4_ge_orcm:
00235 case TOP_cmp4_ge_andcm:
00236 case TOP_cmp4_ge_and_orcm:
00237 return top;
00238
00239 case TOP_nop:
00240 return CGTARG_Noop_Top(unit);
00241
00242 default:
00243
00244 return top;
00245 }
00246 }
00247
00248
00249
00250
00251
00252
00253 inline TN*
00254 CGTARG_Return_Enum_TN(OP *op, ISA_ENUM_CLASS_VALUE enum_class, INT *pos)
00255 {
00256 INT i;
00257
00258 for (i = 0; i < OP_opnds(op); ++i) {
00259 TN *opnd_tn = OP_opnd(op, i);
00260 if (TN_is_enum(opnd_tn) && (enum_class == TN_enum(opnd_tn))) {
00261 *pos = i;
00262 return opnd_tn;
00263 }
00264 }
00265
00266 return NULL;
00267 }
00268
00269 inline BOOL
00270 CGTARG_Is_OP_Barrier(OP *op)
00271 {
00272 return FALSE;
00273 }
00274
00275 inline BOOL
00276 CGTARG_Is_OP_Intrinsic(OP *op)
00277 {
00278 return OP_code(op) == TOP_intrncall;
00279 }
00280
00281 inline BOOL
00282 CGTARG_Is_Bad_Shift_Op (OP *op)
00283 {
00284 return FALSE;
00285 }
00286
00287 inline BOOL
00288 CGTARG_Is_Right_Shift_Op (OP *op)
00289 {
00290 switch (OP_code(op)) {
00291 case TOP_shr:
00292 case TOP_shr_u:
00293 case TOP_shrp:
00294 return TRUE;
00295 }
00296 return FALSE;
00297 }
00298
00299 inline BOOL
00300 CGTARG_Is_OP_Addr_Incr(OP *op)
00301 {
00302 TOP top = OP_code(op);
00303 return (top == TOP_adds || top == TOP_addl || top == TOP_addp4_i) &&
00304 TN_has_value(OP_opnd(op, 1)) &&
00305 OP_result(op, 0) == OP_opnd(op, 2);
00306 }
00307
00308 inline BOOL
00309 CGTARG_Can_daddu_Be_Folded(OP *op1, OP *op2)
00310 {
00311 return FALSE;
00312 }
00313
00314 inline TOP
00315 CGTARG_Copy_Op(UINT8 size, BOOL is_float)
00316 {
00317 if (is_float) {
00318 return TOP_mov_f;
00319 } else {
00320 return TOP_mov;
00321 }
00322 }
00323
00324 inline BOOL
00325 CGTARG_Have_Indexed_Mem_Insts(void)
00326 {
00327 return FALSE;
00328 }
00329
00330 inline BOOL
00331 Has_Single_FP_Condition_Code (void)
00332 {
00333 return FALSE;
00334 }
00335
00336 inline BOOL
00337 CGTARG_Is_OP_daddu(OP *op)
00338 {
00339 return FALSE;
00340 }
00341
00342 inline BOOL
00343 CGTARG_Can_Predicate()
00344 {
00345 return TRUE;
00346 }
00347
00348 extern TOP CGTARG_Get_unc_Variant(TOP top);
00349 extern void Make_Branch_Conditional(BB *bb);
00350
00351 inline BOOL
00352 CGTARG_Has_Branch_Predict(void)
00353 {
00354 return TRUE;
00355 }