aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeffrey A Law <law@cygnus.com>2001-09-06 16:48:48 +0000
committerJeff Law <law@gcc.gnu.org>2001-09-06 10:48:48 -0600
commit1aae372ea5a890452d51da3e0d798e8d97f92638 (patch)
tree6e79bd04e722e4cfd11cde76207d760d72c13d78
parent5234e23b11138cf83cc55185c79b5fe2918e1066 (diff)
downloadgcc-1aae372ea5a890452d51da3e0d798e8d97f92638.zip
gcc-1aae372ea5a890452d51da3e0d798e8d97f92638.tar.gz
gcc-1aae372ea5a890452d51da3e0d798e8d97f92638.tar.bz2
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
-rw-r--r--gcc/ChangeLog14
-rw-r--r--gcc/config/h8300/h8300-protos.h3
-rw-r--r--gcc/config/h8300/h8300.c22
-rw-r--r--gcc/config/h8300/h8300.h37
4 files changed, 64 insertions, 12 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 85512bf..b5bb57a 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,17 @@
+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>
Remove TYPE_NONCOPIED_PARTS.
diff --git a/gcc/config/h8300/h8300-protos.h b/gcc/config/h8300/h8300-protos.h
index 36997e1..00623d9 100644
--- a/gcc/config/h8300/h8300-protos.h
+++ b/gcc/config/h8300/h8300-protos.h
@@ -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 bit_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 */
#ifdef TREE_CODE
diff --git a/gcc/config/h8300/h8300.c b/gcc/config/h8300/h8300.c
index 618da6d..7ad2489 100644
--- a/gcc/config/h8300/h8300.c
+++ b/gcc/config/h8300/h8300.c
@@ -1516,6 +1516,8 @@ initial_offset (from, to)
if (from == ARG_POINTER_REGNUM && to == FRAME_POINTER_REGNUM)
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
{
int regno;
@@ -1536,6 +1538,26 @@ initial_offset (from, to)
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. */
void
diff --git a/gcc/config/h8300/h8300.h b/gcc/config/h8300/h8300.h
index 6ec826e..b14469f 100644
--- a/gcc/config/h8300/h8300.h
+++ b/gcc/config/h8300/h8300.h
@@ -270,13 +270,13 @@ extern int target_flags;
eliminated during reloading in favor of either the stack or frame
pointer. */
-#define FIRST_PSEUDO_REGISTER 10
+#define FIRST_PSEUDO_REGISTER 11
/* 1 for registers that have pervasive standard uses
and are not available for the register allocator. */
#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.
These must include the FIXED_REGISTERS and also any
@@ -289,10 +289,10 @@ extern int target_flags;
H8 destroys r0,r1,r2,r3. */
#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 \
- { 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 \
{ \
@@ -359,6 +359,16 @@ extern int target_flags;
/* Register in which static-chain is passed to a function. */
#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
machine description. Also define ranges of constants.
@@ -397,9 +407,9 @@ enum reg_class {
#define REG_CLASS_CONTENTS \
{ {0}, /* No regs */ \
- {0x2ff}, /* GENERAL_REGS */ \
+ {0x6ff}, /* GENERAL_REGS */ \
{0x100}, /* MAC_REGS */ \
- {0x3ff}, /* ALL_REGS */ \
+ {0x7ff}, /* ALL_REGS */ \
}
/* The same information, inverted:
@@ -555,21 +565,24 @@ enum reg_class {
pointer register. Secondly, the argument pointer register can always be
eliminated; it is replaced with either the stack or frame pointer. */
-#define ELIMINABLE_REGS \
-{{ ARG_POINTER_REGNUM, STACK_POINTER_REGNUM}, \
- { ARG_POINTER_REGNUM, FRAME_POINTER_REGNUM}, \
+#define ELIMINABLE_REGS \
+{{ ARG_POINTER_REGNUM, STACK_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}}
/* Given FROM and TO register numbers, say whether this elimination is allowed.
Frame pointer elimination is automatically handled.
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. */
#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 \
: 1)
@@ -1176,7 +1189,7 @@ readonly_data () \
This sequence is indexed by compiler's hard-register-number (see above). */
#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 \
{ {"er0", 0}, {"er1", 1}, {"er2", 2}, {"er3", 3}, {"er4", 4}, \