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 #include "defs.h"
00047 #include "erglob.h"
00048 #include "ercg.h"
00049 #include "tracing.h"
00050 #include "config.h"
00051 #include "config_targ_opt.h"
00052 #include "tn.h"
00053 #include "cg_flags.h"
00054 #include "op.h"
00055 #include "cgexp.h"
00056 #include "cgexp_internals.h"
00057 #include "whirl2ops.h"
00058 #include "config_opt.h"
00059
00060 void
00061 Initialize_Branch_Variants(void)
00062 {
00063
00064 }
00065
00066
00067
00068
00069 TOP
00070 Pick_Compare_TOP (VARIANT *variant, TN **src1, TN **src2, OPS *ops)
00071 {
00072 TOP cmp = TOP_UNDEFINED;
00073
00074 if (*src1 != NULL && TN_has_value(*src1)) {
00075
00076 TN *tmp = *src1;
00077 *src1 = *src2;
00078 *src2 = tmp;
00079 *variant = Invert_BR_Variant(*variant);
00080 }
00081
00082 if (*src2 != NULL && TN_is_zero(*src2)) {
00083 switch (*variant) {
00084 case V_BR_U8LT:
00085 case V_BR_U4LT:
00086 *variant = V_BR_NEVER; break;
00087 case V_BR_U8GE:
00088 case V_BR_U4GE:
00089 *variant = V_BR_ALWAYS; break;
00090
00091 case V_BR_U4LE:
00092 *variant = V_BR_U4EQ; break;
00093
00094 case V_BR_U8LE:
00095 *variant = V_BR_U8EQ; break;
00096 }
00097 }
00098
00099
00100
00101
00102 if (*src2 == NULL)
00103 return TOP_UNDEFINED;
00104
00105 return cmp;
00106 }
00107
00108
00109
00110
00111 static void Expand_Split_Branch( TOP cmp_opcode, TN* src1_lo, TN* src2_lo,
00112 TOP jmp_opcode, TN* targ, OPS* ops )
00113 {
00114 switch( cmp_opcode ){
00115 case TOP_cmp64: cmp_opcode = TOP_cmp32; break;
00116 case TOP_cmpi64: cmp_opcode = TOP_cmpi32; break;
00117 case TOP_test64: cmp_opcode = TOP_test32; break;
00118 case TOP_testi64: cmp_opcode = TOP_testi32; break;
00119 default:
00120 FmtAssert( false, ("NYI") );
00121 }
00122
00123 TN* src1_hi = Get_TN_Pair( src1_lo );
00124 TN* src2_hi = Get_TN_Pair( src2_lo );
00125
00126 if( src2_hi == NULL ){
00127 if( TN_has_value( src2_lo ) ){
00128 const INT64 val = TN_value( src2_lo ) >> 32;
00129 src2_hi = Gen_Literal_TN( val, 4 );
00130
00131 } else {
00132 DevWarn( "The higher 32-bit of TN%d is treated as 0\n",
00133 TN_number(src2_lo) );
00134 src2_hi = Build_TN_Like( src2_lo );
00135 Build_OP( TOP_ldc32, src2_hi, Gen_Literal_TN(0,4), ops );
00136 }
00137 }
00138
00139 if( src1_hi == NULL ){
00140 DevWarn( "The higher 32-bit of TN%d is treated as 0\n",
00141 TN_number(src1_lo) );
00142 src1_hi = Build_TN_Like( src1_lo );
00143 Build_OP( TOP_ldc32, src1_hi, Gen_Literal_TN(0,4), ops );
00144 }
00145
00146 TN* rflags = Rflags_TN();
00147
00148 BB* bb_entry = Cur_BB;
00149 BB* bb_then = Gen_And_Insert_BB_After( bb_entry );
00150 BB* bb_then1 = Gen_And_Insert_BB_After( bb_then );
00151
00152 BB* bb_exit = Gen_And_Insert_BB_After( bb_then1 );
00153 const LABEL_IDX bb_exit_label = Gen_Label_For_BB( bb_exit );
00154
00155 FmtAssert( TN_is_label(targ), ("NYI") );
00156 const LABEL_IDX targ_label = TN_label( targ );
00157
00158 BB_branch_wn(bb_entry) = WN_Create(OPC_TRUEBR,1);
00159 WN_kid0(BB_branch_wn(bb_entry)) = NULL;
00160 WN_label_number(BB_branch_wn(bb_entry)) = targ_label;
00161
00162 BB_branch_wn(bb_then) = WN_Create(OPC_TRUEBR,1);
00163 WN_kid0(BB_branch_wn(bb_then)) = NULL;
00164 WN_label_number(BB_branch_wn(bb_then)) = bb_exit_label;
00165
00166 BB_branch_wn(bb_then1) = WN_Create(OPC_TRUEBR,1);
00167 WN_kid0(BB_branch_wn(bb_then1)) = NULL;
00168 WN_label_number(BB_branch_wn(bb_then1)) = targ_label;
00169
00170
00171 {
00172 if( jmp_opcode != TOP_je ){
00173 TOP jmp = jmp_opcode;
00174 switch( jmp ){
00175 case TOP_jge: jmp = TOP_jg; break;
00176 case TOP_jae: jmp = TOP_ja; break;
00177 case TOP_jle: jmp = TOP_jl; break;
00178 case TOP_jbe: jmp = TOP_jb; break;
00179 }
00180
00181 Build_OP( cmp_opcode, rflags, src1_hi, src2_hi, ops );
00182 Build_OP( jmp, rflags, targ, ops );
00183 }
00184
00185 if( &New_OPs != ops )
00186 OPS_Append_Ops( &New_OPs, ops );
00187
00188 Process_New_OPs();
00189 BB_Append_Ops( bb_entry, &New_OPs );
00190 OPS_Init( &New_OPs );
00191 OPS_Init( ops );
00192 }
00193
00194
00195 if( jmp_opcode != TOP_jne ){
00196 OPS* bb_then_ops = &New_OPs;
00197 TOP rev_jmp_opcode = CGTARG_Invert( jmp_opcode );
00198
00199 switch( rev_jmp_opcode ){
00200 case TOP_jge: rev_jmp_opcode = TOP_jg; break;
00201 case TOP_jae: rev_jmp_opcode = TOP_ja; break;
00202 case TOP_jle: rev_jmp_opcode = TOP_jl; break;
00203 case TOP_jbe: rev_jmp_opcode = TOP_jb; break;
00204 }
00205
00206 Build_OP( cmp_opcode, rflags, src1_hi, src2_hi, bb_then_ops );
00207 Build_OP( rev_jmp_opcode, rflags, Gen_Label_TN( bb_exit_label, 0 ), bb_then_ops );
00208
00209 total_bb_insts = 0;
00210 Last_Processed_OP = NULL;
00211 Process_New_OPs();
00212 BB_Append_Ops( bb_then, bb_then_ops );
00213 OPS_Init( bb_then_ops );
00214 }
00215
00216
00217 {
00218 OPS* bb_then1_ops = &New_OPs;
00219 TOP jmp = jmp_opcode;
00220 switch( jmp_opcode ){
00221 case TOP_jg: jmp = TOP_ja; break;
00222 case TOP_jge: jmp = TOP_jae; break;
00223 case TOP_jl: jmp = TOP_jb; break;
00224 case TOP_jle: jmp = TOP_jbe; break;
00225 }
00226
00227 Build_OP( cmp_opcode, rflags, src1_lo, src2_lo, bb_then1_ops );
00228 Build_OP( jmp, rflags, targ, bb_then1_ops );
00229
00230 total_bb_insts = 0;
00231 Last_Processed_OP = NULL;
00232 Process_New_OPs();
00233 BB_Append_Ops( bb_then1, bb_then1_ops );
00234 OPS_Init( bb_then1_ops );
00235 }
00236
00237 Cur_BB = bb_exit;
00238 }
00239
00240
00241 static void Expand_Ordered_Branch( TOP cmp_opcode, TN* src1, TN* src2,
00242 TOP jmp_opcode, TN* targ, OPS* ops )
00243 {
00244 TN* rflags = Rflags_TN();
00245
00246
00247 if (jmp_opcode == TOP_jb || jmp_opcode == TOP_jbe ||
00248 jmp_opcode == TOP_jae || jmp_opcode == TOP_ja) {
00249
00250 Build_OP( cmp_opcode, rflags, src1, src2, ops );
00251 Build_OP( jmp_opcode, rflags, targ, ops );
00252
00253 } else if (jmp_opcode == TOP_jne) {
00254
00255 BB* bb_entry = Cur_BB;
00256 BB* bb_first = Gen_And_Append_BB( bb_entry );
00257 BB* bb_second = Gen_And_Append_BB( bb_first );
00258 BB* bb_exit = Gen_And_Append_BB( bb_second );
00259
00260 const LABEL_IDX bb_first_label = Gen_Label_For_BB( bb_first );
00261 const LABEL_IDX bb_second_label = Gen_Label_For_BB( bb_second );
00262 const LABEL_IDX bb_exit_label = Gen_Label_For_BB( bb_exit );
00263
00264 OPS* bb_first_ops;
00265 OPS* bb_second_ops;
00266
00267 BB_branch_wn(bb_entry) = WN_Create(OPC_TRUEBR,1);
00268 WN_kid0(BB_branch_wn(bb_entry)) = NULL;
00269 WN_label_number(BB_branch_wn(bb_entry)) = bb_second_label;
00270
00271 BB_branch_wn(bb_first) = WN_Create(OPC_TRUEBR,1);
00272 WN_kid0(BB_branch_wn(bb_first)) = NULL;
00273 WN_label_number(BB_branch_wn(bb_first)) = bb_exit_label;
00274
00275 BB_branch_wn(bb_second) = WN_Create(OPC_TRUEBR,1);
00276 WN_kid0(BB_branch_wn(bb_second)) = NULL;
00277 WN_label_number(BB_branch_wn(bb_second)) = TN_label( targ );
00278
00279
00280 Build_OP( cmp_opcode, rflags, src1, src2, ops );
00281 Build_OP( TOP_jp, rflags, Gen_Label_TN( bb_second_label, 0 ), ops );
00282 if( &New_OPs != ops )
00283 OPS_Append_Ops( &New_OPs, ops );
00284 Process_New_OPs();
00285 BB_Append_Ops( bb_entry, &New_OPs );
00286 OPS_Init( &New_OPs );
00287 OPS_Init( ops );
00288
00289
00290 bb_first_ops = &New_OPs;
00291 Build_OP( cmp_opcode, rflags, src1, src2, bb_first_ops );
00292 Build_OP( TOP_je, rflags, Gen_Label_TN( bb_exit_label, 0 ), bb_first_ops );
00293 total_bb_insts = 0;
00294 Last_Processed_OP = NULL;
00295 Process_New_OPs();
00296 BB_Append_Ops( bb_first, bb_first_ops );
00297 OPS_Init( bb_first_ops );
00298
00299
00300 bb_second_ops = &New_OPs;
00301 Build_OP( TOP_jmp, targ, bb_second_ops );
00302 total_bb_insts = 0;
00303 Last_Processed_OP = NULL;
00304 Process_New_OPs();
00305 BB_Append_Ops( bb_second, bb_second_ops );
00306 OPS_Init( bb_second_ops );
00307
00308 Cur_BB = bb_exit;
00309
00310 } else if (jmp_opcode == TOP_je) {
00311
00312 BB* bb_entry = Cur_BB;
00313 BB* bb_first = Gen_And_Append_BB( bb_entry );
00314 BB* bb_second = Gen_And_Append_BB( bb_first );
00315 BB* bb_exit = Gen_And_Append_BB( bb_second );
00316
00317 const LABEL_IDX bb_first_label = Gen_Label_For_BB( bb_first );
00318 const LABEL_IDX bb_second_label = Gen_Label_For_BB( bb_second );
00319 const LABEL_IDX bb_exit_label = Gen_Label_For_BB( bb_exit );
00320
00321 OPS* bb_first_ops;
00322 OPS* bb_second_ops;
00323
00324 BB_branch_wn(bb_entry) = WN_Create(OPC_TRUEBR,1);
00325 WN_kid0(BB_branch_wn(bb_entry)) = NULL;
00326 WN_label_number(BB_branch_wn(bb_entry)) = bb_exit_label;
00327
00328 BB_branch_wn(bb_first) = WN_Create(OPC_TRUEBR,1);
00329 WN_kid0(BB_branch_wn(bb_first)) = NULL;
00330 WN_label_number(BB_branch_wn(bb_first)) = bb_exit_label;
00331
00332 BB_branch_wn(bb_second) = WN_Create(OPC_TRUEBR,1);
00333 WN_kid0(BB_branch_wn(bb_second)) = NULL;
00334 WN_label_number(BB_branch_wn(bb_second)) = TN_label( targ );
00335
00336
00337 Build_OP( cmp_opcode, rflags, src1, src2, ops );
00338 Build_OP( TOP_jne, rflags, Gen_Label_TN( bb_exit_label, 0 ), ops );
00339 if( &New_OPs != ops )
00340 OPS_Append_Ops( &New_OPs, ops );
00341 Process_New_OPs();
00342 BB_Append_Ops( bb_entry, &New_OPs );
00343 OPS_Init( &New_OPs );
00344 OPS_Init( ops );
00345
00346
00347 bb_first_ops = &New_OPs;
00348 Build_OP( cmp_opcode, rflags, src1, src2, bb_first_ops );
00349 Build_OP( TOP_jp, rflags, Gen_Label_TN( bb_exit_label, 0 ), bb_first_ops );
00350 total_bb_insts = 0;
00351 Last_Processed_OP = NULL;
00352 Process_New_OPs();
00353 BB_Append_Ops( bb_first, bb_first_ops );
00354 OPS_Init( bb_first_ops );
00355
00356
00357 bb_second_ops = &New_OPs;
00358 Build_OP( TOP_jmp, targ, bb_second_ops );
00359 total_bb_insts = 0;
00360 Last_Processed_OP = NULL;
00361 Process_New_OPs();
00362 BB_Append_Ops( bb_second, bb_second_ops );
00363 OPS_Init( bb_second_ops );
00364
00365 Cur_BB = bb_exit;
00366
00367 }
00368
00369 return;
00370 }
00371
00372 void Expand_Branch ( TN *targ, TN *src1, TN *src2, VARIANT variant, OPS *ops)
00373 {
00374 const BOOL false_br = V_false_br(variant);
00375 VARIANT cond = V_br_condition(variant);
00376 TN *tmp;
00377
00378
00379 if ( Trace_Exp2 ) {
00380 fprintf ( TFile, "<cgexp> Translating %s branch:\n",
00381 (false_br ? "false" : "true") );
00382 }
00383
00384 FmtAssert( cond <= V_BR_LAST, ("unexpected variant in Expand_Branch"));
00385 FmtAssert( cond != V_BR_NONE, ("BR_NONE variant in Expand_Branch"));
00386
00387 const TOP cmp = Pick_Compare_TOP (&cond, &src1, &src2, ops);
00388 if ( Trace_Exp2 && cond != variant) {
00389 fprintf ( TFile, "<cgexp> transformed branch cond = %lld\n", cond);
00390 }
00391
00392 switch (cond) {
00393 case V_BR_ALWAYS:
00394 case V_BR_NEVER:
00395 Is_True(cmp == TOP_UNDEFINED,
00396 ("unexpected compare op for %s", BR_Variant_Name(cond)));
00397 if ((cond == V_BR_ALWAYS) ^ false_br) {
00398
00399 Build_OP (TOP_jmp, targ, ops);
00400 }
00401 break;
00402 case V_BR_PEQ:
00403 case V_BR_PNE:
00404 case V_BR_P_TRUE:
00405 FmtAssert(FALSE, ("unimplemented branch variant in Expand_Branch"));
00406 break;
00407 default:
00408 {
00409 TOP jmp_opcode = TOP_UNDEFINED;
00410 TOP cmp_opcode;
00411
00412 BOOL is_64bit = FALSE;
00413
00414 switch ( cond ){
00415 case V_BR_I4GE:
00416 case V_BR_U4GE:
00417 case V_BR_I4GT:
00418 case V_BR_U4GT:
00419 case V_BR_I4LE:
00420 case V_BR_U4LE:
00421 case V_BR_I4LT:
00422 case V_BR_U4LT:
00423 case V_BR_I4EQ:
00424 case V_BR_U4EQ:
00425 case V_BR_I4NE:
00426 case V_BR_U4NE:
00427 case V_BR_FEQ:
00428 case V_BR_FNE:
00429 case V_BR_FGT:
00430 case V_BR_FGE:
00431 case V_BR_FLT:
00432 case V_BR_FLE:
00433 is_64bit = FALSE;
00434 break;
00435
00436 case V_BR_I8GE:
00437 case V_BR_U8GE:
00438 case V_BR_I8GT:
00439 case V_BR_U8GT:
00440 case V_BR_I8LE:
00441 case V_BR_U8LE:
00442 case V_BR_I8LT:
00443 case V_BR_U8LT:
00444 case V_BR_I8EQ:
00445 case V_BR_U8EQ:
00446 case V_BR_I8NE:
00447 case V_BR_U8NE:
00448 case V_BR_DEQ:
00449 case V_BR_DNE:
00450 case V_BR_DGT:
00451 case V_BR_DGE:
00452 case V_BR_DLT:
00453 case V_BR_DLE:
00454 is_64bit = TRUE;
00455 break;
00456
00457 case V_BR_QEQ:
00458 case V_BR_QNE:
00459 case V_BR_QGT:
00460 case V_BR_QGE:
00461 case V_BR_QLT:
00462 case V_BR_QLE:
00463
00464
00465
00466 is_64bit = TRUE;
00467 break;
00468
00469 default:
00470 FmtAssert(FALSE, ("unimplemented branch variant in Expand_Branch"));
00471 }
00472
00473 if( TN_has_value(src1) ){
00474 tmp = Gen_Register_TN( ISA_REGISTER_CLASS_integer,
00475 is_64bit ? 8 : 4 );
00476 Build_OP( is_64bit ? TOP_ldc64 : TOP_ldc32, tmp, src1, ops );
00477 src1 = tmp;
00478 }
00479
00480 if( TN_has_value(src2) ){
00481 const INT64 imm = TN_value(src2);
00482
00483 if( imm == 0 ){
00484 cmp_opcode = is_64bit ? TOP_test64 : TOP_test32;
00485 src2 = src1;
00486
00487 } else {
00488 cmp_opcode = is_64bit ? TOP_cmpi64 : TOP_cmpi32;
00489
00490 const ISA_OPERAND_INFO* oinfo = ISA_OPERAND_Info( cmp_opcode );
00491 const ISA_OPERAND_VALTYP* vtype = ISA_OPERAND_INFO_Operand(oinfo, 1);
00492 const ISA_LIT_CLASS lc = ISA_OPERAND_VALTYP_Literal_Class(vtype);
00493
00494 if( !ISA_LC_Value_In_Class(imm, lc) ){
00495 TN* tmp_tn = Build_TN_Like( src1 );
00496
00497 if( is_64bit && Is_Target_32bit() ){
00498 extern void Expand_Split_UOP( OPERATOR, TYPE_ID, TN*, TN*, OPS* );
00499 Expand_Split_UOP( OPR_INTCONST, MTYPE_I8, tmp_tn, src2, ops );
00500 } else {
00501 Build_OP( is_64bit ? TOP_ldc64 : TOP_ldc32, tmp_tn, src2, ops );
00502 }
00503
00504 cmp_opcode = is_64bit ? TOP_cmp64 : TOP_cmp32;
00505 src2 = tmp_tn;
00506 }
00507 }
00508
00509 } else {
00510 cmp_opcode = is_64bit ? TOP_cmp64 : TOP_cmp32;
00511 }
00512
00513
00514
00515 FmtAssert( cmp == TOP_UNDEFINED, ("cmp is defined") );
00516
00517 BOOL flip_opnds = FALSE;
00518
00519 switch( cond ){
00520 case V_BR_I4GE:
00521 case V_BR_I8GE: jmp_opcode = TOP_jge; break;
00522 case V_BR_U4GE:
00523 case V_BR_U8GE: jmp_opcode = TOP_jae; break;
00524 case V_BR_I4GT:
00525 case V_BR_I8GT: jmp_opcode = TOP_jg; break;
00526 case V_BR_U4GT:
00527 case V_BR_U8GT: jmp_opcode = TOP_ja; break;
00528 case V_BR_I4LE:
00529 case V_BR_I8LE: jmp_opcode = TOP_jle; break;
00530 case V_BR_U4LE:
00531 case V_BR_U8LE: jmp_opcode = TOP_jbe; break;
00532 case V_BR_I4LT:
00533 case V_BR_I8LT: jmp_opcode = TOP_jl; break;
00534 case V_BR_U4LT:
00535 case V_BR_U8LT: jmp_opcode = TOP_jb; break;
00536 case V_BR_I4EQ:
00537 case V_BR_I8EQ:
00538 case V_BR_U4EQ:
00539 case V_BR_U8EQ: jmp_opcode = TOP_je; break;
00540 case V_BR_I4NE:
00541 case V_BR_I8NE:
00542 case V_BR_U4NE:
00543 case V_BR_U8NE: jmp_opcode = TOP_jne; break;
00544
00545 case V_BR_QEQ:
00546 jmp_opcode = false_br ? TOP_jne : TOP_je;
00547 cmp_opcode = TOP_fucomi;
00548 break;
00549 case V_BR_FEQ:
00550 case V_BR_DEQ:
00551 jmp_opcode = false_br ? TOP_jne : TOP_je;
00552 cmp_opcode = Is_Target_SSE2()
00553 ? ( is_64bit ? TOP_comisd : TOP_comiss ) : TOP_fucomi;
00554 break;
00555 case V_BR_QNE:
00556 jmp_opcode = false_br ? TOP_je : TOP_jne;
00557 cmp_opcode = TOP_fucomi;
00558 break;
00559 case V_BR_FNE:
00560 case V_BR_DNE:
00561 jmp_opcode = false_br ? TOP_je : TOP_jne;
00562 cmp_opcode = Is_Target_SSE2()
00563 ? ( is_64bit ? TOP_comisd : TOP_comiss ) : TOP_fucomi;
00564 break;
00565 case V_BR_QGT:
00566 jmp_opcode = false_br ? TOP_jbe : TOP_ja;
00567 cmp_opcode = TOP_fucomi;
00568 break;
00569 case V_BR_FGT:
00570 case V_BR_DGT:
00571 jmp_opcode = false_br ? TOP_jbe : TOP_ja;
00572 cmp_opcode = Is_Target_SSE2()
00573 ? ( is_64bit ? TOP_comisd : TOP_comiss ) : TOP_fucomi;
00574 break;
00575 case V_BR_QGE:
00576 jmp_opcode = false_br ? TOP_jb : TOP_jae;
00577 cmp_opcode = TOP_fucomi;
00578 break;
00579 case V_BR_FGE:
00580 case V_BR_DGE:
00581 jmp_opcode = false_br ? TOP_jb : TOP_jae;
00582 cmp_opcode = Is_Target_SSE2()
00583 ? ( is_64bit ? TOP_comisd : TOP_comiss ) : TOP_fucomi;
00584 break;
00585 case V_BR_QLT:
00586 flip_opnds = TRUE;
00587 jmp_opcode = false_br ? TOP_jbe : TOP_ja;
00588 cmp_opcode = TOP_fucomi;
00589 break;
00590 case V_BR_FLT:
00591 case V_BR_DLT:
00592 flip_opnds = TRUE;
00593 jmp_opcode = false_br ? TOP_jbe : TOP_ja;
00594 cmp_opcode = Is_Target_SSE2()
00595 ? ( is_64bit ? TOP_comisd : TOP_comiss ) : TOP_fucomi;
00596 break;
00597 case V_BR_QLE:
00598 flip_opnds = false_br;
00599 jmp_opcode = false_br ? TOP_jb : TOP_jbe;
00600 cmp_opcode = TOP_fucomi;
00601 break;
00602 case V_BR_FLE:
00603 case V_BR_DLE:
00604 flip_opnds = false_br;
00605 jmp_opcode = false_br ? TOP_jb : TOP_jbe;
00606 cmp_opcode = Is_Target_SSE2()
00607 ? ( is_64bit ? TOP_comisd : TOP_comiss ) : TOP_fucomi;
00608 break;
00609 default:
00610 FmtAssert(FALSE, ("unimplemented branch variant in Expand_Branch"));
00611 }
00612
00613 if( !TOP_is_flop( cmp_opcode ) )
00614 FmtAssert( !false_br, ("false_br for int cmp") );
00615
00616 if (flip_opnds) {
00617 tmp = src1;
00618 src1 = src2;
00619 src2 = tmp;
00620 }
00621
00622 if( Is_Target_32bit() &&
00623 ( cond >= V_BR_I8EQ0 &&
00624 cond <= V_BR_U8LE ) ){
00625 Expand_Split_Branch( cmp_opcode, src1, src2, jmp_opcode, targ, ops );
00626
00627 } else {
00628
00629 if (Force_IEEE_Comparisons &&
00630 TOP_is_flop( cmp_opcode ) ){
00631 Expand_Ordered_Branch( cmp_opcode, src1, src2, jmp_opcode, targ, ops);
00632 } else {
00633 TN* rflags = Rflags_TN();
00634
00635 Build_OP( cmp_opcode, rflags, src1, src2, ops );
00636 Build_OP( jmp_opcode, rflags, targ, ops );
00637 }
00638 }
00639 }
00640
00641 break;
00642 }
00643 }
00644
00645 void Exp_Indirect_Branch (TN *targ_reg, OPS *ops)
00646 {
00647 Build_OP(TOP_ijmp, targ_reg, ops);
00648 }
00649
00650 void Exp_Local_Jump(BB *bb, INT64 offset, OPS *ops)
00651 {
00652 FmtAssert(FALSE, ("NYI: Exp_Local_Jump"));
00653 }
00654
00655 void Exp_Return (TN *return_address, int sp_adjust, OPS *ops)
00656 {
00657 if( sp_adjust == 0 )
00658 Build_OP( TOP_ret, return_address, ops );
00659 else
00660 Build_OP( TOP_reti, Gen_Literal_TN(sp_adjust,4), ops );
00661 }
00662
00663 void Exp_Call( OPERATOR opr, TN *return_address, TN *target, OPS *ops )
00664 {
00665 TOP top = TOP_call;
00666
00667 if( opr == OPR_CALL ){
00668 top = TOP_call;
00669
00670 } else if( opr == OPR_ICALL ){
00671 top = TOP_icall;
00672
00673 } else
00674 FmtAssert( false, ("NYI") );
00675
00676
00677 Build_OP( top, target, ops );
00678 }