* config/rs6000/rs6000-protos.h

(rs6000_conditional_register_usage): Protoize.

	* config/rs6000/rs6000.c (rs6000_conditional_register_usage): New.

	* config/rs6000/rs6000.h (CONDITIONAL_REGISTER_USAGE): Call
	function.

From-SVN: r81650
This commit is contained in:
Aldy Hernandez 2004-05-09 14:32:49 +00:00 committed by Aldy Hernandez
parent 8dc2384cc9
commit 2aa4498c50
4 changed files with 79 additions and 52 deletions

View file

@ -1,3 +1,13 @@
2004-05-09 Aldy Hernandez <aldyh@redhat.com>
* config/rs6000/rs6000-protos.h
(rs6000_conditional_register_usage): Protoize.
* config/rs6000/rs6000.c (rs6000_conditional_register_usage): New.
* config/rs6000/rs6000.h (CONDITIONAL_REGISTER_USAGE): Call
function.
2004-05-08 Roger Sayle <roger@eyesopen.com>
* fold-const.c (fold_div_compare): New function to optimize X/C1 op C2

View file

@ -202,6 +202,7 @@ extern bool rs6000_tls_referenced_p (rtx);
extern int rs6000_tls_symbol_ref (rtx, enum machine_mode);
extern void rs6000_output_dwarf_dtprel (FILE*, int, rtx);
extern int rs6000_hard_regno_nregs (int, enum machine_mode);
extern void rs6000_conditional_register_usage (void);
/* Declare functions in rs6000-c.c */

View file

