int first_reg;
/* Find lowest numbered live register. */
- for (first_reg = 13; first_reg <= 31; first_reg++)
+ for (first_reg = FIRST_SAVED_GP_REGNO; first_reg <= LAST_GPR_REGNO;
+ first_reg++)
if (save_reg_p (first_reg))
break;
int first_reg;
/* Find lowest numbered live register. */
- for (first_reg = 14 + 32; first_reg <= 63; first_reg++)
+ for (first_reg = FIRST_SAVED_FP_REGNO; first_reg <= LAST_FPR_REGNO;
+ first_reg++)
if (save_reg_p (first_reg))
break;
return FIRST_ALTIVEC_REGNO + 20;
/* Find lowest numbered live register. */
- for (i = FIRST_ALTIVEC_REGNO + 20; i <= LAST_ALTIVEC_REGNO; ++i)
+ for (i = FIRST_SAVED_ALTIVEC_REGNO; i <= LAST_ALTIVEC_REGNO; ++i)
if (save_reg_p (i))
break;
| SAVE_INLINE_GPRS | REST_INLINE_GPRS
| SAVE_INLINE_VRS | REST_INLINE_VRS);
- if (info->first_gp_reg_save == 32)
+ if (info->first_gp_reg_save == LAST_GPR_REGNO + 1)
strategy |= SAVE_INLINE_GPRS | REST_INLINE_GPRS;
- if (info->first_fp_reg_save == 64)
+ if (info->first_fp_reg_save == LAST_FPR_REGNO + 1)
strategy |= SAVE_INLINE_FPRS | REST_INLINE_FPRS;
if (info->first_altivec_reg_save == LAST_ALTIVEC_REGNO + 1)
else
{
/* Prefer out-of-line restore if it will exit. */
- if (info->first_fp_reg_save > 61)
+ if (info->first_fp_reg_save > LAST_FPR_REGNO - 2)
strategy |= SAVE_INLINE_FPRS;
- if (info->first_gp_reg_save > 29)
+ if (info->first_gp_reg_save > LAST_GPR_REGNO - 2)
{
- if (info->first_fp_reg_save == 64)
+ if (info->first_fp_reg_save == LAST_FPR_REGNO + 1)
strategy |= SAVE_INLINE_GPRS;
else
strategy |= SAVE_INLINE_GPRS | REST_INLINE_GPRS;
}
else if (DEFAULT_ABI == ABI_DARWIN)
{
- if (info->first_fp_reg_save > 60)
+ if (info->first_fp_reg_save > LAST_FPR_REGNO - 3)
strategy |= SAVE_INLINE_FPRS | REST_INLINE_FPRS;
- if (info->first_gp_reg_save > 29)
+ if (info->first_gp_reg_save > LAST_GPR_REGNO - 2)
strategy |= SAVE_INLINE_GPRS | REST_INLINE_GPRS;
strategy |= SAVE_INLINE_VRS | REST_INLINE_VRS;
}
{
gcc_checking_assert (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2);
if ((flag_shrink_wrap_separate && optimize_function_for_speed_p (cfun))
- || info->first_fp_reg_save > 61)
+ || info->first_fp_reg_save > LAST_FPR_REGNO - 2)
strategy |= SAVE_INLINE_FPRS | REST_INLINE_FPRS;
strategy |= SAVE_INLINE_GPRS | REST_INLINE_GPRS;
strategy |= SAVE_INLINE_VRS | REST_INLINE_VRS;
out-of-line register restore functions if a fixed reg is in the
range of regs restored. */
if (!(strategy & REST_INLINE_FPRS))
- for (int i = info->first_fp_reg_save; i < 64; i++)
+ for (int i = info->first_fp_reg_save; i < LAST_FPR_REGNO + 1; i++)
if (fixed_regs[i])
{
strategy |= REST_INLINE_FPRS;
out-of-line then we know we haven't skipped any fprs. */
if ((strategy & SAVE_INLINE_FPRS)
&& !(strategy & REST_INLINE_FPRS))
- for (int i = info->first_fp_reg_save; i < 64; i++)
+ for (int i = info->first_fp_reg_save; i < LAST_FPR_REGNO + 1; i++)
if (!save_reg_p (i))
{
strategy |= REST_INLINE_FPRS;
if (TARGET_MULTIPLE
&& !TARGET_POWERPC64
- && info->first_gp_reg_save < 31
+ && info->first_gp_reg_save < LAST_GPR_REGNO
&& !(flag_shrink_wrap
&& flag_shrink_wrap_separate
&& optimize_function_for_speed_p (cfun)))
{
int count = 0;
- for (int i = info->first_gp_reg_save; i < 32; i++)
+ for (int i = info->first_gp_reg_save; i < LAST_GPR_REGNO + 1; i++)
if (save_reg_p (i))
count++;
"exit" out-of-line gpr restore if we have saved some
fprs; In those cases it is advantageous to use load
multiple when available. */
- if (info->first_fp_reg_save != 64 || !lr_save_p)
+ if (info->first_fp_reg_save != LAST_FPR_REGNO + 1 || !lr_save_p)
strategy |= REST_INLINE_GPRS | REST_MULTIPLE;
}
}
/* Using the "exit" out-of-line routine does not improve code size
if using it would require lr to be saved and if only saving one
or two gprs. */
- else if (!lr_save_p && info->first_gp_reg_save > 29)
+ else if (!lr_save_p && info->first_gp_reg_save > LAST_GPR_REGNO - 2)
strategy |= SAVE_INLINE_GPRS | REST_INLINE_GPRS;
/* Don't ever restore fixed regs. */
if ((strategy & (REST_INLINE_GPRS | REST_MULTIPLE)) != REST_INLINE_GPRS)
- for (int i = info->first_gp_reg_save; i < 32; i++)
+ for (int i = info->first_gp_reg_save; i < LAST_GPR_REGNO + 1; i++)
if (fixed_reg_p (i))
{
strategy |= REST_INLINE_GPRS;
we haven't skipped any gprs. */
if ((strategy & (SAVE_INLINE_GPRS | SAVE_MULTIPLE)) == SAVE_INLINE_GPRS
&& (strategy & (REST_INLINE_GPRS | REST_MULTIPLE)) != REST_INLINE_GPRS)
- for (int i = info->first_gp_reg_save; i < 32; i++)
+ for (int i = info->first_gp_reg_save; i < LAST_GPR_REGNO + 1; i++)
if (!save_reg_p (i))
{
strategy |= REST_INLINE_GPRS;
if (!(strategy & SAVE_INLINE_FPRS))
strategy |= SAVE_NOINLINE_FPRS_SAVES_LR;
else if (!(strategy & SAVE_INLINE_GPRS)
- && info->first_fp_reg_save == 64)
+ && info->first_fp_reg_save == LAST_FPR_REGNO + 1)
strategy |= SAVE_NOINLINE_GPRS_SAVES_LR;
}
else if (TARGET_AIX && !(strategy & REST_INLINE_FPRS))
else
first_gp = info->first_gp_reg_save;
- info->gp_size = reg_size * (32 - first_gp);
+ info->gp_size = reg_size * (LAST_GPR_REGNO + 1 - first_gp);
info->first_fp_reg_save = first_fp_reg_to_save ();
- info->fp_size = 8 * (64 - info->first_fp_reg_save);
+ info->fp_size = 8 * (LAST_FPR_REGNO + 1 - info->first_fp_reg_save);
info->first_altivec_reg_save = first_altivec_reg_to_save ();
info->altivec_size = 16 * (LAST_ALTIVEC_REGNO + 1
if (TARGET_ALTIVEC_ABI)
fprintf (stderr, "\tALTIVEC ABI extensions enabled.\n");
- if (info->first_gp_reg_save != 32)
+ if (info->first_gp_reg_save <= LAST_GPR_REGNO)
fprintf (stderr, "\tfirst_gp_reg_save = %5d\n", info->first_gp_reg_save);
- if (info->first_fp_reg_save != 64)
+ if (info->first_fp_reg_save <= LAST_FPR_REGNO)
fprintf (stderr, "\tfirst_fp_reg_save = %5d\n", info->first_fp_reg_save);
if (info->first_altivec_reg_save <= LAST_ALTIVEC_REGNO)
{
if (REG_P (stack_limit_rtx)
&& REGNO (stack_limit_rtx) > 1
- && REGNO (stack_limit_rtx) <= 31)
+ && REGNO (stack_limit_rtx) <= LAST_GPR_REGNO)
{
rtx_insn *insn
= gen_add3_insn (tmp_reg, stack_limit_rtx, GEN_INT (size));
/* It's really GPR 13 or 14, FPR 14 and VR 20. We need the smallest. */
#define FIRST_SAVRES_REGISTER FIRST_SAVED_GP_REGNO
-#define LAST_SAVRES_REGISTER 31
+#define LAST_SAVRES_REGISTER LAST_GPR_REGNO
#define N_SAVRES_REGISTERS (LAST_SAVRES_REGISTER - FIRST_SAVRES_REGISTER + 1)
enum {
int regno = ((sel & SAVRES_REG) == SAVRES_GPR
? info->first_gp_reg_save
: (sel & SAVRES_REG) == SAVRES_FPR
- ? info->first_fp_reg_save - 32
+ ? info->first_fp_reg_save - FIRST_FPR_REGNO
: (sel & SAVRES_REG) == SAVRES_VR
? info->first_altivec_reg_save - FIRST_ALTIVEC_REGNO
: -1);
? info->first_altivec_reg_save
: -1);
end_reg = ((sel & SAVRES_REG) == SAVRES_GPR
- ? 32
+ ? LAST_GPR_REGNO + 1
: (sel & SAVRES_REG) == SAVRES_FPR
- ? 64
+ ? LAST_FPR_REGNO + 1
: (sel & SAVRES_REG) == SAVRES_VR
? LAST_ALTIVEC_REGNO + 1
: -1);
Components 13..31 are the save/restore of GPR13..GPR31.
Components 46..63 are the save/restore of FPR14..FPR31. */
- cfun->machine->n_components = 64;
+ cfun->machine->n_components = LAST_FPR_REGNO + 1;
sbitmap components = sbitmap_alloc (cfun->machine->n_components);
bitmap_clear (components);
if (info->push_p)
offset += info->total_size;
- for (unsigned regno = info->first_gp_reg_save; regno < 32; regno++)
+ for (unsigned regno = info->first_gp_reg_save;
+ regno < LAST_GPR_REGNO + 1; regno++)
{
if (IN_RANGE (offset, -0x8000, 0x7fff)
&& save_reg_p (regno))
if (info->push_p)
offset += info->total_size;
- for (unsigned regno = info->first_fp_reg_save; regno < 64; regno++)
+ for (unsigned regno = info->first_fp_reg_save;
+ regno < LAST_FPR_REGNO + 1; regno++)
{
if (IN_RANGE (offset, -0x8000, 0x7fff) && save_reg_p (regno))
bitmap_set_bit (components, regno);
/* A register is used in a bb if it is in the IN, GEN, or KILL sets. */
/* GPRs. */
- for (unsigned regno = info->first_gp_reg_save; regno < 32; regno++)
+ for (unsigned regno = info->first_gp_reg_save;
+ regno < LAST_GPR_REGNO + 1; regno++)
if (bitmap_bit_p (in, regno)
|| bitmap_bit_p (gen, regno)
|| bitmap_bit_p (kill, regno))
bitmap_set_bit (components, regno);
/* FPRs. */
- for (unsigned regno = info->first_fp_reg_save; regno < 64; regno++)
+ for (unsigned regno = info->first_fp_reg_save;
+ regno < LAST_FPR_REGNO + 1; regno++)
if (bitmap_bit_p (in, regno)
|| bitmap_bit_p (gen, regno)
|| bitmap_bit_p (kill, regno))
if (info->push_p)
offset += info->total_size;
- for (int i = info->first_gp_reg_save; i < 32; i++)
+ for (int i = info->first_gp_reg_save; i < LAST_GPR_REGNO + 1; i++)
{
if (bitmap_bit_p (components, i))
{
if (info->push_p)
offset += info->total_size;
- for (int i = info->first_fp_reg_save; i < 64; i++)
+ for (int i = info->first_fp_reg_save; i < LAST_FPR_REGNO + 1; i++)
{
if (bitmap_bit_p (components, i))
{
if (info->push_p)
offset += info->total_size;
- for (int i = info->first_fp_reg_save; i < 64; i++)
+ for (int i = info->first_fp_reg_save; i < LAST_FPR_REGNO + 1; i++)
{
if (bitmap_bit_p (components, i))
{
if (info->push_p)
offset += info->total_size;
- for (int i = info->first_gp_reg_save; i < 32; i++)
+ for (int i = info->first_gp_reg_save; i < LAST_GPR_REGNO + 1; i++)
{
if (bitmap_bit_p (components, i))
{
{
rs6000_stack_t *info = rs6000_stack_info ();
- for (int i = info->first_gp_reg_save; i < 32; i++)
+ for (int i = info->first_gp_reg_save; i < LAST_GPR_REGNO + 1; i++)
if (bitmap_bit_p (components, i))
cfun->machine->gpr_is_wrapped_separately[i] = true;
- for (int i = info->first_fp_reg_save; i < 64; i++)
+ for (int i = info->first_fp_reg_save; i < LAST_FPR_REGNO + 1; i++)
if (bitmap_bit_p (components, i))
- cfun->machine->fpr_is_wrapped_separately[i - 32] = true;
+ cfun->machine->fpr_is_wrapped_separately[i - FIRST_FPR_REGNO] = true;
if (bitmap_bit_p (components, 0))
cfun->machine->lr_is_wrapped_separately = true;
/* Preserve CR2 for save_world prologues */
sz = 5;
- sz += 32 - info->first_gp_reg_save;
- sz += 64 - info->first_fp_reg_save;
+ sz += LAST_GPR_REGNO + 1 - info->first_gp_reg_save;
+ sz += LAST_FPR_REGNO + 1 - info->first_fp_reg_save;
sz += LAST_ALTIVEC_REGNO - info->first_altivec_reg_save + 1;
p = rtvec_alloc (sz);
j = 0;
"*save_world"));
/* We do floats first so that the instruction pattern matches
properly. */
- for (i = 0; i < 64 - info->first_fp_reg_save; i++)
+ for (i = 0; i < LAST_FPR_REGNO + 1 - info->first_fp_reg_save; i++)
RTVEC_ELT (p, j++)
= gen_frame_store (gen_rtx_REG (TARGET_HARD_FLOAT ? DFmode : SFmode,
info->first_fp_reg_save + i),
info->first_altivec_reg_save + i),
frame_reg_rtx,
info->altivec_save_offset + frame_off + 16 * i);
- for (i = 0; i < 32 - info->first_gp_reg_save; i++)
+ for (i = 0; i < LAST_GPR_REGNO + 1 - info->first_gp_reg_save; i++)
RTVEC_ELT (p, j++)
= gen_frame_store (gen_rtx_REG (reg_mode, info->first_gp_reg_save + i),
frame_reg_rtx,
ptr_regno = 11;
else if (info->cr_save_p
|| info->lr_save_p
- || info->first_fp_reg_save < 64
- || info->first_gp_reg_save < 32
+ || info->first_fp_reg_save < LAST_FPR_REGNO + 1
+ || info->first_gp_reg_save < LAST_GPR_REGNO + 1
|| info->altivec_size != 0
|| info->vrsave_size != 0
|| crtl->calls_eh_return)
frame_reg_rtx = ptr_reg;
if (!(strategy & SAVE_INLINE_FPRS) && info->fp_size != 0)
gcc_checking_assert (info->fp_save_offset + info->fp_size == 0);
- else if (!(strategy & SAVE_INLINE_GPRS) && info->first_gp_reg_save < 32)
+ else if (!(strategy & SAVE_INLINE_GPRS)
+ && info->first_gp_reg_save < LAST_GPR_REGNO + 1)
ptr_off = info->gp_save_offset + info->gp_size;
else if (!(strategy & SAVE_INLINE_VRS) && info->altivec_size != 0)
ptr_off = info->altivec_save_offset + info->altivec_size;
if (!WORLD_SAVE_P (info) && (strategy & SAVE_INLINE_FPRS))
{
int offset = info->fp_save_offset + frame_off;
- for (int i = info->first_fp_reg_save; i < 64; i++)
+ for (int i = info->first_fp_reg_save; i < LAST_FPR_REGNO + 1; i++)
{
if (save_reg_p (i)
- && !cfun->machine->fpr_is_wrapped_separately[i - 32])
+ && !cfun->machine->fpr_is_wrapped_separately[i - FIRST_FPR_REGNO])
emit_frame_save (frame_reg_rtx, fp_reg_mode, i, offset,
sp_off - frame_off);
offset += fp_reg_size;
}
}
- else if (!WORLD_SAVE_P (info) && info->first_fp_reg_save != 64)
+ else if (!WORLD_SAVE_P (info)
+ && info->first_fp_reg_save != LAST_FPR_REGNO + 1)
{
bool lr = (strategy & SAVE_NOINLINE_FPRS_SAVES_LR) != 0;
int sel = SAVRES_SAVE | SAVRES_FPR | (lr ? SAVRES_LR : 0);
{
rtvec p;
int i;
- p = rtvec_alloc (32 - info->first_gp_reg_save);
- for (i = 0; i < 32 - info->first_gp_reg_save; i++)
+ p = rtvec_alloc (LAST_GPR_REGNO + 1 - info->first_gp_reg_save);
+ for (i = 0; i < LAST_GPR_REGNO + 1 - info->first_gp_reg_save; i++)
RTVEC_ELT (p, i)
= gen_frame_store (gen_rtx_REG (reg_mode, info->first_gp_reg_save + i),
frame_reg_rtx,
else if (!WORLD_SAVE_P (info))
{
int offset = info->gp_save_offset + frame_off;
- for (int i = info->first_gp_reg_save; i < 32; i++)
+ for (int i = info->first_gp_reg_save; i < LAST_GPR_REGNO + 1; i++)
{
if (save_reg_p (i)
&& !cfun->machine->gpr_is_wrapped_separately[i])
/* Write .extern for any function we will call to save and restore
fp values. */
- if (info->first_fp_reg_save < 64
+ if (info->first_fp_reg_save < LAST_FPR_REGNO + 1
&& !TARGET_MACHO
&& !TARGET_ELF)
{
char *name;
- int regno = info->first_fp_reg_save - 32;
+ int regno = info->first_fp_reg_save - FIRST_FPR_REGNO;
if ((info->savres_strategy & SAVE_INLINE_FPRS) == 0)
{
&& (restoring_FPRs_inline
|| (strategy & REST_NOINLINE_FPRS_DOESNT_RESTORE_LR))
&& (restoring_GPRs_inline
- || info->first_fp_reg_save < 64)
+ || info->first_fp_reg_save < LAST_FPR_REGNO + 1)
&& !cfun->machine->lr_is_wrapped_separately);
rtvec p;
p = rtvec_alloc (9
- + 32 - info->first_gp_reg_save
+ + LAST_GPR_REGNO + 1 - info->first_gp_reg_save
+ LAST_ALTIVEC_REGNO + 1 - info->first_altivec_reg_save
- + 63 + 1 - info->first_fp_reg_save);
+ + LAST_FPR_REGNO + 1 - info->first_fp_reg_save);
const char *rname;
switch (epilogue_type)
}
int i;
- for (i = 0; i < 32 - info->first_gp_reg_save; i++)
+ for (i = 0; i < LAST_GPR_REGNO + 1 - info->first_gp_reg_save; i++)
{
rtx reg = gen_rtx_REG (reg_mode, info->first_gp_reg_save + i);
RTVEC_ELT (p, j++)
&& save_reg_p (info->first_altivec_reg_save + i))
cfa_restores = alloc_reg_note (REG_CFA_RESTORE, reg, cfa_restores);
}
- for (i = 0; info->first_fp_reg_save + i <= 63; i++)
+ for (i = 0; info->first_fp_reg_save + i <= LAST_FPR_REGNO; i++)
{
rtx reg = gen_rtx_REG (TARGET_HARD_FLOAT ? DFmode : SFmode,
info->first_fp_reg_save + i);
location. */
bool exit_func = (!restoring_FPRs_inline
|| (!restoring_GPRs_inline
- && info->first_fp_reg_save == 64));
+ && info->first_fp_reg_save == LAST_FPR_REGNO + 1));
/* In the ELFv2 ABI we need to restore all call-saved CR fields from
*separate* slots if the routine calls __builtin_eh_return, so
else if (using_load_multiple)
{
rtvec p;
- p = rtvec_alloc (32 - info->first_gp_reg_save);
- for (i = 0; i < 32 - info->first_gp_reg_save; i++)
+ p = rtvec_alloc (LAST_GPR_REGNO + 1 - info->first_gp_reg_save);
+ for (i = 0; i < LAST_GPR_REGNO + 1 - info->first_gp_reg_save; i++)
RTVEC_ELT (p, i)
= gen_frame_load (gen_rtx_REG (reg_mode, info->first_gp_reg_save + i),
frame_reg_rtx,
else
{
int offset = info->gp_save_offset + frame_off;
- for (i = info->first_gp_reg_save; i < 32; i++)
+ for (i = info->first_gp_reg_save; i < LAST_GPR_REGNO + 1; i++)
{
if (save_reg_p (i)
&& !cfun->machine->gpr_is_wrapped_separately[i])
restores. */
if (flag_shrink_wrap
&& !restoring_GPRs_inline
- && info->first_fp_reg_save == 64)
+ && info->first_fp_reg_save == LAST_FPR_REGNO + 1)
cfa_restores = add_crlr_cfa_restore (info, cfa_restores);
- for (i = info->first_gp_reg_save; i < 32; i++)
+ for (i = info->first_gp_reg_save; i < LAST_GPR_REGNO + 1; i++)
if (save_reg_p (i)
&& !cfun->machine->gpr_is_wrapped_separately[i])
{
}
if (!restoring_GPRs_inline
- && info->first_fp_reg_save == 64)
+ && info->first_fp_reg_save == LAST_FPR_REGNO + 1)
{
/* We are jumping to an out-of-line function. */
if (cfa_restores)
if (restoring_FPRs_inline)
{
int offset = info->fp_save_offset + frame_off;
- for (i = info->first_fp_reg_save; i < 64; i++)
+ for (i = info->first_fp_reg_save; i < LAST_FPR_REGNO + 1; i++)
{
if (save_reg_p (i)
- && !cfun->machine->fpr_is_wrapped_separately[i - 32])
+ && !cfun->machine->fpr_is_wrapped_separately[i - FIRST_FPR_REGNO])
{
rtx reg = gen_rtx_REG (fp_reg_mode, i);
emit_insn (gen_frame_load (reg, frame_reg_rtx, offset));
if (epilogue_type != EPILOGUE_TYPE_SIBCALL && !restoring_FPRs_inline)
{
bool lr = (strategy & REST_NOINLINE_FPRS_DOESNT_RESTORE_LR) == 0;
- rtvec p = rtvec_alloc (3 + !!lr + 64 - info->first_fp_reg_save);
+ rtvec p = rtvec_alloc (3 + !!lr
+ + LAST_FPR_REGNO + 1 - info->first_fp_reg_save);
int elt = 0;
RTVEC_ELT (p, elt++) = ret_rtx;
if (lr)
reg = (DEFAULT_ABI == ABI_AIX || DEFAULT_ABI == ABI_ELFv2)? 1 : 11;
RTVEC_ELT (p, elt++) = gen_rtx_USE (VOIDmode, gen_rtx_REG (Pmode, reg));
- for (i = 0; i < 64 - info->first_fp_reg_save; i++)
+ for (i = 0; i < LAST_FPR_REGNO + 1 - info->first_fp_reg_save; i++)
{
rtx reg = gen_rtx_REG (DFmode, info->first_fp_reg_save + i);
function logs/aborts fp operations. */
/* Assume that fp operations are used if any fp reg must be saved. */
fprintf (file, "%d,",
- (optional_tbtab << 5) | ((info->first_fp_reg_save != 64) << 1));
+ (optional_tbtab << 5) | ((info->first_fp_reg_save
+ != LAST_FPR_REGNO + 1) << 1));
/* 6 bitfields: function is interrupt handler, name present in
proc table, function calls alloca, on condition directives
/* 3 bitfields: saves backchain, fixup code, number of fpr saved
(6 bits). */
fprintf (file, "%d,",
- (info->push_p << 7) | (64 - info->first_fp_reg_save));
+ (info->push_p << 7) | (LAST_FPR_REGNO + 1
+ - info->first_fp_reg_save));
/* 2 bitfields: spare bits (2 bits), number of gpr saved (6 bits). */
- fprintf (file, "%d,", (32 - first_reg_to_save ()));
+ fprintf (file, "%d,", (LAST_GPR_REGNO + 1 - first_reg_to_save ()));
if (optional_tbtab)
{