comparison gcc/reginfo.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 /* Compute different info about registers. 1 /* Compute different info about registers.
2 Copyright (C) 1987-2018 Free Software Foundation, Inc. 2 Copyright (C) 1987-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
41 #include "recog.h" 41 #include "recog.h"
42 #include "diagnostic-core.h" 42 #include "diagnostic-core.h"
43 #include "reload.h" 43 #include "reload.h"
44 #include "output.h" 44 #include "output.h"
45 #include "tree-pass.h" 45 #include "tree-pass.h"
46 #include "function-abi.h"
46 47
47 /* Maximum register number used in this function, plus one. */ 48 /* Maximum register number used in this function, plus one. */
48 49
49 int max_regno; 50 int max_regno;
50 51
51 /* Used to cache the results of simplifiable_subregs. SHAPE is the input 52 /* Used to cache the results of simplifiable_subregs. SHAPE is the input
52 parameter and SIMPLIFIABLE_REGS is the result. */ 53 parameter and SIMPLIFIABLE_REGS is the result. */
53 struct simplifiable_subreg 54 class simplifiable_subreg
54 { 55 {
56 public:
55 simplifiable_subreg (const subreg_shape &); 57 simplifiable_subreg (const subreg_shape &);
56 58
57 subreg_shape shape; 59 subreg_shape shape;
58 HARD_REG_SET simplifiable_regs; 60 HARD_REG_SET simplifiable_regs;
59 }; 61 };
63 #if SWITCHABLE_TARGET 65 #if SWITCHABLE_TARGET
64 struct target_hard_regs *this_target_hard_regs = &default_target_hard_regs; 66 struct target_hard_regs *this_target_hard_regs = &default_target_hard_regs;
65 struct target_regs *this_target_regs = &default_target_regs; 67 struct target_regs *this_target_regs = &default_target_regs;
66 #endif 68 #endif
67 69
70 #define call_used_regs \
71 (this_target_hard_regs->x_call_used_regs)
72 #define regs_invalidated_by_call \
73 (this_target_hard_regs->x_regs_invalidated_by_call)
74
68 /* Data for initializing fixed_regs. */ 75 /* Data for initializing fixed_regs. */
69 static const char initial_fixed_regs[] = FIXED_REGISTERS; 76 static const char initial_fixed_regs[] = FIXED_REGISTERS;
70 77
71 /* Data for initializing call_used_regs. */ 78 /* Data for initializing call_used_regs. */
79 #ifdef CALL_REALLY_USED_REGISTERS
80 #ifdef CALL_USED_REGISTERS
81 #error CALL_USED_REGISTERS and CALL_REALLY_USED_REGISTERS are both defined
82 #endif
83 static const char initial_call_used_regs[] = CALL_REALLY_USED_REGISTERS;
84 #else
72 static const char initial_call_used_regs[] = CALL_USED_REGISTERS; 85 static const char initial_call_used_regs[] = CALL_USED_REGISTERS;
73
74 #ifdef CALL_REALLY_USED_REGISTERS
75 /* Data for initializing call_really_used_regs. */
76 static const char initial_call_really_used_regs[] = CALL_REALLY_USED_REGISTERS;
77 #endif
78
79 #ifdef CALL_REALLY_USED_REGISTERS
80 #define CALL_REALLY_USED_REGNO_P(X) call_really_used_regs[X]
81 #else
82 #define CALL_REALLY_USED_REGNO_P(X) call_used_regs[X]
83 #endif 86 #endif
84 87
85 /* Indexed by hard register number, contains 1 for registers 88 /* Indexed by hard register number, contains 1 for registers
86 that are being used for global register decls. 89 that are being used for global register decls.
87 These must be exempt from ordinary flow analysis 90 These must be exempt from ordinary flow analysis
88 and are also considered fixed. */ 91 and are also considered fixed. */
89 char global_regs[FIRST_PSEUDO_REGISTER]; 92 char global_regs[FIRST_PSEUDO_REGISTER];
90 93
91 /* Declaration for the global register. */ 94 /* Declaration for the global register. */
92 tree global_regs_decl[FIRST_PSEUDO_REGISTER]; 95 tree global_regs_decl[FIRST_PSEUDO_REGISTER];
93
94 /* Same information as REGS_INVALIDATED_BY_CALL but in regset form to be used
95 in dataflow more conveniently. */
96 regset regs_invalidated_by_call_regset;
97
98 /* Same information as FIXED_REG_SET but in regset form. */
99 regset fixed_reg_set_regset;
100
101 /* The bitmap_obstack is used to hold some static variables that
102 should not be reset after each function is compiled. */
103 static bitmap_obstack persistent_obstack;
104 96
105 /* Used to initialize reg_alloc_order. */ 97 /* Used to initialize reg_alloc_order. */
106 #ifdef REG_ALLOC_ORDER 98 #ifdef REG_ALLOC_ORDER
107 static int initial_reg_alloc_order[FIRST_PSEUDO_REGISTER] = REG_ALLOC_ORDER; 99 static int initial_reg_alloc_order[FIRST_PSEUDO_REGISTER] = REG_ALLOC_ORDER;
108 #endif 100 #endif
169 161
170 /* Sanity check: make sure the target macros FIXED_REGISTERS and 162 /* Sanity check: make sure the target macros FIXED_REGISTERS and
171 CALL_USED_REGISTERS had the right number of initializers. */ 163 CALL_USED_REGISTERS had the right number of initializers. */
172 gcc_assert (sizeof fixed_regs == sizeof initial_fixed_regs); 164 gcc_assert (sizeof fixed_regs == sizeof initial_fixed_regs);
173 gcc_assert (sizeof call_used_regs == sizeof initial_call_used_regs); 165 gcc_assert (sizeof call_used_regs == sizeof initial_call_used_regs);
174 #ifdef CALL_REALLY_USED_REGISTERS
175 gcc_assert (sizeof call_really_used_regs
176 == sizeof initial_call_really_used_regs);
177 #endif
178 #ifdef REG_ALLOC_ORDER 166 #ifdef REG_ALLOC_ORDER
179 gcc_assert (sizeof reg_alloc_order == sizeof initial_reg_alloc_order); 167 gcc_assert (sizeof reg_alloc_order == sizeof initial_reg_alloc_order);
180 #endif 168 #endif
181 gcc_assert (sizeof reg_names == sizeof initial_reg_names); 169 gcc_assert (sizeof reg_names == sizeof initial_reg_names);
182 170
183 memcpy (fixed_regs, initial_fixed_regs, sizeof fixed_regs); 171 memcpy (fixed_regs, initial_fixed_regs, sizeof fixed_regs);
184 memcpy (call_used_regs, initial_call_used_regs, sizeof call_used_regs); 172 memcpy (call_used_regs, initial_call_used_regs, sizeof call_used_regs);
185 #ifdef CALL_REALLY_USED_REGISTERS
186 memcpy (call_really_used_regs, initial_call_really_used_regs,
187 sizeof call_really_used_regs);
188 #endif
189 #ifdef REG_ALLOC_ORDER 173 #ifdef REG_ALLOC_ORDER
190 memcpy (reg_alloc_order, initial_reg_alloc_order, sizeof reg_alloc_order); 174 memcpy (reg_alloc_order, initial_reg_alloc_order, sizeof reg_alloc_order);
191 #endif 175 #endif
192 memcpy (reg_names, initial_reg_names, sizeof reg_names); 176 memcpy (reg_names, initial_reg_names, sizeof reg_names);
193 177
198 /* We need to save copies of some of the register information which 182 /* We need to save copies of some of the register information which
199 can be munged by command-line switches so we can restore it during 183 can be munged by command-line switches so we can restore it during
200 subsequent back-end reinitialization. */ 184 subsequent back-end reinitialization. */
201 static char saved_fixed_regs[FIRST_PSEUDO_REGISTER]; 185 static char saved_fixed_regs[FIRST_PSEUDO_REGISTER];
202 static char saved_call_used_regs[FIRST_PSEUDO_REGISTER]; 186 static char saved_call_used_regs[FIRST_PSEUDO_REGISTER];
203 #ifdef CALL_REALLY_USED_REGISTERS
204 static char saved_call_really_used_regs[FIRST_PSEUDO_REGISTER];
205 #endif
206 static const char *saved_reg_names[FIRST_PSEUDO_REGISTER]; 187 static const char *saved_reg_names[FIRST_PSEUDO_REGISTER];
207 static HARD_REG_SET saved_accessible_reg_set; 188 static HARD_REG_SET saved_accessible_reg_set;
208 static HARD_REG_SET saved_operand_reg_set; 189 static HARD_REG_SET saved_operand_reg_set;
209 190
210 /* Save the register information. */ 191 /* Save the register information. */
216 gcc_assert (sizeof fixed_regs == sizeof saved_fixed_regs); 197 gcc_assert (sizeof fixed_regs == sizeof saved_fixed_regs);
217 gcc_assert (sizeof call_used_regs == sizeof saved_call_used_regs); 198 gcc_assert (sizeof call_used_regs == sizeof saved_call_used_regs);
218 memcpy (saved_fixed_regs, fixed_regs, sizeof fixed_regs); 199 memcpy (saved_fixed_regs, fixed_regs, sizeof fixed_regs);
219 memcpy (saved_call_used_regs, call_used_regs, sizeof call_used_regs); 200 memcpy (saved_call_used_regs, call_used_regs, sizeof call_used_regs);
220 201
221 /* Likewise for call_really_used_regs. */
222 #ifdef CALL_REALLY_USED_REGISTERS
223 gcc_assert (sizeof call_really_used_regs
224 == sizeof saved_call_really_used_regs);
225 memcpy (saved_call_really_used_regs, call_really_used_regs,
226 sizeof call_really_used_regs);
227 #endif
228
229 /* And similarly for reg_names. */ 202 /* And similarly for reg_names. */
230 gcc_assert (sizeof reg_names == sizeof saved_reg_names); 203 gcc_assert (sizeof reg_names == sizeof saved_reg_names);
231 memcpy (saved_reg_names, reg_names, sizeof reg_names); 204 memcpy (saved_reg_names, reg_names, sizeof reg_names);
232 COPY_HARD_REG_SET (saved_accessible_reg_set, accessible_reg_set); 205 saved_accessible_reg_set = accessible_reg_set;
233 COPY_HARD_REG_SET (saved_operand_reg_set, operand_reg_set); 206 saved_operand_reg_set = operand_reg_set;
234 } 207 }
235 208
236 /* Restore the register information. */ 209 /* Restore the register information. */
237 static void 210 static void
238 restore_register_info (void) 211 restore_register_info (void)
239 { 212 {
240 memcpy (fixed_regs, saved_fixed_regs, sizeof fixed_regs); 213 memcpy (fixed_regs, saved_fixed_regs, sizeof fixed_regs);
241 memcpy (call_used_regs, saved_call_used_regs, sizeof call_used_regs); 214 memcpy (call_used_regs, saved_call_used_regs, sizeof call_used_regs);
242 215
243 #ifdef CALL_REALLY_USED_REGISTERS
244 memcpy (call_really_used_regs, saved_call_really_used_regs,
245 sizeof call_really_used_regs);
246 #endif
247
248 memcpy (reg_names, saved_reg_names, sizeof reg_names); 216 memcpy (reg_names, saved_reg_names, sizeof reg_names);
249 COPY_HARD_REG_SET (accessible_reg_set, saved_accessible_reg_set); 217 accessible_reg_set = saved_accessible_reg_set;
250 COPY_HARD_REG_SET (operand_reg_set, saved_operand_reg_set); 218 operand_reg_set = saved_operand_reg_set;
251 } 219 }
252 220
253 /* After switches have been processed, which perhaps alter 221 /* After switches have been processed, which perhaps alter
254 `fixed_regs' and `call_used_regs', convert them to HARD_REG_SETs. */ 222 `fixed_regs' and `call_used_regs', convert them to HARD_REG_SETs. */
255 static void 223 static void
295 for (j = 0; j < N_REG_CLASSES; j++) 263 for (j = 0; j < N_REG_CLASSES; j++)
296 { 264 {
297 HARD_REG_SET c; 265 HARD_REG_SET c;
298 int k; 266 int k;
299 267
300 COPY_HARD_REG_SET (c, reg_class_contents[i]); 268 c = reg_class_contents[i] | reg_class_contents[j];
301 IOR_HARD_REG_SET (c, reg_class_contents[j]);
302 for (k = 0; k < N_REG_CLASSES; k++) 269 for (k = 0; k < N_REG_CLASSES; k++)
303 if (hard_reg_set_subset_p (reg_class_contents[k], c) 270 if (hard_reg_set_subset_p (reg_class_contents[k], c)
304 && !hard_reg_set_subset_p (reg_class_contents[k], 271 && !hard_reg_set_subset_p (reg_class_contents[k],
305 reg_class_contents 272 reg_class_contents
306 [(int) reg_class_subunion[i][j]])) 273 [(int) reg_class_subunion[i][j]]))
318 for (j = 0; j < N_REG_CLASSES; j++) 285 for (j = 0; j < N_REG_CLASSES; j++)
319 { 286 {
320 HARD_REG_SET c; 287 HARD_REG_SET c;
321 int k; 288 int k;
322 289
323 COPY_HARD_REG_SET (c, reg_class_contents[i]); 290 c = reg_class_contents[i] | reg_class_contents[j];
324 IOR_HARD_REG_SET (c, reg_class_contents[j]);
325 for (k = 0; k < N_REG_CLASSES; k++) 291 for (k = 0; k < N_REG_CLASSES; k++)
326 if (hard_reg_set_subset_p (c, reg_class_contents[k])) 292 if (hard_reg_set_subset_p (c, reg_class_contents[k]))
327 break; 293 break;
328 294
329 reg_class_superunion[i][j] = (enum reg_class) k; 295 reg_class_superunion[i][j] = (enum reg_class) k;
360 } 326 }
361 327
362 /* Initialize "constant" tables. */ 328 /* Initialize "constant" tables. */
363 329
364 CLEAR_HARD_REG_SET (fixed_reg_set); 330 CLEAR_HARD_REG_SET (fixed_reg_set);
365 CLEAR_HARD_REG_SET (call_used_reg_set);
366 CLEAR_HARD_REG_SET (call_fixed_reg_set);
367 CLEAR_HARD_REG_SET (regs_invalidated_by_call); 331 CLEAR_HARD_REG_SET (regs_invalidated_by_call);
368 if (!regs_invalidated_by_call_regset) 332
369 { 333 operand_reg_set &= accessible_reg_set;
370 bitmap_obstack_initialize (&persistent_obstack);
371 regs_invalidated_by_call_regset = ALLOC_REG_SET (&persistent_obstack);
372 }
373 else
374 CLEAR_REG_SET (regs_invalidated_by_call_regset);
375 if (!fixed_reg_set_regset)
376 fixed_reg_set_regset = ALLOC_REG_SET (&persistent_obstack);
377 else
378 CLEAR_REG_SET (fixed_reg_set_regset);
379
380 AND_HARD_REG_SET (operand_reg_set, accessible_reg_set);
381 for (i = 0; i < FIRST_PSEUDO_REGISTER; i++) 334 for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
382 { 335 {
383 /* As a special exception, registers whose class is NO_REGS are 336 /* As a special exception, registers whose class is NO_REGS are
384 not accepted by `register_operand'. The reason for this change 337 not accepted by `register_operand'. The reason for this change
385 is to allow the representation of special architecture artifacts 338 is to allow the representation of special architecture artifacts
391 CLEAR_HARD_REG_BIT (operand_reg_set, i); 344 CLEAR_HARD_REG_BIT (operand_reg_set, i);
392 345
393 /* If a register is too limited to be treated as a register operand, 346 /* If a register is too limited to be treated as a register operand,
394 then it should never be allocated to a pseudo. */ 347 then it should never be allocated to a pseudo. */
395 if (!TEST_HARD_REG_BIT (operand_reg_set, i)) 348 if (!TEST_HARD_REG_BIT (operand_reg_set, i))
396 { 349 fixed_regs[i] = 1;
397 fixed_regs[i] = 1;
398 call_used_regs[i] = 1;
399 }
400
401 /* call_used_regs must include fixed_regs. */
402 gcc_assert (!fixed_regs[i] || call_used_regs[i]);
403 #ifdef CALL_REALLY_USED_REGISTERS
404 /* call_used_regs must include call_really_used_regs. */
405 gcc_assert (!call_really_used_regs[i] || call_used_regs[i]);
406 #endif
407 350
408 if (fixed_regs[i]) 351 if (fixed_regs[i])
409 { 352 SET_HARD_REG_BIT (fixed_reg_set, i);
410 SET_HARD_REG_BIT (fixed_reg_set, i);
411 SET_REGNO_REG_SET (fixed_reg_set_regset, i);
412 }
413
414 if (call_used_regs[i])
415 SET_HARD_REG_BIT (call_used_reg_set, i);
416 353
417 /* There are a couple of fixed registers that we know are safe to 354 /* There are a couple of fixed registers that we know are safe to
418 exclude from being clobbered by calls: 355 exclude from being clobbered by calls:
419 356
420 The frame pointer is always preserved across calls. The arg 357 The frame pointer is always preserved across calls. The arg
425 target can override that. */ 362 target can override that. */
426 363
427 if (i == STACK_POINTER_REGNUM) 364 if (i == STACK_POINTER_REGNUM)
428 ; 365 ;
429 else if (global_regs[i]) 366 else if (global_regs[i])
430 { 367 SET_HARD_REG_BIT (regs_invalidated_by_call, i);
431 SET_HARD_REG_BIT (regs_invalidated_by_call, i);
432 SET_REGNO_REG_SET (regs_invalidated_by_call_regset, i);
433 }
434 else if (i == FRAME_POINTER_REGNUM) 368 else if (i == FRAME_POINTER_REGNUM)
435 ; 369 ;
436 else if (!HARD_FRAME_POINTER_IS_FRAME_POINTER 370 else if (!HARD_FRAME_POINTER_IS_FRAME_POINTER
437 && i == HARD_FRAME_POINTER_REGNUM) 371 && i == HARD_FRAME_POINTER_REGNUM)
438 ; 372 ;
440 && i == ARG_POINTER_REGNUM && fixed_regs[i]) 374 && i == ARG_POINTER_REGNUM && fixed_regs[i])
441 ; 375 ;
442 else if (!PIC_OFFSET_TABLE_REG_CALL_CLOBBERED 376 else if (!PIC_OFFSET_TABLE_REG_CALL_CLOBBERED
443 && i == (unsigned) PIC_OFFSET_TABLE_REGNUM && fixed_regs[i]) 377 && i == (unsigned) PIC_OFFSET_TABLE_REGNUM && fixed_regs[i])
444 ; 378 ;
445 else if (CALL_REALLY_USED_REGNO_P (i)) 379 else if (call_used_regs[i])
446 { 380 SET_HARD_REG_BIT (regs_invalidated_by_call, i);
447 SET_HARD_REG_BIT (regs_invalidated_by_call, i); 381 }
448 SET_REGNO_REG_SET (regs_invalidated_by_call_regset, i); 382
449 } 383 SET_HARD_REG_SET (savable_regs);
450 } 384 fixed_nonglobal_reg_set = fixed_reg_set;
451
452 COPY_HARD_REG_SET (call_fixed_reg_set, fixed_reg_set);
453 COPY_HARD_REG_SET (fixed_nonglobal_reg_set, fixed_reg_set);
454 385
455 /* Preserve global registers if called more than once. */ 386 /* Preserve global registers if called more than once. */
456 for (i = 0; i < FIRST_PSEUDO_REGISTER; i++) 387 for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
457 { 388 {
458 if (global_regs[i]) 389 if (global_regs[i])
459 { 390 {
460 fixed_regs[i] = call_used_regs[i] = 1; 391 fixed_regs[i] = call_used_regs[i] = 1;
461 SET_HARD_REG_BIT (fixed_reg_set, i); 392 SET_HARD_REG_BIT (fixed_reg_set, i);
462 SET_HARD_REG_BIT (call_used_reg_set, i);
463 SET_HARD_REG_BIT (call_fixed_reg_set, i);
464 } 393 }
465 } 394 }
466 395
467 memset (have_regs_of_mode, 0, sizeof (have_regs_of_mode)); 396 memset (have_regs_of_mode, 0, sizeof (have_regs_of_mode));
468 memset (contains_reg_of_mode, 0, sizeof (contains_reg_of_mode)); 397 memset (contains_reg_of_mode, 0, sizeof (contains_reg_of_mode));
491 have_regs_of_mode[m] = 1; 420 have_regs_of_mode[m] = 1;
492 contains_allocatable_reg_of_mode[i][m] = 1; 421 contains_allocatable_reg_of_mode[i][m] = 1;
493 } 422 }
494 } 423 }
495 } 424 }
425
426 default_function_abi.initialize (0, regs_invalidated_by_call);
496 } 427 }
497 428
498 /* Compute the table of register modes. 429 /* Compute the table of register modes.
499 These values are used to record death information for individual registers 430 These values are used to record death information for individual registers
500 (as opposed to a multi-register mode). 431 (as opposed to a multi-register mode).
511 this_target_regs->x_hard_regno_nregs[i][j] 442 this_target_regs->x_hard_regno_nregs[i][j]
512 = targetm.hard_regno_nregs (i, (machine_mode) j); 443 = targetm.hard_regno_nregs (i, (machine_mode) j);
513 444
514 for (i = 0; i < FIRST_PSEUDO_REGISTER; i++) 445 for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
515 { 446 {
516 reg_raw_mode[i] = choose_hard_reg_mode (i, 1, false); 447 reg_raw_mode[i] = choose_hard_reg_mode (i, 1, NULL);
517 448
518 /* If we couldn't find a valid mode, just use the previous mode 449 /* If we couldn't find a valid mode, just use the previous mode
519 if it is suitable, otherwise fall back on word_mode. */ 450 if it is suitable, otherwise fall back on word_mode. */
520 if (reg_raw_mode[i] == VOIDmode) 451 if (reg_raw_mode[i] == VOIDmode)
521 { 452 {
619 return memory_move_secondary_cost (mode, altclass, in) + partial_cost; 550 return memory_move_secondary_cost (mode, altclass, in) + partial_cost;
620 } 551 }
621 552
622 /* Return a machine mode that is legitimate for hard reg REGNO and large 553 /* Return a machine mode that is legitimate for hard reg REGNO and large
623 enough to save nregs. If we can't find one, return VOIDmode. 554 enough to save nregs. If we can't find one, return VOIDmode.
624 If CALL_SAVED is true, only consider modes that are call saved. */ 555 If ABI is nonnull, only consider modes that are preserved across
556 calls that use ABI. */
625 machine_mode 557 machine_mode
626 choose_hard_reg_mode (unsigned int regno ATTRIBUTE_UNUSED, 558 choose_hard_reg_mode (unsigned int regno ATTRIBUTE_UNUSED,
627 unsigned int nregs, bool call_saved) 559 unsigned int nregs, const predefined_function_abi *abi)
628 { 560 {
629 unsigned int /* machine_mode */ m; 561 unsigned int /* machine_mode */ m;
630 machine_mode found_mode = VOIDmode, mode; 562 machine_mode found_mode = VOIDmode, mode;
631 563
632 /* We first look for the largest integer mode that can be validly 564 /* We first look for the largest integer mode that can be validly
636 The tests use maybe_gt rather than known_gt because we want (for example) 568 The tests use maybe_gt rather than known_gt because we want (for example)
637 N V4SFs to win over plain V4SF even though N might be 1. */ 569 N V4SFs to win over plain V4SF even though N might be 1. */
638 FOR_EACH_MODE_IN_CLASS (mode, MODE_INT) 570 FOR_EACH_MODE_IN_CLASS (mode, MODE_INT)
639 if (hard_regno_nregs (regno, mode) == nregs 571 if (hard_regno_nregs (regno, mode) == nregs
640 && targetm.hard_regno_mode_ok (regno, mode) 572 && targetm.hard_regno_mode_ok (regno, mode)
641 && (!call_saved 573 && (!abi || !abi->clobbers_reg_p (mode, regno))
642 || !targetm.hard_regno_call_part_clobbered (regno, mode))
643 && maybe_gt (GET_MODE_SIZE (mode), GET_MODE_SIZE (found_mode))) 574 && maybe_gt (GET_MODE_SIZE (mode), GET_MODE_SIZE (found_mode)))
644 found_mode = mode; 575 found_mode = mode;
645 576
646 FOR_EACH_MODE_IN_CLASS (mode, MODE_FLOAT) 577 FOR_EACH_MODE_IN_CLASS (mode, MODE_FLOAT)
647 if (hard_regno_nregs (regno, mode) == nregs 578 if (hard_regno_nregs (regno, mode) == nregs
648 && targetm.hard_regno_mode_ok (regno, mode) 579 && targetm.hard_regno_mode_ok (regno, mode)
649 && (!call_saved 580 && (!abi || !abi->clobbers_reg_p (mode, regno))
650 || !targetm.hard_regno_call_part_clobbered (regno, mode))
651 && maybe_gt (GET_MODE_SIZE (mode), GET_MODE_SIZE (found_mode))) 581 && maybe_gt (GET_MODE_SIZE (mode), GET_MODE_SIZE (found_mode)))
652 found_mode = mode; 582 found_mode = mode;
653 583
654 FOR_EACH_MODE_IN_CLASS (mode, MODE_VECTOR_FLOAT) 584 FOR_EACH_MODE_IN_CLASS (mode, MODE_VECTOR_FLOAT)
655 if (hard_regno_nregs (regno, mode) == nregs 585 if (hard_regno_nregs (regno, mode) == nregs
656 && targetm.hard_regno_mode_ok (regno, mode) 586 && targetm.hard_regno_mode_ok (regno, mode)
657 && (!call_saved 587 && (!abi || !abi->clobbers_reg_p (mode, regno))
658 || !targetm.hard_regno_call_part_clobbered (regno, mode))
659 && maybe_gt (GET_MODE_SIZE (mode), GET_MODE_SIZE (found_mode))) 588 && maybe_gt (GET_MODE_SIZE (mode), GET_MODE_SIZE (found_mode)))
660 found_mode = mode; 589 found_mode = mode;
661 590
662 FOR_EACH_MODE_IN_CLASS (mode, MODE_VECTOR_INT) 591 FOR_EACH_MODE_IN_CLASS (mode, MODE_VECTOR_INT)
663 if (hard_regno_nregs (regno, mode) == nregs 592 if (hard_regno_nregs (regno, mode) == nregs
664 && targetm.hard_regno_mode_ok (regno, mode) 593 && targetm.hard_regno_mode_ok (regno, mode)
665 && (!call_saved 594 && (!abi || !abi->clobbers_reg_p (mode, regno))
666 || !targetm.hard_regno_call_part_clobbered (regno, mode))
667 && maybe_gt (GET_MODE_SIZE (mode), GET_MODE_SIZE (found_mode))) 595 && maybe_gt (GET_MODE_SIZE (mode), GET_MODE_SIZE (found_mode)))
668 found_mode = mode; 596 found_mode = mode;
669 597
670 if (found_mode != VOIDmode) 598 if (found_mode != VOIDmode)
671 return found_mode; 599 return found_mode;
674 for (m = (unsigned int) CCmode; m < (unsigned int) NUM_MACHINE_MODES; ++m) 602 for (m = (unsigned int) CCmode; m < (unsigned int) NUM_MACHINE_MODES; ++m)
675 { 603 {
676 mode = (machine_mode) m; 604 mode = (machine_mode) m;
677 if (hard_regno_nregs (regno, mode) == nregs 605 if (hard_regno_nregs (regno, mode) == nregs
678 && targetm.hard_regno_mode_ok (regno, mode) 606 && targetm.hard_regno_mode_ok (regno, mode)
679 && (!call_saved 607 && (!abi || !abi->clobbers_reg_p (mode, regno)))
680 || !targetm.hard_regno_call_part_clobbered (regno, mode)))
681 return mode; 608 return mode;
682 } 609 }
683 610
684 /* We can't find a mode valid for this register. */ 611 /* We can't find a mode valid for this register. */
685 return VOIDmode; 612 return VOIDmode;
715 { 642 {
716 case 0: 643 case 0:
717 switch (call_used) 644 switch (call_used)
718 { 645 {
719 case 0: 646 case 0:
720 error ("can%'t use %qs as a call-saved register", name); 647 error ("cannot use %qs as a call-saved register", name);
721 break; 648 break;
722 649
723 case 1: 650 case 1:
724 error ("can%'t use %qs as a call-used register", name); 651 error ("cannot use %qs as a call-used register", name);
725 break; 652 break;
726 653
727 default: 654 default:
728 gcc_unreachable (); 655 gcc_unreachable ();
729 } 656 }
731 658
732 case 1: 659 case 1:
733 switch (call_used) 660 switch (call_used)
734 { 661 {
735 case 1: 662 case 1:
736 error ("can%'t use %qs as a fixed register", name); 663 error ("cannot use %qs as a fixed register", name);
737 break; 664 break;
738 665
739 case 0: 666 case 0:
740 default: 667 default:
741 gcc_unreachable (); 668 gcc_unreachable ();
747 } 674 }
748 } 675 }
749 else 676 else
750 { 677 {
751 fixed_regs[i] = fixed; 678 fixed_regs[i] = fixed;
752 call_used_regs[i] = call_used;
753 #ifdef CALL_REALLY_USED_REGISTERS 679 #ifdef CALL_REALLY_USED_REGISTERS
754 if (fixed == 0) 680 if (fixed == 0)
755 call_really_used_regs[i] = call_used; 681 call_used_regs[i] = call_used;
682 #else
683 call_used_regs[i] = call_used;
756 #endif 684 #endif
757 } 685 }
758 } 686 }
759 } 687 }
760 else 688 else
801 appropriate regs_invalidated_by_call bit, even if it's already 729 appropriate regs_invalidated_by_call bit, even if it's already
802 set in fixed_regs. */ 730 set in fixed_regs. */
803 if (i != STACK_POINTER_REGNUM) 731 if (i != STACK_POINTER_REGNUM)
804 { 732 {
805 SET_HARD_REG_BIT (regs_invalidated_by_call, i); 733 SET_HARD_REG_BIT (regs_invalidated_by_call, i);
806 SET_REGNO_REG_SET (regs_invalidated_by_call_regset, i); 734 for (unsigned int j = 0; j < NUM_ABI_IDS; ++j)
735 function_abis[j].add_full_reg_clobber (i);
807 } 736 }
808 737
809 /* If already fixed, nothing else to do. */ 738 /* If already fixed, nothing else to do. */
810 if (fixed_regs[i]) 739 if (fixed_regs[i])
811 return; 740 return;
812 741
813 fixed_regs[i] = call_used_regs[i] = 1; 742 fixed_regs[i] = call_used_regs[i] = 1;
814 #ifdef CALL_REALLY_USED_REGISTERS
815 call_really_used_regs[i] = 1;
816 #endif
817 743
818 SET_HARD_REG_BIT (fixed_reg_set, i); 744 SET_HARD_REG_BIT (fixed_reg_set, i);
819 SET_HARD_REG_BIT (call_used_reg_set, i);
820 SET_HARD_REG_BIT (call_fixed_reg_set, i);
821 745
822 reinit_regs (); 746 reinit_regs ();
823 } 747 }
824 748
825 749
1097 break; 1021 break;
1098 1022
1099 case CLOBBER: 1023 case CLOBBER:
1100 if (MEM_P (XEXP (x, 0))) 1024 if (MEM_P (XEXP (x, 0)))
1101 reg_scan_mark_refs (XEXP (XEXP (x, 0), 0), insn); 1025 reg_scan_mark_refs (XEXP (XEXP (x, 0), 0), insn);
1102 break;
1103
1104 case CLOBBER_HIGH:
1105 gcc_assert (!(MEM_P (XEXP (x, 0))));
1106 break; 1026 break;
1107 1027
1108 case SET: 1028 case SET:
1109 /* Count a set of the destination if it is a register. */ 1029 /* Count a set of the destination if it is a register. */
1110 for (dest = SET_DEST (x); 1030 for (dest = SET_DEST (x);
1314 else 1234 else
1315 shape.offset += size; 1235 shape.offset += size;
1316 } 1236 }
1317 1237
1318 if (valid_mode_changes[regno]) 1238 if (valid_mode_changes[regno])
1319 AND_HARD_REG_SET (*valid_mode_changes[regno], 1239 *valid_mode_changes[regno] &= simplifiable_subregs (shape);
1320 simplifiable_subregs (shape));
1321 else 1240 else
1322 { 1241 {
1323 valid_mode_changes[regno] 1242 valid_mode_changes[regno]
1324 = XOBNEW (&valid_mode_changes_obstack, HARD_REG_SET); 1243 = XOBNEW (&valid_mode_changes_obstack, HARD_REG_SET);
1325 COPY_HARD_REG_SET (*valid_mode_changes[regno], 1244 *valid_mode_changes[regno] = simplifiable_subregs (shape);
1326 simplifiable_subregs (shape));
1327 } 1245 }
1328 } 1246 }
1329 1247
1330 /* Call record_subregs_of_mode for all the subregs in X. */ 1248 /* Call record_subregs_of_mode for all the subregs in X. */
1331 static void 1249 static void