@ -3430,6 +3430,71 @@ rs6000_hard_regno_nregs (int regno, enum machine_mode mode)
return (GET_MODE_SIZE (mode) + UNITS_PER_WORD - 1) / UNITS_PER_WORD;
}
/* Change register usage conditional on target flags. */
void
rs6000_conditional_register_usage (void)
{
int i;
/* Set MQ register fixed (already call_used) if not POWER
architecture (RIOS1, RIOS2, RSC, and PPC601) so that it will not
be allocated. */
if (! TARGET_POWER)
fixed_regs[64] = 1;
/* 64-bit AIX reserves GPR13 for thread-private data. */
if (TARGET_64BIT)
fixed_regs[13] = call_used_regs[13]
= call_really_used_regs[13] = 1;
/* Conditionally disable FPRs. */
if (TARGET_SOFT_FLOAT || !TARGET_FPRS)
for (i = 32; i < 64; i++)
fixed_regs[i] = call_used_regs[i]
= call_really_used_regs[i] = 1;
if (DEFAULT_ABI == ABI_V4
&& PIC_OFFSET_TABLE_REGNUM != INVALID_REGNUM
&& flag_pic == 2)
fixed_regs[RS6000_PIC_OFFSET_TABLE_REGNUM] = 1;
if (DEFAULT_ABI == ABI_V4
&& PIC_OFFSET_TABLE_REGNUM != INVALID_REGNUM
&& flag_pic == 1)
fixed_regs[RS6000_PIC_OFFSET_TABLE_REGNUM]
= call_used_regs[RS6000_PIC_OFFSET_TABLE_REGNUM]
= call_really_used_regs[RS6000_PIC_OFFSET_TABLE_REGNUM] = 1;
if (DEFAULT_ABI == ABI_DARWIN
&& PIC_OFFSET_TABLE_REGNUM != INVALID_REGNUM)
global_regs[RS6000_PIC_OFFSET_TABLE_REGNUM]
= fixed_regs[RS6000_PIC_OFFSET_TABLE_REGNUM]
= call_used_regs[RS6000_PIC_OFFSET_TABLE_REGNUM]
= call_really_used_regs[RS6000_PIC_OFFSET_TABLE_REGNUM] = 1;
if (TARGET_ALTIVEC)
global_regs[VSCR_REGNO] = 1;
if (TARGET_SPE)
{
global_regs[SPEFSCR_REGNO] = 1;
fixed_regs[FIXED_SCRATCH]
= call_used_regs[FIXED_SCRATCH]
= call_really_used_regs[FIXED_SCRATCH] = 1;
}
if (! TARGET_ALTIVEC)
{
for (i = FIRST_ALTIVEC_REGNO; i <= LAST_ALTIVEC_REGNO; ++i)
fixed_regs[i] = call_used_regs[i] = call_really_used_regs[i] = 1;
call_really_used_regs[VRSAVE_REGNO] = 1;
}
if (TARGET_ALTIVEC_ABI)
for (i = FIRST_ALTIVEC_REGNO; i < FIRST_ALTIVEC_REGNO + 20; ++i)
call_used_regs[i] = call_really_used_regs[i] = 1;
}
/* Try to output insns to set TARGET equal to the constant C if it can
be done in less than N insns. Do all computations in MODE.

View file

@ -1097,59 +1097,10 @@ extern const char *rs6000_warn_altivec_long_switch;
#define FIXED_SCRATCH (TARGET_SPE ? 14 : 11)
/* Define this macro to change register usage conditional on target flags.
Set MQ register fixed (already call_used) if not POWER architecture
(RIOS1, RIOS2, RSC, and PPC601) so that it will not be allocated.
64-bit AIX reserves GPR13 for thread-private data.
Conditionally disable FPRs. */
/* Define this macro to change register usage conditional on target
flags. */
#define CONDITIONAL_REGISTER_USAGE \
{ \
int i; \
if (! TARGET_POWER) \
fixed_regs[64] = 1; \
if (TARGET_64BIT) \
fixed_regs[13] = call_used_regs[13] \
= call_really_used_regs[13] = 1; \
if (TARGET_SOFT_FLOAT || !TARGET_FPRS) \
for (i = 32; i < 64; i++) \
fixed_regs[i] = call_used_regs[i] \
= call_really_used_regs[i] = 1; \
if (DEFAULT_ABI == ABI_V4 \
&& PIC_OFFSET_TABLE_REGNUM != INVALID_REGNUM \
&& flag_pic == 2) \
fixed_regs[RS6000_PIC_OFFSET_TABLE_REGNUM] = 1; \
if (DEFAULT_ABI == ABI_V4 \
&& PIC_OFFSET_TABLE_REGNUM != INVALID_REGNUM \
&& flag_pic == 1) \
fixed_regs[RS6000_PIC_OFFSET_TABLE_REGNUM] \
= call_used_regs[RS6000_PIC_OFFSET_TABLE_REGNUM] \
= call_really_used_regs[RS6000_PIC_OFFSET_TABLE_REGNUM] = 1; \
if (DEFAULT_ABI == ABI_DARWIN \
&& PIC_OFFSET_TABLE_REGNUM != INVALID_REGNUM) \
global_regs[RS6000_PIC_OFFSET_TABLE_REGNUM] \
= fixed_regs[RS6000_PIC_OFFSET_TABLE_REGNUM] \
= call_used_regs[RS6000_PIC_OFFSET_TABLE_REGNUM] \
= call_really_used_regs[RS6000_PIC_OFFSET_TABLE_REGNUM] = 1; \
if (TARGET_ALTIVEC) \
global_regs[VSCR_REGNO] = 1; \
if (TARGET_SPE) \
{ \
global_regs[SPEFSCR_REGNO] = 1; \
fixed_regs[FIXED_SCRATCH] \
= call_used_regs[FIXED_SCRATCH] \
= call_really_used_regs[FIXED_SCRATCH] = 1; \
} \
if (! TARGET_ALTIVEC) \
{ \
for (i = FIRST_ALTIVEC_REGNO; i <= LAST_ALTIVEC_REGNO; ++i) \
fixed_regs[i] = call_used_regs[i] = call_really_used_regs[i] = 1; \
call_really_used_regs[VRSAVE_REGNO] = 1; \
} \
if (TARGET_ALTIVEC_ABI) \
for (i = FIRST_ALTIVEC_REGNO; i < FIRST_ALTIVEC_REGNO + 20; ++i) \
call_used_regs[i] = call_really_used_regs[i] = 1; \
}
#define CONDITIONAL_REGISTER_USAGE rs6000_conditional_register_usage ()
/* Specify the registers used for certain standard purposes.
The values of these macros are register numbers. */