comparison gcc/sel-sched.c @ 145:1830386684a0

gcc-9.2.0
author anatofuz
date Thu, 13 Feb 2020 11:34:05 +0900
parents 84e7813d76e9
children
comparison
equal deleted inserted replaced
131:84e7813d76e9 145:1830386684a0
1 /* Instruction scheduling pass. Selective scheduler and pipeliner. 1 /* Instruction scheduling pass. Selective scheduler and pipeliner.
2 Copyright (C) 2006-2018 Free Software Foundation, Inc. 2 Copyright (C) 2006-2020 Free Software Foundation, Inc.
3 3
4 This file is part of GCC. 4 This file is part of GCC.
5 5
6 GCC is free software; you can redistribute it and/or modify it under 6 GCC is free software; you can redistribute it and/or modify it under
7 the terms of the GNU General Public License as published by the Free 7 the terms of the GNU General Public License as published by the Free
29 #include "regs.h" 29 #include "regs.h"
30 #include "cfgbuild.h" 30 #include "cfgbuild.h"
31 #include "cfgcleanup.h" 31 #include "cfgcleanup.h"
32 #include "insn-config.h" 32 #include "insn-config.h"
33 #include "insn-attr.h" 33 #include "insn-attr.h"
34 #include "params.h"
35 #include "target.h" 34 #include "target.h"
36 #include "sched-int.h" 35 #include "sched-int.h"
37 #include "rtlhooks-def.h" 36 #include "rtlhooks-def.h"
38 #include "ira.h" 37 #include "ira.h"
39 #include "ira-int.h" 38 #include "ira-int.h"
44 #include "cfgloop.h" 43 #include "cfgloop.h"
45 #include "sel-sched-ir.h" 44 #include "sel-sched-ir.h"
46 #include "sel-sched-dump.h" 45 #include "sel-sched-dump.h"
47 #include "sel-sched.h" 46 #include "sel-sched.h"
48 #include "dbgcnt.h" 47 #include "dbgcnt.h"
48 #include "function-abi.h"
49 49
50 /* Implementation of selective scheduling approach. 50 /* Implementation of selective scheduling approach.
51 The below implementation follows the original approach with the following 51 The below implementation follows the original approach with the following
52 changes: 52 changes:
53 53
300 /* For every register, it has regs that are ok to rename into it. 300 /* For every register, it has regs that are ok to rename into it.
301 The register in question is always set. If not, this means 301 The register in question is always set. If not, this means
302 that the whole set is not computed yet. */ 302 that the whole set is not computed yet. */
303 HARD_REG_SET regs_for_rename[FIRST_PSEUDO_REGISTER]; 303 HARD_REG_SET regs_for_rename[FIRST_PSEUDO_REGISTER];
304 304
305 /* For every mode, this stores registers not available due to
306 call clobbering. */
307 HARD_REG_SET regs_for_call_clobbered[NUM_MACHINE_MODES];
308
309 /* All registers that are used or call used. */ 305 /* All registers that are used or call used. */
310 HARD_REG_SET regs_ever_used; 306 HARD_REG_SET regs_ever_used;
311 307
312 #ifdef STACK_REGS 308 #ifdef STACK_REGS
313 /* Stack registers. */ 309 /* Stack registers. */
323 HARD_REG_SET unavailable_hard_regs; 319 HARD_REG_SET unavailable_hard_regs;
324 320
325 /* These are *available* for renaming. */ 321 /* These are *available* for renaming. */
326 HARD_REG_SET available_for_renaming; 322 HARD_REG_SET available_for_renaming;
327 323
328 /* Whether this code motion path crosses a call. */ 324 /* The set of ABIs used by calls that the code motion path crosses. */
329 bool crosses_call; 325 unsigned int crossed_call_abis : NUM_ABI_IDS;
330 }; 326 };
331 327
332 /* A global structure that contains the needed information about harg 328 /* A global structure that contains the needed information about harg
333 regs. */ 329 regs. */
334 static struct hard_regs_data sel_hrd; 330 static struct hard_regs_data sel_hrd;
388 regset used_regs; 384 regset used_regs;
389 385
390 /* Pointer to the list of original insns definitions. */ 386 /* Pointer to the list of original insns definitions. */
391 def_list_t *original_insns; 387 def_list_t *original_insns;
392 388
393 /* True if a code motion path contains a CALL insn. */ 389 /* The set of ABIs used by calls that the code motion path crosses. */
394 bool crosses_call; 390 unsigned int crossed_call_abis : NUM_ABI_IDS;
395 }; 391 };
396 392
397 typedef struct fur_static_params *fur_static_params_p; 393 typedef struct fur_static_params *fur_static_params_p;
398 typedef struct cmpd_local_params *cmpd_local_params_p; 394 typedef struct cmpd_local_params *cmpd_local_params_p;
399 typedef struct moveop_static_params *moveop_static_params_p; 395 typedef struct moveop_static_params *moveop_static_params_p;
471 /* All newly emitted insns will have their uids greater than this value. */ 467 /* All newly emitted insns will have their uids greater than this value. */
472 static int first_emitted_uid; 468 static int first_emitted_uid;
473 469
474 /* Set of basic blocks that are forced to start new ebbs. This is a subset 470 /* Set of basic blocks that are forced to start new ebbs. This is a subset
475 of all the ebb heads. */ 471 of all the ebb heads. */
476 static bitmap_head _forced_ebb_heads; 472 bitmap forced_ebb_heads;
477 bitmap_head *forced_ebb_heads = &_forced_ebb_heads;
478 473
479 /* Blocks that need to be rescheduled after pipelining. */ 474 /* Blocks that need to be rescheduled after pipelining. */
480 bitmap blocks_to_reschedule = NULL; 475 bitmap blocks_to_reschedule = NULL;
481 476
482 /* True when the first lv set should be ignored when updating liveness. */ 477 /* True when the first lv set should be ignored when updating liveness. */
1066 init_regs_for_mode (machine_mode mode) 1061 init_regs_for_mode (machine_mode mode)
1067 { 1062 {
1068 int cur_reg; 1063 int cur_reg;
1069 1064
1070 CLEAR_HARD_REG_SET (sel_hrd.regs_for_mode[mode]); 1065 CLEAR_HARD_REG_SET (sel_hrd.regs_for_mode[mode]);
1071 CLEAR_HARD_REG_SET (sel_hrd.regs_for_call_clobbered[mode]);
1072 1066
1073 for (cur_reg = 0; cur_reg < FIRST_PSEUDO_REGISTER; cur_reg++) 1067 for (cur_reg = 0; cur_reg < FIRST_PSEUDO_REGISTER; cur_reg++)
1074 { 1068 {
1075 int nregs; 1069 int nregs;
1076 int i; 1070 int i;
1101 break; 1095 break;
1102 1096
1103 if (i >= 0) 1097 if (i >= 0)
1104 continue; 1098 continue;
1105 1099
1106 if (targetm.hard_regno_call_part_clobbered (cur_reg, mode))
1107 SET_HARD_REG_BIT (sel_hrd.regs_for_call_clobbered[mode],
1108 cur_reg);
1109
1110 /* If the CUR_REG passed all the checks above, 1100 /* If the CUR_REG passed all the checks above,
1111 then it's ok. */ 1101 then it's ok. */
1112 SET_HARD_REG_BIT (sel_hrd.regs_for_mode[mode], cur_reg); 1102 SET_HARD_REG_BIT (sel_hrd.regs_for_mode[mode], cur_reg);
1113 } 1103 }
1114 1104
1122 int cur_reg = 0; 1112 int cur_reg = 0;
1123 int cur_mode = 0; 1113 int cur_mode = 0;
1124 1114
1125 CLEAR_HARD_REG_SET (sel_hrd.regs_ever_used); 1115 CLEAR_HARD_REG_SET (sel_hrd.regs_ever_used);
1126 for (cur_reg = 0; cur_reg < FIRST_PSEUDO_REGISTER; cur_reg++) 1116 for (cur_reg = 0; cur_reg < FIRST_PSEUDO_REGISTER; cur_reg++)
1127 if (df_regs_ever_live_p (cur_reg) || call_used_regs[cur_reg]) 1117 if (df_regs_ever_live_p (cur_reg)
1118 || crtl->abi->clobbers_full_reg_p (cur_reg))
1128 SET_HARD_REG_BIT (sel_hrd.regs_ever_used, cur_reg); 1119 SET_HARD_REG_BIT (sel_hrd.regs_ever_used, cur_reg);
1129 1120
1130 /* Initialize registers that are valid based on mode when this is 1121 /* Initialize registers that are valid based on mode when this is
1131 really needed. */ 1122 really needed. */
1132 for (cur_mode = 0; cur_mode < NUM_MACHINE_MODES; cur_mode++) 1123 for (cur_mode = 0; cur_mode < NUM_MACHINE_MODES; cur_mode++)
1192 || (reload_completed && cl == NO_REGS)) 1183 || (reload_completed && cl == NO_REGS))
1193 { 1184 {
1194 SET_HARD_REG_SET (reg_rename_p->unavailable_hard_regs); 1185 SET_HARD_REG_SET (reg_rename_p->unavailable_hard_regs);
1195 1186
1196 /* Give a chance for original register, if it isn't in used_regs. */ 1187 /* Give a chance for original register, if it isn't in used_regs. */
1197 if (!def->crosses_call) 1188 if (!def->crossed_call_abis)
1198 CLEAR_HARD_REG_BIT (reg_rename_p->unavailable_hard_regs, regno); 1189 CLEAR_HARD_REG_BIT (reg_rename_p->unavailable_hard_regs, regno);
1199 1190
1200 return; 1191 return;
1201 } 1192 }
1202 1193
1220 register here we make sure it won't be lifted over it's previous def 1211 register here we make sure it won't be lifted over it's previous def
1221 (it's previous def will appear as if it's a FIRST_STACK_REG def. 1212 (it's previous def will appear as if it's a FIRST_STACK_REG def.
1222 The HARD_REGNO_RENAME_OK covers other cases in condition below. */ 1213 The HARD_REGNO_RENAME_OK covers other cases in condition below. */
1223 if (IN_RANGE (REGNO (orig_dest), FIRST_STACK_REG, LAST_STACK_REG) 1214 if (IN_RANGE (REGNO (orig_dest), FIRST_STACK_REG, LAST_STACK_REG)
1224 && REGNO_REG_SET_P (used_regs, FIRST_STACK_REG)) 1215 && REGNO_REG_SET_P (used_regs, FIRST_STACK_REG))
1225 IOR_HARD_REG_SET (reg_rename_p->unavailable_hard_regs, 1216 reg_rename_p->unavailable_hard_regs |= sel_hrd.stack_regs;
1226 sel_hrd.stack_regs);
1227 #endif 1217 #endif
1228 1218
1229 /* If there's a call on this path, make regs from call_used_reg_set 1219 mode = GET_MODE (orig_dest);
1230 unavailable. */ 1220
1231 if (def->crosses_call) 1221 /* If there's a call on this path, make regs from full_reg_clobbers
1232 IOR_HARD_REG_SET (reg_rename_p->unavailable_hard_regs, 1222 unavailable.
1233 call_used_reg_set); 1223
1234 1224 ??? It would be better to track the set of clobbered registers
1235 /* Stop here before reload: we need FRAME_REGS, STACK_REGS, and crosses_call, 1225 directly, but that would be quite expensive in a def_t. */
1236 but not register classes. */ 1226 if (def->crossed_call_abis)
1227 reg_rename_p->unavailable_hard_regs
1228 |= call_clobbers_in_region (def->crossed_call_abis,
1229 reg_class_contents[ALL_REGS], mode);
1230
1231 /* Stop here before reload: we need FRAME_REGS, STACK_REGS, and
1232 crossed_call_abis, but not register classes. */
1237 if (!reload_completed) 1233 if (!reload_completed)
1238 return; 1234 return;
1239 1235
1240 /* Leave regs as 'available' only from the current 1236 /* Leave regs as 'available' only from the current
1241 register class. */ 1237 register class. */
1242 COPY_HARD_REG_SET (reg_rename_p->available_for_renaming, 1238 reg_rename_p->available_for_renaming = reg_class_contents[cl];
1243 reg_class_contents[cl]);
1244
1245 mode = GET_MODE (orig_dest);
1246 1239
1247 /* Leave only registers available for this mode. */ 1240 /* Leave only registers available for this mode. */
1248 if (!sel_hrd.regs_for_mode_ok[mode]) 1241 if (!sel_hrd.regs_for_mode_ok[mode])
1249 init_regs_for_mode (mode); 1242 init_regs_for_mode (mode);
1250 AND_HARD_REG_SET (reg_rename_p->available_for_renaming, 1243 reg_rename_p->available_for_renaming &= sel_hrd.regs_for_mode[mode];
1251 sel_hrd.regs_for_mode[mode]);
1252
1253 /* Exclude registers that are partially call clobbered. */
1254 if (def->crosses_call
1255 && !targetm.hard_regno_call_part_clobbered (regno, mode))
1256 AND_COMPL_HARD_REG_SET (reg_rename_p->available_for_renaming,
1257 sel_hrd.regs_for_call_clobbered[mode]);
1258 1244
1259 /* Leave only those that are ok to rename. */ 1245 /* Leave only those that are ok to rename. */
1260 EXECUTE_IF_SET_IN_HARD_REG_SET (reg_rename_p->available_for_renaming, 1246 EXECUTE_IF_SET_IN_HARD_REG_SET (reg_rename_p->available_for_renaming,
1261 0, cur_reg, hrsi) 1247 0, cur_reg, hrsi)
1262 { 1248 {
1273 if (i >= 0) 1259 if (i >= 0)
1274 CLEAR_HARD_REG_BIT (reg_rename_p->available_for_renaming, 1260 CLEAR_HARD_REG_BIT (reg_rename_p->available_for_renaming,
1275 cur_reg); 1261 cur_reg);
1276 } 1262 }
1277 1263
1278 AND_COMPL_HARD_REG_SET (reg_rename_p->available_for_renaming, 1264 reg_rename_p->available_for_renaming &= ~reg_rename_p->unavailable_hard_regs;
1279 reg_rename_p->unavailable_hard_regs);
1280 1265
1281 /* Regno is always ok from the renaming part of view, but it really 1266 /* Regno is always ok from the renaming part of view, but it really
1282 could be in *unavailable_hard_regs already, so set it here instead 1267 could be in *unavailable_hard_regs already, so set it here instead
1283 of there. */ 1268 of there. */
1284 SET_HARD_REG_BIT (reg_rename_p->available_for_renaming, regno); 1269 SET_HARD_REG_BIT (reg_rename_p->available_for_renaming, regno);
1485 orig_regno)) 1470 orig_regno))
1486 { 1471 {
1487 /* Don't let register cross a call if it doesn't already 1472 /* Don't let register cross a call if it doesn't already
1488 cross one. This condition is written in accordance with 1473 cross one. This condition is written in accordance with
1489 that in sched-deps.c sched_analyze_reg(). */ 1474 that in sched-deps.c sched_analyze_reg(). */
1490 if (!reg_rename_p->crosses_call 1475 if (!reg_rename_p->crossed_call_abis
1491 || REG_N_CALLS_CROSSED (orig_regno) > 0) 1476 || REG_N_CALLS_CROSSED (orig_regno) > 0)
1492 return gen_rtx_REG (mode, orig_regno); 1477 return gen_rtx_REG (mode, orig_regno);
1493 } 1478 }
1494 1479
1495 bad_hard_regs = true; 1480 bad_hard_regs = true;
1512 1497
1513 gcc_assert (mode != VOIDmode); 1498 gcc_assert (mode != VOIDmode);
1514 1499
1515 max_regno = max_reg_num (); 1500 max_regno = max_reg_num ();
1516 maybe_extend_reg_info_p (); 1501 maybe_extend_reg_info_p ();
1517 REG_N_CALLS_CROSSED (REGNO (new_reg)) = reg_rename_p->crosses_call ? 1 : 0; 1502 REG_N_CALLS_CROSSED (REGNO (new_reg))
1503 = reg_rename_p->crossed_call_abis ? 1 : 0;
1518 1504
1519 return new_reg; 1505 return new_reg;
1520 } 1506 }
1521 } 1507 }
1522 1508
1564 FIXME: in the latter case, we just uselessly called find_used_regs, 1550 FIXME: in the latter case, we just uselessly called find_used_regs,
1565 because we can't move this expression with any other register 1551 because we can't move this expression with any other register
1566 as well. */ 1552 as well. */
1567 gcc_assert (scheduled_something_on_previous_fence || !live_available 1553 gcc_assert (scheduled_something_on_previous_fence || !live_available
1568 || !hard_available 1554 || !hard_available
1569 || (!reload_completed && reg_rename_p->crosses_call 1555 || (!reload_completed
1556 && reg_rename_p->crossed_call_abis
1570 && REG_N_CALLS_CROSSED (regno) == 0)); 1557 && REG_N_CALLS_CROSSED (regno) == 0));
1571 } 1558 }
1572 1559
1573 /* Collect unavailable registers due to liveness for EXPR from BNDS 1560 /* Collect unavailable registers due to liveness for EXPR from BNDS
1574 into USED_REGS. Save additional information about available 1561 into USED_REGS. Save additional information about available
1685 HARD_REG_SET hard_regs_used; 1672 HARD_REG_SET hard_regs_used;
1686 REG_SET_TO_HARD_REG_SET (hard_regs_used, used_regs); 1673 REG_SET_TO_HARD_REG_SET (hard_regs_used, used_regs);
1687 1674
1688 /* Join hard registers unavailable due to register class 1675 /* Join hard registers unavailable due to register class
1689 restrictions and live range intersection. */ 1676 restrictions and live range intersection. */
1690 IOR_HARD_REG_SET (hard_regs_used, 1677 hard_regs_used |= reg_rename_data.unavailable_hard_regs;
1691 reg_rename_data.unavailable_hard_regs);
1692 1678
1693 best_reg = choose_best_reg (hard_regs_used, &reg_rename_data, 1679 best_reg = choose_best_reg (hard_regs_used, &reg_rename_data,
1694 original_insns, is_orig_reg_p); 1680 original_insns, is_orig_reg_p);
1695 } 1681 }
1696 else 1682 else
2109 /* Calculate implicit clobbers. */ 2095 /* Calculate implicit clobbers. */
2110 extract_insn (insn); 2096 extract_insn (insn);
2111 preprocess_constraints (insn); 2097 preprocess_constraints (insn);
2112 alternative_mask prefrred = get_preferred_alternatives (insn); 2098 alternative_mask prefrred = get_preferred_alternatives (insn);
2113 ira_implicitly_set_insn_hard_regs (&temp, prefrred); 2099 ira_implicitly_set_insn_hard_regs (&temp, prefrred);
2114 AND_COMPL_HARD_REG_SET (temp, ira_no_alloc_regs); 2100 temp &= ~ira_no_alloc_regs;
2115 2101
2116 /* If any implicit clobber registers intersect with regular ones in 2102 /* If any implicit clobber registers intersect with regular ones in
2117 through_insn, we have a dependency and thus bail out. */ 2103 through_insn, we have a dependency and thus bail out. */
2118 EXECUTE_IF_SET_IN_HARD_REG_SET (temp, 0, regno, hrsi) 2104 EXECUTE_IF_SET_IN_HARD_REG_SET (temp, 0, regno, hrsi)
2119 { 2105 {
2819 two successors. */ 2805 two successors. */
2820 if (sinfo->succs_ok_n > 2) 2806 if (sinfo->succs_ok_n > 2)
2821 FOR_EACH_VEC_ELT (sinfo->succs_ok, is, succ) 2807 FOR_EACH_VEC_ELT (sinfo->succs_ok, is, succ)
2822 { 2808 {
2823 basic_block succ_bb = BLOCK_FOR_INSN (succ); 2809 basic_block succ_bb = BLOCK_FOR_INSN (succ);
2810 av_set_t av_succ = (is_ineligible_successor (succ, p)
2811 ? NULL
2812 : BB_AV_SET (succ_bb));
2824 2813
2825 gcc_assert (BB_LV_SET_VALID_P (succ_bb)); 2814 gcc_assert (BB_LV_SET_VALID_P (succ_bb));
2826 mark_unavailable_targets (av1, BB_AV_SET (succ_bb), 2815 mark_unavailable_targets (av1, av_succ, BB_LV_SET (succ_bb));
2827 BB_LV_SET (succ_bb));
2828 } 2816 }
2829 2817
2830 /* Finally, check liveness restrictions on paths leaving the region. */ 2818 /* Finally, check liveness restrictions on paths leaving the region. */
2831 if (sinfo->all_succs_n > sinfo->succs_ok_n) 2819 if (sinfo->all_succs_n > sinfo->succs_ok_n)
2832 FOR_EACH_VEC_ELT (sinfo->succs_other, is, succ) 2820 FOR_EACH_VEC_ELT (sinfo->succs_other, is, succ)
3226 3214
3227 All the original operations found during the traversal are saved in the 3215 All the original operations found during the traversal are saved in the
3228 ORIGINAL_INSNS list. 3216 ORIGINAL_INSNS list.
3229 3217
3230 REG_RENAME_P denotes the set of hardware registers that 3218 REG_RENAME_P denotes the set of hardware registers that
3231 can not be used with renaming due to the register class restrictions, 3219 cannot be used with renaming due to the register class restrictions,
3232 mode restrictions and other (the register we'll choose should be 3220 mode restrictions and other (the register we'll choose should be
3233 compatible class with the original uses, shouldn't be in call_used_regs, 3221 compatible class with the original uses, shouldn't be in call_used_regs,
3234 should be HARD_REGNO_RENAME_OK etc). 3222 should be HARD_REGNO_RENAME_OK etc).
3235 3223
3236 Returns TRUE if we've found all original insns, FALSE otherwise. 3224 Returns TRUE if we've found all original insns, FALSE otherwise.
3251 both paths of the conditional branch. 3239 both paths of the conditional branch.
3252 3240
3253 All the original operations found during the traversal are saved in the 3241 All the original operations found during the traversal are saved in the
3254 ORIGINAL_INSNS list. 3242 ORIGINAL_INSNS list.
3255 3243
3256 REG_RENAME_P->CROSSES_CALL is true, if there is a call insn on the path 3244 REG_RENAME_P->CROSSED_CALL_ABIS is true, if there is a call insn on the path
3257 from INSN to original insn. In this case CALL_USED_REG_SET will be added 3245 from INSN to original insn. In this case CALL_USED_REG_SET will be added
3258 to unavailable hard regs at the point original operation is found. */ 3246 to unavailable hard regs at the point original operation is found. */
3259 3247
3260 static bool 3248 static bool
3261 find_used_regs (insn_t insn, av_set_t orig_ops, regset used_regs, 3249 find_used_regs (insn_t insn, av_set_t orig_ops, regset used_regs,
3272 3260
3273 /* We haven't visited any blocks yet. */ 3261 /* We haven't visited any blocks yet. */
3274 bitmap_clear (code_motion_visited_blocks); 3262 bitmap_clear (code_motion_visited_blocks);
3275 3263
3276 /* Init parameters for code_motion_path_driver. */ 3264 /* Init parameters for code_motion_path_driver. */
3277 sparams.crosses_call = false; 3265 sparams.crossed_call_abis = 0;
3278 sparams.original_insns = original_insns; 3266 sparams.original_insns = original_insns;
3279 sparams.used_regs = used_regs; 3267 sparams.used_regs = used_regs;
3280 3268
3281 /* Set the appropriate hooks and data. */ 3269 /* Set the appropriate hooks and data. */
3282 code_motion_path_driver_info = &fur_hooks; 3270 code_motion_path_driver_info = &fur_hooks;
3283 3271
3284 res = code_motion_path_driver (insn, orig_ops, NULL, &lparams, &sparams); 3272 res = code_motion_path_driver (insn, orig_ops, NULL, &lparams, &sparams);
3285 3273
3286 reg_rename_p->crosses_call |= sparams.crosses_call; 3274 reg_rename_p->crossed_call_abis |= sparams.crossed_call_abis;
3287 3275
3288 gcc_assert (res == 1); 3276 gcc_assert (res == 1);
3289 gcc_assert (original_insns && *original_insns); 3277 gcc_assert (original_insns && *original_insns);
3290 3278
3291 /* ??? We calculate whether an expression needs a check when computing 3279 /* ??? We calculate whether an expression needs a check when computing
3328 if (targetm.sched.adjust_priority) 3316 if (targetm.sched.adjust_priority)
3329 new_priority = targetm.sched.adjust_priority (EXPR_INSN_RTX (expr), priority); 3317 new_priority = targetm.sched.adjust_priority (EXPR_INSN_RTX (expr), priority);
3330 else 3318 else
3331 new_priority = priority; 3319 new_priority = priority;
3332 3320
3333 gcc_assert (new_priority >= 0);
3334
3335 /* If the priority has changed, adjust EXPR_PRIORITY_ADJ accordingly. */ 3321 /* If the priority has changed, adjust EXPR_PRIORITY_ADJ accordingly. */
3336 EXPR_PRIORITY_ADJ (expr) = new_priority - EXPR_PRIORITY (expr); 3322 EXPR_PRIORITY_ADJ (expr) = new_priority - EXPR_PRIORITY (expr);
3337 3323
3338 if (sched_verbose >= 4) 3324 if (sched_verbose >= 4)
3339 sel_print ("sel_target_adjust_priority: insn %d, %d+%d = %d.\n", 3325 sel_print ("sel_target_adjust_priority: insn %d, %d+%d = %d.\n",
3465 /* Don't pipeline already pipelined code as that would increase 3451 /* Don't pipeline already pipelined code as that would increase
3466 number of unnecessary register moves. */ 3452 number of unnecessary register moves. */
3467 FOR_EACH_EXPR_1 (expr, si, av_ptr) 3453 FOR_EACH_EXPR_1 (expr, si, av_ptr)
3468 { 3454 {
3469 if (EXPR_SCHED_TIMES (expr) 3455 if (EXPR_SCHED_TIMES (expr)
3470 >= PARAM_VALUE (PARAM_SELSCHED_MAX_SCHED_TIMES)) 3456 >= param_selsched_max_sched_times)
3471 av_set_iter_remove (&si); 3457 av_set_iter_remove (&si);
3472 } 3458 }
3473 } 3459 }
3474 3460
3475 /* Filter speculative insns from AV_PTR if we don't want them. */ 3461 /* Filter speculative insns from AV_PTR if we don't want them. */
5848 moveop_static_params_p params) 5834 moveop_static_params_p params)
5849 { 5835 {
5850 bool insn_emitted = false; 5836 bool insn_emitted = false;
5851 rtx cur_reg; 5837 rtx cur_reg;
5852 5838
5853 /* Bail out early when expression can not be renamed at all. */ 5839 /* Bail out early when expression cannot be renamed at all. */
5854 if (!EXPR_SEPARABLE_P (params->c_expr)) 5840 if (!EXPR_SEPARABLE_P (params->c_expr))
5855 return false; 5841 return false;
5856 5842
5857 cur_reg = expr_dest_reg (params->c_expr); 5843 cur_reg = expr_dest_reg (params->c_expr);
5858 gcc_assert (cur_reg && params->dest && REG_P (params->dest)); 5844 gcc_assert (cur_reg && params->dest && REG_P (params->dest));
6011 remove_insn_from_stream (insn, only_disconnect); 5997 remove_insn_from_stream (insn, only_disconnect);
6012 } 5998 }
6013 5999
6014 /* The function is called when original expr is found. 6000 /* The function is called when original expr is found.
6015 INSN - current insn traversed, EXPR - the corresponding expr found, 6001 INSN - current insn traversed, EXPR - the corresponding expr found,
6016 crosses_call and original_insns in STATIC_PARAMS are updated. */ 6002 crossed_call_abis and original_insns in STATIC_PARAMS are updated. */
6017 static void 6003 static void
6018 fur_orig_expr_found (insn_t insn, expr_t expr ATTRIBUTE_UNUSED, 6004 fur_orig_expr_found (insn_t insn, expr_t expr ATTRIBUTE_UNUSED,
6019 cmpd_local_params_p lparams ATTRIBUTE_UNUSED, 6005 cmpd_local_params_p lparams ATTRIBUTE_UNUSED,
6020 void *static_params) 6006 void *static_params)
6021 { 6007 {
6022 fur_static_params_p params = (fur_static_params_p) static_params; 6008 fur_static_params_p params = (fur_static_params_p) static_params;
6023 regset tmp; 6009 regset tmp;
6024 6010
6025 if (CALL_P (insn)) 6011 if (CALL_P (insn))
6026 params->crosses_call = true; 6012 params->crossed_call_abis |= 1 << insn_callee_abi (insn).id ();
6027 6013
6028 def_list_add (params->original_insns, insn, params->crosses_call); 6014 def_list_add (params->original_insns, insn, params->crossed_call_abis);
6029 6015
6030 /* Mark the registers that do not meet the following condition: 6016 /* Mark the registers that do not meet the following condition:
6031 (2) not among the live registers of the point 6017 (2) not among the live registers of the point
6032 immediately following the first original operation on 6018 immediately following the first original operation on
6033 a given downward path, except for the original target 6019 a given downward path, except for the original target
6181 { 6167 {
6182 /* If we have found something below this block, there should be at 6168 /* If we have found something below this block, there should be at
6183 least one insn in ORIGINAL_INSNS. */ 6169 least one insn in ORIGINAL_INSNS. */
6184 gcc_assert (*sparams->original_insns); 6170 gcc_assert (*sparams->original_insns);
6185 6171
6186 /* Adjust CROSSES_CALL, since we may have come to this block along 6172 /* Adjust CROSSED_CALL_ABIS, since we may have come to this block along
6187 different path. */ 6173 different path. */
6188 DEF_LIST_DEF (*sparams->original_insns)->crosses_call 6174 DEF_LIST_DEF (*sparams->original_insns)->crossed_call_abis
6189 |= sparams->crosses_call; 6175 |= sparams->crossed_call_abis;
6190 } 6176 }
6191 else 6177 else
6192 local_params->old_original_insns = *sparams->original_insns; 6178 local_params->old_original_insns = *sparams->original_insns;
6193 6179
6194 return 1; 6180 return 1;
6238 expr_t r; 6224 expr_t r;
6239 av_set_iterator avi; 6225 av_set_iterator avi;
6240 fur_static_params_p sparams = (fur_static_params_p) static_params; 6226 fur_static_params_p sparams = (fur_static_params_p) static_params;
6241 6227
6242 if (CALL_P (insn)) 6228 if (CALL_P (insn))
6243 sparams->crosses_call = true; 6229 sparams->crossed_call_abis |= 1 << insn_callee_abi (insn).id ();
6244 else if (DEBUG_INSN_P (insn)) 6230 else if (DEBUG_INSN_P (insn))
6245 return true; 6231 return true;
6246 6232
6247 /* If current insn we are looking at cannot be executed together 6233 /* If current insn we are looking at cannot be executed together
6248 with original insn, then we can skip it safely. 6234 with original insn, then we can skip it safely.
6436 cmpd_local_params_p local_params_in, 6422 cmpd_local_params_p local_params_in,
6437 void *static_params) 6423 void *static_params)
6438 { 6424 {
6439 expr_t expr = NULL; 6425 expr_t expr = NULL;
6440 basic_block bb = BLOCK_FOR_INSN (insn); 6426 basic_block bb = BLOCK_FOR_INSN (insn);
6441 insn_t first_insn, bb_tail, before_first; 6427 insn_t first_insn, original_insn, bb_tail, before_first;
6442 bool removed_last_insn = false; 6428 bool removed_last_insn = false;
6443 6429
6444 if (sched_verbose >= 6) 6430 if (sched_verbose >= 6)
6445 { 6431 {
6446 sel_print ("%s (", code_motion_path_driver_info->routine_name); 6432 sel_print ("%s (", code_motion_path_driver_info->routine_name);
6520 gcc_assert (orig_ops); 6506 gcc_assert (orig_ops);
6521 6507
6522 /* It is enough to place only heads and tails of visited basic blocks into 6508 /* It is enough to place only heads and tails of visited basic blocks into
6523 the PATH. */ 6509 the PATH. */
6524 ilist_add (&path, insn); 6510 ilist_add (&path, insn);
6525 first_insn = insn; 6511 first_insn = original_insn = insn;
6526 bb_tail = sel_bb_end (bb); 6512 bb_tail = sel_bb_end (bb);
6527 6513
6528 /* Descend the basic block in search of the original expr; this part 6514 /* Descend the basic block in search of the original expr; this part
6529 corresponds to the part of the original move_op procedure executed 6515 corresponds to the part of the original move_op procedure executed
6530 before the recursive call. */ 6516 before the recursive call. */
6627 last insn in bb. */ 6613 last insn in bb. */
6628 if (NEXT_INSN (last_insn) != insn) 6614 if (NEXT_INSN (last_insn) != insn)
6629 { 6615 {
6630 insn = sel_bb_end (bb); 6616 insn = sel_bb_end (bb);
6631 first_insn = sel_bb_head (bb); 6617 first_insn = sel_bb_head (bb);
6618 if (first_insn != original_insn)
6619 first_insn = original_insn;
6632 } 6620 }
6633 6621
6634 /* Remove bb tail from path. */ 6622 /* Remove bb tail from path. */
6635 if (added_to_path) 6623 if (added_to_path)
6636 ilist_remove (&path); 6624 ilist_remove (&path);
6815 bookkeeping_p = 1; 6803 bookkeeping_p = 1;
6816 pipelining_p = (bookkeeping_p 6804 pipelining_p = (bookkeeping_p
6817 && (flag_sel_sched_pipelining != 0) 6805 && (flag_sel_sched_pipelining != 0)
6818 && current_loop_nest != NULL 6806 && current_loop_nest != NULL
6819 && loop_has_exit_edges (current_loop_nest)); 6807 && loop_has_exit_edges (current_loop_nest));
6820 max_insns_to_rename = PARAM_VALUE (PARAM_SELSCHED_INSNS_TO_RENAME); 6808 max_insns_to_rename = param_selsched_insns_to_rename;
6821 max_ws = MAX_WS; 6809 max_ws = MAX_WS;
6822 } 6810 }
6823 6811
6824 /* Return true if all basic blocks of current region are empty. */ 6812 /* Return true if all basic blocks of current region are empty. */
6825 static bool 6813 static bool
6945 6933
6946 /* Reset register allocation ticks array. */ 6934 /* Reset register allocation ticks array. */
6947 memset (reg_rename_tick, 0, sizeof reg_rename_tick); 6935 memset (reg_rename_tick, 0, sizeof reg_rename_tick);
6948 reg_rename_this_tick = 0; 6936 reg_rename_this_tick = 0;
6949 6937
6950 bitmap_initialize (forced_ebb_heads, 0); 6938 forced_ebb_heads = BITMAP_ALLOC (NULL);
6951 bitmap_clear (forced_ebb_heads);
6952 6939
6953 setup_nop_vinsn (); 6940 setup_nop_vinsn ();
6954 current_copies = BITMAP_ALLOC (NULL); 6941 current_copies = BITMAP_ALLOC (NULL);
6955 current_originators = BITMAP_ALLOC (NULL); 6942 current_originators = BITMAP_ALLOC (NULL);
6956 code_motion_visited_blocks = BITMAP_ALLOC (NULL); 6943 code_motion_visited_blocks = BITMAP_ALLOC (NULL);
7288 if (reload_completed) 7275 if (reload_completed)
7289 sel_region_target_finish (reset_sched_cycles_p); 7276 sel_region_target_finish (reset_sched_cycles_p);
7290 7277
7291 sel_finish_global_and_expr (); 7278 sel_finish_global_and_expr ();
7292 7279
7293 bitmap_clear (forced_ebb_heads); 7280 BITMAP_FREE (forced_ebb_heads);
7294 7281
7295 free_nop_vinsn (); 7282 free_nop_vinsn ();
7296 7283
7297 finish_deps_global (); 7284 finish_deps_global ();
7298 sched_finish_luids (); 7285 sched_finish_luids ();
7648 else 7635 else
7649 { 7636 {
7650 /* Schedule always selecting the next insn to make the correct data 7637 /* Schedule always selecting the next insn to make the correct data
7651 for bundling or other later passes. */ 7638 for bundling or other later passes. */
7652 pipelining_p = false; 7639 pipelining_p = false;
7640 reset_sched_cycles_p = false;
7653 force_next_insn = 1; 7641 force_next_insn = 1;
7654 sel_sched_region_1 (); 7642 sel_sched_region_1 ();
7655 force_next_insn = 0; 7643 force_next_insn = 0;
7656 } 7644 }
7657 reset_sched_cycles_p = pipelining_p;
7658 sel_region_finish (reset_sched_cycles_p); 7645 sel_region_finish (reset_sched_cycles_p);
7659 } 7646 }
7660 7647
7661 /* Perform global init for the scheduler. */ 7648 /* Perform global init for the scheduler. */
7662 static void 7649 static void