Commit 2aa4498c by Aldy Hernandez Committed by Aldy Hernandez

* 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
parent 8dc2384c
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> 2004-05-08 Roger Sayle <roger@eyesopen.com>
* fold-const.c (fold_div_compare): New function to optimize X/C1 op C2 * fold-const.c (fold_div_compare): New function to optimize X/C1 op C2
......
...@@ -202,6 +202,7 @@ extern bool rs6000_tls_referenced_p (rtx); ...@@ -202,6 +202,7 @@ extern bool rs6000_tls_referenced_p (rtx);
extern int rs6000_tls_symbol_ref (rtx, enum machine_mode); extern int rs6000_tls_symbol_ref (rtx, enum machine_mode);
extern void rs6000_output_dwarf_dtprel (FILE*, int, rtx); extern void rs6000_output_dwarf_dtprel (FILE*, int, rtx);
extern int rs6000_hard_regno_nregs (int, enum machine_mode); extern int rs6000_hard_regno_nregs (int, enum machine_mode);
extern void rs6000_conditional_register_usage (void);
/* Declare functions in rs6000-c.c */ /* Declare functions in rs6000-c.c */
......
...@@ -3431,6 +3431,71 @@ rs6000_hard_regno_nregs (int regno, enum machine_mode mode) ...@@ -3431,6 +3431,71 @@ rs6000_hard_regno_nregs (int regno, enum machine_mode mode)
return (GET_MODE_SIZE (mode) + UNITS_PER_WORD - 1) / UNITS_PER_WORD; 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 /* 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. be done in less than N insns. Do all computations in MODE.
Returns the place where the output has been placed if it can be Returns the place where the output has been placed if it can be
......
...@@ -1097,59 +1097,10 @@ extern const char *rs6000_warn_altivec_long_switch; ...@@ -1097,59 +1097,10 @@ extern const char *rs6000_warn_altivec_long_switch;
#define FIXED_SCRATCH (TARGET_SPE ? 14 : 11) #define FIXED_SCRATCH (TARGET_SPE ? 14 : 11)
/* Define this macro to change register usage conditional on target flags. /* Define this macro to change register usage conditional on target
Set MQ register fixed (already call_used) if not POWER architecture flags. */
(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 CONDITIONAL_REGISTER_USAGE \ #define CONDITIONAL_REGISTER_USAGE rs6000_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; \
}
/* Specify the registers used for certain standard purposes. /* Specify the registers used for certain standard purposes.
The values of these macros are register numbers. */ The values of these macros are register numbers. */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment