This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [patch] ppc fpmem remvoal
- To: gcc-patches at gcc dot gnu dot org
- Subject: Re: [patch] ppc fpmem remvoal
- From: Clinton Popetz <cpopetz at cygnus dot com>
- Date: Fri, 3 Mar 2000 14:38:58 -0600
- References: <20000229103240.A13955@cpopetz.com> <jmputfwuej.fsf@envy.cygnus.com>
On Tue, Feb 29, 2000 at 01:50:12PM -0800, Geoff Keating wrote:
>
> You can't
>
> > (FIRST_PSEUDO_REGISTER): Decrement.
>
> because that breaks binary compatibility.
Here's a new patch that replaces fpmem with xer (Integer Exception Register),
instead of just deleting fpmem. This preserves binary compatibility, and makes
way for a soon-to-come patch which will use the xer register to split things
like adddi3_noppc64 to allow scheduling.
(All based on Geoff's suggestions.)
-Clint
2000-03-03 Clinton Popetz <cpopetz@cygnus.com>
* config/rs6000/rs6000.c (rs6000_fpmem_offset, rs6000_fpmem_size,
fpmem_operand) Delete.
(xer_operand) New.
(rs6000_reg_names, alt_reg_names): Change fpmem to xer.
(machine_function): Remove fpmem_size, fpmem_offset, save_toc_p.
(rs6000_save_machine_status, rs6000_restore_machine_status,
rs6000_init_expanders, rs6000_stack_info, debug_stack_info): Remove
references to above variables.
(gpc_reg_operand): Use XER_REGNO_P instead of FPMEM_REGNO_P.
* config/rs6000/rs6000.h (REG_ALLOC_ORDER, REGISTER_NAMES,
DEBUG_REGISTER_NAMES): Chagne fpmem to xer.
(FPMEM_REGNO_P, FPMEM_REGNUM): Delete.
(XER_REGNO_P, XER_REGNO): New.
(rs6000_stack): Remove fpmem_p, fpmem_offset, fpmem_size.
(PREDICATE_CODES): Change fpmem_operand to xer_operand.
(HARD_REGNO_NREGS, HARD_REGNO_MODE_OK): Change FPMEM_REGNO_P to
XER_REGNO_P.
(reg_class, REG_CLASS_NAMES, REG_CLASS_CONTENTS, REGNO_REG_CLASS,
REG_CLASS_FROM_LETTER, CLASS_MAX_NREGS): Change FPMEM_REGS to XER_REGS, and remove FLOAT_OR_FPMEM_REGS.
(CLASS_CANNOT_CHANGE_SIZE): Change to FLOAT_REGS.
(EXTRA_CC_MODES): Added CCCA mode.
Index: config/rs6000/rs6000.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/config/rs6000/rs6000.c,v
retrieving revision 1.108.2.21
diff -d -c -2 -p -r1.108.2.21 rs6000.c
*** rs6000.c 2000/02/29 15:02:32 1.108.2.21
--- rs6000.c 2000/03/03 20:06:27
*************** int rs6000_sysv_varargs_p;
*** 104,112 ****
enum rs6000_abi rs6000_current_abi;
- /* Offset & size for fpmem stack locations used for converting between
- float and integral types. */
- int rs6000_fpmem_offset;
- int rs6000_fpmem_size;
-
/* Debug flags */
const char *rs6000_debug_name;
--- 104,107 ----
*************** char rs6000_reg_names[][8] =
*** 147,151 ****
"mq", "lr", "ctr","ap",
"0", "1", "2", "3", "4", "5", "6", "7",
! "fpmem"
};
--- 142,146 ----
"mq", "lr", "ctr","ap",
"0", "1", "2", "3", "4", "5", "6", "7",
! "xer"
};
*************** static char alt_reg_names[][8] =
*** 163,167 ****
"mq", "lr", "ctr", "ap",
"%cr0", "%cr1", "%cr2", "%cr3", "%cr4", "%cr5", "%cr6", "%cr7",
! "fpmem"
};
#endif
--- 158,162 ----
"mq", "lr", "ctr", "ap",
"%cr0", "%cr1", "%cr2", "%cr3", "%cr4", "%cr5", "%cr6", "%cr7",
! "xer"
};
#endif
*************** count_register_operand(op, mode)
*** 520,527 ****
}
- /* Returns 1 if op is memory location for float/int conversions that masquerades
- as a register. */
int
! fpmem_operand(op, mode)
register rtx op;
enum machine_mode mode ATTRIBUTE_UNUSED;
--- 515,520 ----
}
int
! xer_operand(op, mode)
register rtx op;
enum machine_mode mode ATTRIBUTE_UNUSED;
*************** fpmem_operand(op, mode)
*** 530,540 ****
return 0;
! if (FPMEM_REGNO_P (REGNO (op)))
! return 1;
!
! #if 0
! if (REGNO (op) > FIRST_PSEUDO_REGISTER)
return 1;
- #endif
return 0;
--- 523,528 ----
return 0;
! if (XER_REGNO_P (REGNO (op)))
return 1;
return 0;
*************** gpc_reg_operand (op, mode)
*** 585,589 ****
&& (GET_CODE (op) != REG
|| (REGNO (op) >= ARG_POINTER_REGNUM
! && !FPMEM_REGNO_P (REGNO (op)))
|| REGNO (op) < MQ_REGNO));
}
--- 573,577 ----
&& (GET_CODE (op) != REG
|| (REGNO (op) >= ARG_POINTER_REGNUM
! && !XER_REGNO_P (REGNO (op)))
|| REGNO (op) < MQ_REGNO));
}
*************** struct machine_function
*** 3224,3233 ****
{
int sysv_varargs_p;
- int save_toc_p;
- int fpmem_size;
- int fpmem_offset;
};
! /* Functions to save and restore rs6000_fpmem_size.
These will be called, via pointer variables,
from push_function_context and pop_function_context. */
--- 3212,3218 ----
{
int sysv_varargs_p;
};
! /* Functions to save and restore sysv_varargs_p.
These will be called, via pointer variables,
from push_function_context and pop_function_context. */
*************** rs6000_save_machine_status (p)
*** 3242,3247 ****
p->machine = machine;
machine->sysv_varargs_p = rs6000_sysv_varargs_p;
- machine->fpmem_size = rs6000_fpmem_size;
- machine->fpmem_offset = rs6000_fpmem_offset;
}
--- 3227,3230 ----
*************** rs6000_restore_machine_status (p)
*** 3253,3258 ****
rs6000_sysv_varargs_p = machine->sysv_varargs_p;
- rs6000_fpmem_size = machine->fpmem_size;
- rs6000_fpmem_offset = machine->fpmem_offset;
free (machine);
--- 3236,3239 ----
*************** void
*** 3265,3272 ****
rs6000_init_expanders ()
{
! /* Reset varargs and save TOC indicator */
rs6000_sysv_varargs_p = 0;
- rs6000_fpmem_size = 0;
- rs6000_fpmem_offset = 0;
/* Arrange to save and restore machine status around nested functions. */
--- 3246,3251 ----
rs6000_init_expanders ()
{
! /* Reset varargs */
rs6000_sysv_varargs_p = 0;
/* Arrange to save and restore machine status around nested functions. */
*************** rs6000_stack_info ()
*** 4178,4184 ****
info_ptr->calls_p = ! current_function_is_leaf;
- /* Does this machine need the float/int conversion area? */
- info_ptr->fpmem_p = regs_ever_live[FPMEM_REGNUM];
-
/* Determine if we need to save the link register */
if (regs_ever_live[LINK_REGISTER_REGNUM]
--- 4157,4160 ----
*************** rs6000_stack_info ()
*** 4213,4217 ****
info_ptr->vars_size = RS6000_ALIGN (get_frame_size (), 8);
info_ptr->parm_size = RS6000_ALIGN (current_function_outgoing_args_size, 8);
- info_ptr->fpmem_size = (info_ptr->fpmem_p) ? 8 : 0;
info_ptr->save_size = RS6000_ALIGN (info_ptr->fp_size
+ info_ptr->gp_size
--- 4189,4192 ----
*************** rs6000_stack_info ()
*** 4231,4235 ****
info_ptr->fp_save_offset = - info_ptr->fp_size;
info_ptr->gp_save_offset = info_ptr->fp_save_offset - info_ptr->gp_size;
- info_ptr->fpmem_offset = info_ptr->gp_save_offset - info_ptr->fpmem_size;
info_ptr->cr_save_offset = reg_size; /* first word when 64-bit. */
info_ptr->lr_save_offset = 2*reg_size;
--- 4206,4209 ----
*************** rs6000_stack_info ()
*** 4242,4261 ****
info_ptr->cr_save_offset = info_ptr->gp_save_offset - info_ptr->cr_size;
info_ptr->toc_save_offset = info_ptr->cr_save_offset - info_ptr->toc_size;
- info_ptr->fpmem_offset = info_ptr->toc_save_offset - info_ptr->fpmem_size;
info_ptr->lr_save_offset = reg_size;
break;
}
- /* Ensure that fpmem_offset will be aligned to an 8-byte boundary. */
- if (info_ptr->fpmem_p && info_ptr->fpmem_offset % 8 != 0)
- {
- int needed_size = 8 - (info_ptr->fpmem_offset & 7);
- info_ptr->fpmem_size += needed_size;
- info_ptr->fpmem_offset -= needed_size;
- }
-
total_raw_size = (info_ptr->vars_size
+ info_ptr->parm_size
- + info_ptr->fpmem_size
+ info_ptr->save_size
+ info_ptr->varargs_size
--- 4216,4225 ----
*************** rs6000_stack_info ()
*** 4268,4272 ****
For AIX we need to push the stack if a frame pointer is needed (because
the stack might be dynamically adjusted), if we are debugging, if we
! make calls, or if the sum of fp_save, gp_save, fpmem, and local variables
are more than the space needed to save all non-volatile registers:
32-bit: 18*8 + 19*4 = 220 or 64-bit: 18*8 + 18*8 = 288 (GPR13 reserved).
--- 4232,4236 ----
For AIX we need to push the stack if a frame pointer is needed (because
the stack might be dynamically adjusted), if we are debugging, if we
! make calls, or if the sum of fp_save, gp_save, and local variables
are more than the space needed to save all non-volatile registers:
32-bit: 18*8 + 19*4 = 220 or 64-bit: 18*8 + 18*8 = 288 (GPR13 reserved).
*************** rs6000_stack_info ()
*** 4288,4301 ****
> (TARGET_32BIT ? 220 : 288)));
- if (info_ptr->fpmem_p)
- {
- rs6000_fpmem_size = info_ptr->fpmem_size;
- rs6000_fpmem_offset = (info_ptr->push_p
- ? info_ptr->total_size + info_ptr->fpmem_offset
- : info_ptr->fpmem_offset);
- }
- else
- info_ptr->fpmem_offset = 0;
-
/* Zero offsets if we're not saving those registers */
if (info_ptr->fp_size == 0)
--- 4252,4255 ----
*************** debug_stack_info (info)
*** 4364,4370 ****
fprintf (stderr, "\tcalls_p = %5d\n", info->calls_p);
- if (info->fpmem_p)
- fprintf (stderr, "\tfpmem_p = %5d\n", info->fpmem_p);
-
if (info->gp_save_offset)
fprintf (stderr, "\tgp_save_offset = %5d\n", info->gp_save_offset);
--- 4318,4321 ----
*************** debug_stack_info (info)
*** 4385,4391 ****
fprintf (stderr, "\tvarargs_save_offset = %5d\n", info->varargs_save_offset);
- if (info->fpmem_offset)
- fprintf (stderr, "\tfpmem_offset = %5d\n", info->fpmem_offset);
-
if (info->total_size)
fprintf (stderr, "\ttotal_size = %5d\n", info->total_size);
--- 4336,4339 ----
*************** debug_stack_info (info)
*** 4399,4405 ****
if (info->parm_size)
fprintf (stderr, "\tparm_size = %5d\n", info->parm_size);
-
- if (info->fpmem_size)
- fprintf (stderr, "\tfpmem_size = %5d\n", info->fpmem_size);
if (info->fixed_size)
--- 4347,4350 ----
Index: config/rs6000/rs6000.h
===================================================================
RCS file: /cvs/gcc/egcs/gcc/config/rs6000/rs6000.h,v
retrieving revision 1.64.2.20
diff -d -c -2 -p -r1.64.2.20 rs6000.h
*** rs6000.h 2000/02/29 22:35:42 1.64.2.20
--- rs6000.h 2000/03/03 20:06:30
*************** extern int rs6000_debug_arg; /* debug a
*** 686,689 ****
--- 686,690 ----
#define CR4_REGNO 72
#define MAX_CR_REGNO 75
+ #define XER_REGNO 76
/* List the order in which to allocate registers. Each register must be
*************** extern int rs6000_debug_arg; /* debug a
*** 708,712 ****
ctr (not saved; when we have the choice ctr is better)
lr (saved)
! cr5, r1, r2, ap, fpmem (fixed) */
#define REG_ALLOC_ORDER \
--- 709,713 ----
ctr (not saved; when we have the choice ctr is better)
lr (saved)
! cr5, r1, r2, ap, xer (fixed) */
#define REG_ALLOC_ORDER \
*************** extern int rs6000_debug_arg; /* debug a
*** 739,743 ****
/* True if register is the temporary memory location used for int/float
conversion. */
! #define FPMEM_REGNO_P(N) ((N) == FPMEM_REGNUM)
/* Return number of consecutive hard regs needed starting at reg REGNO
--- 740,744 ----
/* True if register is the temporary memory location used for int/float
conversion. */
! #define XER_REGNO_P(N) ((N) == XER_REGNO)
/* Return number of consecutive hard regs needed starting at reg REGNO
*************** extern int rs6000_debug_arg; /* debug a
*** 750,754 ****
#define HARD_REGNO_NREGS(REGNO, MODE) \
! (FP_REGNO_P (REGNO) || FPMEM_REGNO_P (REGNO) \
? ((GET_MODE_SIZE (MODE) + UNITS_PER_FP_WORD - 1) / UNITS_PER_FP_WORD) \
: ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD))
--- 751,755 ----
#define HARD_REGNO_NREGS(REGNO, MODE) \
! (FP_REGNO_P (REGNO) \
? ((GET_MODE_SIZE (MODE) + UNITS_PER_FP_WORD - 1) / UNITS_PER_FP_WORD) \
: ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD))
*************** extern int rs6000_debug_arg; /* debug a
*** 766,770 ****
&& GET_MODE_SIZE (MODE) == UNITS_PER_FP_WORD)) \
: CR_REGNO_P (REGNO) ? GET_MODE_CLASS (MODE) == MODE_CC \
! : FPMEM_REGNO_P (REGNO) ? ((MODE) == DImode || (MODE) == DFmode) \
: ! INT_REGNO_P (REGNO) ? (GET_MODE_CLASS (MODE) == MODE_INT \
&& GET_MODE_SIZE (MODE) <= UNITS_PER_WORD) \
--- 767,771 ----
&& GET_MODE_SIZE (MODE) == UNITS_PER_FP_WORD)) \
: CR_REGNO_P (REGNO) ? GET_MODE_CLASS (MODE) == MODE_CC \
! : XER_REGNO_P (REGNO) ? (MODE) == CCCAmode \
: ! INT_REGNO_P (REGNO) ? (GET_MODE_CLASS (MODE) == MODE_INT \
&& GET_MODE_SIZE (MODE) <= UNITS_PER_WORD) \
*************** extern int rs6000_debug_arg; /* debug a
*** 892,898 ****
#define COUNT_REGISTER_REGNUM 66
- /* Special register that represents memory, used for float/int conversions. */
- #define FPMEM_REGNUM 76
-
/* Place that structure value return address is placed.
--- 893,896 ----
*************** enum reg_class
*** 953,958 ****
CR_REGS,
NON_FLOAT_REGS,
! FPMEM_REGS,
! FLOAT_OR_FPMEM_REGS,
ALL_REGS,
LIM_REG_CLASSES
--- 951,955 ----
CR_REGS,
NON_FLOAT_REGS,
! XER_REGS,
ALL_REGS,
LIM_REG_CLASSES
*************** enum reg_class
*** 979,984 ****
"CR_REGS", \
"NON_FLOAT_REGS", \
! "FPMEM_REGS", \
! "FLOAT_OR_FPMEM_REGS", \
"ALL_REGS" \
}
--- 976,980 ----
"CR_REGS", \
"NON_FLOAT_REGS", \
! "XER_REGS", \
"ALL_REGS" \
}
*************** enum reg_class
*** 1004,1009 ****
{ 0x00000000, 0x00000000, 0x00000ff0 }, /* CR_REGS */ \
{ 0xffffffff, 0x00000000, 0x0000ffff }, /* NON_FLOAT_REGS */ \
! { 0x00000000, 0x00000000, 0x00010000 }, /* FPMEM_REGS */ \
! { 0x00000000, 0xffffffff, 0x00010000 }, /* FLOAT_OR_FPMEM_REGS */ \
{ 0xffffffff, 0xffffffff, 0x0001ffff } /* ALL_REGS */ \
}
--- 1000,1004 ----
{ 0x00000000, 0x00000000, 0x00000ff0 }, /* CR_REGS */ \
{ 0xffffffff, 0x00000000, 0x0000ffff }, /* NON_FLOAT_REGS */ \
! { 0x00000000, 0x00000000, 0x00010000 }, /* XER_REGS */ \
{ 0xffffffff, 0xffffffff, 0x0001ffff } /* ALL_REGS */ \
}
*************** enum reg_class
*** 1024,1028 ****
: (REGNO) == 66 ? CTR_REGS \
: (REGNO) == 67 ? BASE_REGS \
! : (REGNO) == 76 ? FPMEM_REGS \
: NO_REGS)
--- 1019,1023 ----
: (REGNO) == 66 ? CTR_REGS \
: (REGNO) == 67 ? BASE_REGS \
! : (REGNO) == 76 ? XER_REGS \
: NO_REGS)
*************** enum reg_class
*** 1042,1046 ****
: (C) == 'x' ? CR0_REGS \
: (C) == 'y' ? CR_REGS \
! : (C) == 'z' ? FPMEM_REGS \
: NO_REGS)
--- 1037,1041 ----
: (C) == 'x' ? CR0_REGS \
: (C) == 'y' ? CR_REGS \
! : (C) == 'z' ? XER_REGS \
: NO_REGS)
*************** enum reg_class
*** 1135,1140 ****
except in the FP regs, where a single reg is enough for two words. */
#define CLASS_MAX_NREGS(CLASS, MODE) \
! (((CLASS) == FLOAT_REGS || (CLASS) == FPMEM_REGS \
! || (CLASS) == FLOAT_OR_FPMEM_REGS) \
? ((GET_MODE_SIZE (MODE) + UNITS_PER_FP_WORD - 1) / UNITS_PER_FP_WORD) \
: ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD))
--- 1130,1134 ----
except in the FP regs, where a single reg is enough for two words. */
#define CLASS_MAX_NREGS(CLASS, MODE) \
! (((CLASS) == FLOAT_REGS) \
? ((GET_MODE_SIZE (MODE) + UNITS_PER_FP_WORD - 1) / UNITS_PER_FP_WORD) \
: ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD))
*************** enum reg_class
*** 1143,1147 ****
operand of a SUBREG that changes the size of the object. */
! #define CLASS_CANNOT_CHANGE_SIZE FLOAT_OR_FPMEM_REGS
/* Stack layout; function entry, exit and calling. */
--- 1137,1141 ----
operand of a SUBREG that changes the size of the object. */
! #define CLASS_CANNOT_CHANGE_SIZE FLOAT_REGS
/* Stack layout; function entry, exit and calling. */
*************** typedef struct rs6000_stack {
*** 1167,1171 ****
int push_p; /* true if we need to allocate stack space */
int calls_p; /* true if the function makes any calls */
- int fpmem_p; /* true if float/int conversion temp needed */
enum rs6000_abi abi; /* which ABI to use */
int gp_save_offset; /* offset to save GP regs from initial SP */
--- 1161,1164 ----
*************** typedef struct rs6000_stack {
*** 1175,1179 ****
int toc_save_offset; /* offset to save the TOC pointer */
int varargs_save_offset; /* offset to save the varargs registers */
- int fpmem_offset; /* offset for float/int conversion temp */
int reg_size; /* register size (4 or 8) */
int varargs_size; /* size to hold V.4 args passed in regs */
--- 1168,1171 ----
*************** typedef struct rs6000_stack {
*** 1186,1190 ****
int cr_size; /* size to hold CR if not in save_size */
int lr_size; /* size to hold LR if not in save_size */
- int fpmem_size; /* size to hold float/int conversion */
int toc_size; /* size to hold TOC if not in save_size */
int total_size; /* total bytes allocated for stack */
--- 1178,1181 ----
*************** typedef struct rs6000_stack {
*** 1220,1228 ****
(TARGET_32BIT ? 20 : 40)))
- /* Offset & size for fpmem stack locations used for converting between
- float and integral types. */
- extern int rs6000_fpmem_offset;
- extern int rs6000_fpmem_size;
-
/* Size of the V.4 varargs area if needed */
#define RS6000_VARARGS_AREA 0
--- 1211,1214 ----
*************** do {
*** 2274,2278 ****
CC(CCUNSmode, "CCUNS") \
CC(CCFPmode, "CCFP") \
! CC(CCEQmode, "CCEQ")
/* Given a comparison code (EQ, NE, etc.) and the first operand of a COMPARE,
--- 2260,2265 ----
CC(CCUNSmode, "CCUNS") \
CC(CCFPmode, "CCFP") \
! CC(CCEQmode, "CCEQ") \
! CC(CCCAmode, "CCCA")
/* Given a comparison code (EQ, NE, etc.) and the first operand of a COMPARE,
*************** extern char rs6000_reg_names[][8]; /* re
*** 2514,2518 ****
&rs6000_reg_names[75][0], /* cr7 */ \
\
! &rs6000_reg_names[76][0], /* fpmem */ \
}
--- 2501,2505 ----
&rs6000_reg_names[75][0], /* cr7 */ \
\
! &rs6000_reg_names[76][0], /* xer */ \
}
*************** extern char rs6000_reg_names[][8]; /* re
*** 2533,2537 ****
"mq", "lr", "ctr", "ap", \
"cr0", "cr1", "cr2", "cr3", "cr4", "cr5", "cr6", "cr7", \
! "fpmem" \
}
--- 2520,2524 ----
"mq", "lr", "ctr", "ap", \
"cr0", "cr1", "cr2", "cr3", "cr4", "cr5", "cr6", "cr7", \
! "xer" \
}
*************** do { \
*** 2742,2746 ****
{"mask64_operand", {CONST_INT, CONST_DOUBLE}}, \
{"count_register_operand", {REG}}, \
! {"fpmem_operand", {REG}}, \
{"call_operand", {SYMBOL_REF, REG}}, \
{"current_file_function_operand", {SYMBOL_REF}}, \
--- 2729,2733 ----
{"mask64_operand", {CONST_INT, CONST_DOUBLE}}, \
{"count_register_operand", {REG}}, \
! {"xer_operand", {REG}}, \
{"call_operand", {SYMBOL_REF, REG}}, \
{"current_file_function_operand", {SYMBOL_REF}}, \