Commit 1aae372e by Jeffrey A Law Committed by Jeff Law

Joern Rennecke (amylaar@cygnus.com)

Thu Sep  6 11:16:35 2001  Jeffrey A Law  (law@cygnus.com)
			  Joern Rennecke (amylaar@cygnus.com)

	* h8300-protos.h (h8300_return_addr_rtx): New prototype.
	* h8300.c (initial_offset): Handle offset between RP and FP.
	(h8300_return_addr_rtx): New function.
	* h8300.h (FIRST_PSEUDO_REGISTER): Bump now that we have a
	return register.
	(FIXED_REGISTERS, CALL_USED_REGISTERS): Corresponding changes.
	(REG_ALLOC_ORDER, RETURN_ADDRESS_POINTER_REGNUM): Likewise.
	(REG_CLASS_CONTENTS, ELIMINABLE_REGS): Likewise.
	(CAN_ELIMINATE, REGISTER_NAMES):
	(RETURN_ADDR_RTX): Call h8300_return_addr_rtx.

Co-Authored-By: Joern Rennecke <amylaar@cygnus.com>

From-SVN: r45441
parent 5234e23b
Thu Sep 6 11:16:35 2001 Jeffrey A Law (law@cygnus.com)
Joern Rennecke (amylaar@cygnus.com)
* h8300-protos.h (h8300_return_addr_rtx): New prototype.
* h8300.c (initial_offset): Handle offset between RP and FP.
(h8300_return_addr_rtx): New function.
* h8300.h (FIRST_PSEUDO_REGISTER): Bump now that we have a
return register.
(FIXED_REGISTERS, CALL_USED_REGISTERS): Corresponding changes.
(REG_ALLOC_ORDER, RETURN_ADDRESS_POINTER_REGNUM): Likewise.
(REG_CLASS_CONTENTS, ELIMINABLE_REGS): Likewise.
(CAN_ELIMINATE, REGISTER_NAMES):
(RETURN_ADDR_RTX): Call h8300_return_addr_rtx.
2001-09-06 Nathan Sidwell <nathan@codesourcery.com> 2001-09-06 Nathan Sidwell <nathan@codesourcery.com>
Remove TYPE_NONCOPIED_PARTS. Remove TYPE_NONCOPIED_PARTS.
......
...@@ -58,6 +58,9 @@ extern int bit_memory_operand PARAMS ((rtx, enum machine_mode)); ...@@ -58,6 +58,9 @@ extern int bit_memory_operand PARAMS ((rtx, enum machine_mode));
extern int eq_operator PARAMS ((rtx, enum machine_mode)); extern int eq_operator PARAMS ((rtx, enum machine_mode));
extern int bit_operator PARAMS ((rtx, enum machine_mode)); extern int bit_operator PARAMS ((rtx, enum machine_mode));
extern int nshift_operator PARAMS ((rtx, enum machine_mode)); extern int nshift_operator PARAMS ((rtx, enum machine_mode));
/* Used in builtins.c */
extern rtx h8300_return_addr_rtx PARAMS ((int, rtx));
#endif /* RTX_CODE */ #endif /* RTX_CODE */
#ifdef TREE_CODE #ifdef TREE_CODE
......
...@@ -1516,6 +1516,8 @@ initial_offset (from, to) ...@@ -1516,6 +1516,8 @@ initial_offset (from, to)
if (from == ARG_POINTER_REGNUM && to == FRAME_POINTER_REGNUM) if (from == ARG_POINTER_REGNUM && to == FRAME_POINTER_REGNUM)
offset = UNITS_PER_WORD + frame_pointer_needed * UNITS_PER_WORD; offset = UNITS_PER_WORD + frame_pointer_needed * UNITS_PER_WORD;
else if (from == RETURN_ADDRESS_POINTER_REGNUM && to == FRAME_POINTER_REGNUM)
offset = frame_pointer_needed * UNITS_PER_WORD;
else else
{ {
int regno; int regno;
...@@ -1536,6 +1538,26 @@ initial_offset (from, to) ...@@ -1536,6 +1538,26 @@ initial_offset (from, to)
return offset; return offset;
} }
rtx
h8300_return_addr_rtx (count, frame)
int count;
rtx frame;
{
rtx ret;
if (count == 0)
ret = gen_rtx_MEM (Pmode,
gen_rtx_REG (Pmode, RETURN_ADDRESS_POINTER_REGNUM));
else if (flag_omit_frame_pointer)
return (rtx) 0;
else
ret = gen_rtx_MEM (Pmode,
memory_address (Pmode,
plus_constant (frame, UNITS_PER_WORD)));
set_mem_alias_set (ret, get_frame_alias_set ());
return ret;
}
/* Update the condition code from the insn. */ /* Update the condition code from the insn. */
void void
......
...@@ -270,13 +270,13 @@ extern int target_flags; ...@@ -270,13 +270,13 @@ extern int target_flags;
eliminated during reloading in favor of either the stack or frame eliminated during reloading in favor of either the stack or frame
pointer. */ pointer. */
#define FIRST_PSEUDO_REGISTER 10 #define FIRST_PSEUDO_REGISTER 11
/* 1 for registers that have pervasive standard uses /* 1 for registers that have pervasive standard uses
and are not available for the register allocator. */ and are not available for the register allocator. */
#define FIXED_REGISTERS \ #define FIXED_REGISTERS \
{ 0, 0, 0, 0, 0, 0, 0, 1, 0, 1} { 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1}
/* 1 for registers not available across function calls. /* 1 for registers not available across function calls.
These must include the FIXED_REGISTERS and also any These must include the FIXED_REGISTERS and also any
...@@ -289,10 +289,10 @@ extern int target_flags; ...@@ -289,10 +289,10 @@ extern int target_flags;
H8 destroys r0,r1,r2,r3. */ H8 destroys r0,r1,r2,r3. */
#define CALL_USED_REGISTERS \ #define CALL_USED_REGISTERS \
{ 1, 1, 1, 1, 0, 0, 0, 1, 1, 1 } { 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1 }
#define REG_ALLOC_ORDER \ #define REG_ALLOC_ORDER \
{ 2, 3, 0, 1, 4, 5, 6, 8, 7, 9} { 2, 3, 0, 1, 4, 5, 6, 8, 7, 9, 10}
#define CONDITIONAL_REGISTER_USAGE \ #define CONDITIONAL_REGISTER_USAGE \
{ \ { \
...@@ -359,6 +359,16 @@ extern int target_flags; ...@@ -359,6 +359,16 @@ extern int target_flags;
/* Register in which static-chain is passed to a function. */ /* Register in which static-chain is passed to a function. */
#define STATIC_CHAIN_REGNUM 3 #define STATIC_CHAIN_REGNUM 3
/* Fake register that holds the address on the stack of the
current function's return address. */
#define RETURN_ADDRESS_POINTER_REGNUM 10
/* A C expression whose value is RTL representing the value of the return
address for the frame COUNT steps up from the current frame.
FRAMEADDR is already the frame pointer of the COUNT frame, assuming
a stack layout with the frame pointer as the first saved register. */
#define RETURN_ADDR_RTX(COUNT, FRAME) h8300_return_addr_rtx ((COUNT), (FRAME))
/* Define the classes of registers for register constraints in the /* Define the classes of registers for register constraints in the
machine description. Also define ranges of constants. machine description. Also define ranges of constants.
...@@ -397,9 +407,9 @@ enum reg_class { ...@@ -397,9 +407,9 @@ enum reg_class {
#define REG_CLASS_CONTENTS \ #define REG_CLASS_CONTENTS \
{ {0}, /* No regs */ \ { {0}, /* No regs */ \
{0x2ff}, /* GENERAL_REGS */ \ {0x6ff}, /* GENERAL_REGS */ \
{0x100}, /* MAC_REGS */ \ {0x100}, /* MAC_REGS */ \
{0x3ff}, /* ALL_REGS */ \ {0x7ff}, /* ALL_REGS */ \
} }
/* The same information, inverted: /* The same information, inverted:
...@@ -555,21 +565,24 @@ enum reg_class { ...@@ -555,21 +565,24 @@ enum reg_class {
pointer register. Secondly, the argument pointer register can always be pointer register. Secondly, the argument pointer register can always be
eliminated; it is replaced with either the stack or frame pointer. */ eliminated; it is replaced with either the stack or frame pointer. */
#define ELIMINABLE_REGS \ #define ELIMINABLE_REGS \
{{ ARG_POINTER_REGNUM, STACK_POINTER_REGNUM}, \ {{ ARG_POINTER_REGNUM, STACK_POINTER_REGNUM}, \
{ ARG_POINTER_REGNUM, FRAME_POINTER_REGNUM}, \ { ARG_POINTER_REGNUM, FRAME_POINTER_REGNUM}, \
{ RETURN_ADDRESS_POINTER_REGNUM, STACK_POINTER_REGNUM},\
{ RETURN_ADDRESS_POINTER_REGNUM, FRAME_POINTER_REGNUM},\
{ FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM}} { FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM}}
/* Given FROM and TO register numbers, say whether this elimination is allowed. /* Given FROM and TO register numbers, say whether this elimination is allowed.
Frame pointer elimination is automatically handled. Frame pointer elimination is automatically handled.
For the h8300, if frame pointer elimination is being done, we would like to For the h8300, if frame pointer elimination is being done, we would like to
convert ap into sp, not fp. convert ap and rp into sp, not fp.
All other eliminations are valid. */ All other eliminations are valid. */
#define CAN_ELIMINATE(FROM, TO) \ #define CAN_ELIMINATE(FROM, TO) \
((FROM) == ARG_POINTER_REGNUM && (TO) == STACK_POINTER_REGNUM \ ((((FROM) == ARG_POINTER_REGNUM || (FROM) == RETURN_ADDRESS_POINTER_REGNUM) \
&& (TO) == STACK_POINTER_REGNUM) \
? ! frame_pointer_needed \ ? ! frame_pointer_needed \
: 1) : 1)
...@@ -1176,7 +1189,7 @@ readonly_data () \ ...@@ -1176,7 +1189,7 @@ readonly_data () \
This sequence is indexed by compiler's hard-register-number (see above). */ This sequence is indexed by compiler's hard-register-number (see above). */
#define REGISTER_NAMES \ #define REGISTER_NAMES \
{ "r0", "r1", "r2", "r3", "r4", "r5", "r6", "sp", "mac", "ap" } { "r0", "r1", "r2", "r3", "r4", "r5", "r6", "sp", "mac", "ap", "rap" }
#define ADDITIONAL_REGISTER_NAMES \ #define ADDITIONAL_REGISTER_NAMES \
{ {"er0", 0}, {"er1", 1}, {"er2", 2}, {"er3", 3}, {"er4", 4}, \ { {"er0", 0}, {"er1", 1}, {"er2", 2}, {"er3", 3}, {"er4", 4}, \
......
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