Commit 860c4900 by Bernardo Innocenti Committed by Bernardo Innocenti

coff.h (REGISTER_NAMES): Add fake register `argptr'

	* config/m68k/coff.h (REGISTER_NAMES): Add fake register `argptr'
	* config/m68k/hp320.h (REGISTER_NAMES): Likewise.
	* config/m68k/linux.h (REGISTER_NAMES): Likewise.
	* config/m68k/m68kelf.h (REGISTER_NAMES): Likewise.
	* gcc/config/m68k/sgs.h (REGISTER_NAMES): Likewise.
	* config/m68k/m68k-protos.h (m68k_initial_elimination_offset): Add prototype.
	* config/m68k/m68k.c (m68k_frame): New struct, simular to ix86 back-end.
	(m68k_compute_frame_layout): New function.
	(m68k_initial_elimination_offset): New function.
	(m68k_output_function_prologue): ColdFire-specific movem handling.
	(m68k_output_function_epilogue): Likewise.
	* config/m68k/m68k.h (FIRST_PSEOUDO_REGISTER): Make room for argptr reg.
	(ARG_POINTER_REGNUM): Add new definition.
	(INITIAL_FRAME_POINTER_OFFSET): Remove macro.
	(ELIMINABLE_REGS): Define new macro, like in ix86 back-end.
	(CAN_ELIMINATE): Likewise.
	(INITIAL_ELIMINATION_OFFSET): Likewise.

Co-Authored-By: Peter Barada <peter@baradas.org>

From-SVN: r71231
parent ed311a33
2003-09-08 Bernardo Innocenti <bernie@develer.com> 2003-09-08 Bernardo Innocenti <bernie@develer.com>
Peter Barada <peter@baradas.org>
* config/m68k/coff.h (REGISTER_NAMES): Add fake register `argptr'
* config/m68k/hp320.h (REGISTER_NAMES): Likewise.
* config/m68k/linux.h (REGISTER_NAMES): Likewise.
* config/m68k/m68kelf.h (REGISTER_NAMES): Likewise.
* gcc/config/m68k/sgs.h (REGISTER_NAMES): Likewise.
* config/m68k/m68k-protos.h (m68k_initial_elimination_offset): Add prototype.
* config/m68k/m68k.c (m68k_frame): New struct, simular to ix86 back-end.
(m68k_compute_frame_layout): New function.
(m68k_initial_elimination_offset): New function.
(m68k_output_function_prologue): ColdFire-specific movem handling.
(m68k_output_function_epilogue): Likewise.
* config/m68k/m68k.h (FIRST_PSEOUDO_REGISTER): Make room for argptr reg.
(ARG_POINTER_REGNUM): Add new definition.
(INITIAL_FRAME_POINTER_OFFSET): Remove macro.
(ELIMINABLE_REGS): Define new macro, like in ix86 back-end.
(CAN_ELIMINATE): Likewise.
(INITIAL_ELIMINATION_OFFSET): Likewise.
2003-09-08 Bernardo Innocenti <bernie@develer.com>
* config/m68k/m68k.c (m68k_output_function_prologue): Simplify * config/m68k/m68k.c (m68k_output_function_prologue): Simplify
by removing redundant variable cfa_store_offset. by removing redundant variable cfa_store_offset.
......
...@@ -74,7 +74,7 @@ Boston, MA 02111-1307, USA. */ ...@@ -74,7 +74,7 @@ Boston, MA 02111-1307, USA. */
#define REGISTER_NAMES \ #define REGISTER_NAMES \
{"%d0", "%d1", "%d2", "%d3", "%d4", "%d5", "%d6", "%d7", \ {"%d0", "%d1", "%d2", "%d3", "%d4", "%d5", "%d6", "%d7", \
"%a0", "%a1", "%a2", "%a3", "%a4", "%a5", "%a6", "%sp", \ "%a0", "%a1", "%a2", "%a3", "%a4", "%a5", "%a6", "%sp", \
"%fp0", "%fp1", "%fp2", "%fp3", "%fp4", "%fp5", "%fp6", "%fp7" } "%fp0", "%fp1", "%fp2", "%fp3", "%fp4", "%fp5", "%fp6", "%fp7", "argptr" }
#define TARGET_ASM_FILE_START_FILE_DIRECTIVE true #define TARGET_ASM_FILE_START_FILE_DIRECTIVE true
......
...@@ -158,7 +158,7 @@ Boston, MA 02111-1307, USA. */ ...@@ -158,7 +158,7 @@ Boston, MA 02111-1307, USA. */
#define REGISTER_NAMES \ #define REGISTER_NAMES \
{"%d0", "%d1", "%d2", "%d3", "%d4", "%d5", "%d6", "%d7", \ {"%d0", "%d1", "%d2", "%d3", "%d4", "%d5", "%d6", "%d7", \
"%a0", "%a1", "%a2", "%a3", "%a4", "%a5", "%fp", "%sp", \ "%a0", "%a1", "%a2", "%a3", "%a4", "%a5", "%fp", "%sp", \
"%fp0", "%fp1", "%fp2", "%fp3", "%fp4", "%fp5", "%fp6", "%fp7"} "%fp0", "%fp1", "%fp2", "%fp3", "%fp4", "%fp5", "%fp6", "%fp7", "argptr"}
#define IMMEDIATE_PREFIX "&" #define IMMEDIATE_PREFIX "&"
#define REGISTER_PREFIX "%" #define REGISTER_PREFIX "%"
......
...@@ -68,7 +68,7 @@ Boston, MA 02111-1307, USA. */ ...@@ -68,7 +68,7 @@ Boston, MA 02111-1307, USA. */
#define REGISTER_NAMES \ #define REGISTER_NAMES \
{"%d0", "%d1", "%d2", "%d3", "%d4", "%d5", "%d6", "%d7", \ {"%d0", "%d1", "%d2", "%d3", "%d4", "%d5", "%d6", "%d7", \
"%a0", "%a1", "%a2", "%a3", "%a4", "%a5", "%a6", "%sp", \ "%a0", "%a1", "%a2", "%a3", "%a4", "%a5", "%a6", "%sp", \
"%fp0", "%fp1", "%fp2", "%fp3", "%fp4", "%fp5", "%fp6", "%fp7" } "%fp0", "%fp1", "%fp2", "%fp3", "%fp4", "%fp5", "%fp6", "%fp7", "argptr" }
#undef SIZE_TYPE #undef SIZE_TYPE
#define SIZE_TYPE "unsigned int" #define SIZE_TYPE "unsigned int"
......
...@@ -21,6 +21,7 @@ Boston, MA 02111-1307, USA. */ ...@@ -21,6 +21,7 @@ Boston, MA 02111-1307, USA. */
/* Define functions defined in aux-output.c and used in templates. */ /* Define functions defined in aux-output.c and used in templates. */
#ifdef RTX_CODE #ifdef RTX_CODE
extern HOST_WIDE_INT m68k_initial_elimination_offset (int from, int to);
extern const char *output_move_const_into_data_reg (rtx *); extern const char *output_move_const_into_data_reg (rtx *);
extern const char *output_move_simode_const (rtx *); extern const char *output_move_simode_const (rtx *);
extern const char *output_move_simode (rtx *); extern const char *output_move_simode (rtx *);
......
...@@ -386,7 +386,7 @@ extern int target_flags; ...@@ -386,7 +386,7 @@ extern int target_flags;
For the 68000, we give the data registers numbers 0-7, For the 68000, we give the data registers numbers 0-7,
the address registers numbers 010-017, the address registers numbers 010-017,
and the 68881 floating point registers numbers 020-027. */ and the 68881 floating point registers numbers 020-027. */
#define FIRST_PSEUDO_REGISTER 24 #define FIRST_PSEUDO_REGISTER 25
/* This defines the register which is used to hold the offset table for PIC. */ /* This defines the register which is used to hold the offset table for PIC. */
#define PIC_OFFSET_TABLE_REGNUM (flag_pic ? 13 : INVALID_REGNUM) #define PIC_OFFSET_TABLE_REGNUM (flag_pic ? 13 : INVALID_REGNUM)
...@@ -493,8 +493,11 @@ extern int target_flags; ...@@ -493,8 +493,11 @@ extern int target_flags;
This is computed in `reload', in reload1.c. */ This is computed in `reload', in reload1.c. */
#define FRAME_POINTER_REQUIRED 0 #define FRAME_POINTER_REQUIRED 0
/* Base register for access to arguments of the function. */ /* Base register for access to arguments of the function.
#define ARG_POINTER_REGNUM 14 * This isn't a hardware register. It will be eliminated to the
* stack pointer or frame pointer.
*/
#define ARG_POINTER_REGNUM 24
/* Register in which static-chain is passed to a function. */ /* Register in which static-chain is passed to a function. */
#define STATIC_CHAIN_REGNUM 8 #define STATIC_CHAIN_REGNUM 8
...@@ -879,32 +882,6 @@ enum reg_class { ...@@ -879,32 +882,6 @@ enum reg_class {
You should override this if you define FUNCTION_EXTRA_EPILOGUE. */ You should override this if you define FUNCTION_EXTRA_EPILOGUE. */
#define USE_RETURN_INSN use_return_insn () #define USE_RETURN_INSN use_return_insn ()
/* Store in the variable DEPTH the initial difference between the
frame pointer reg contents and the stack pointer reg contents,
as of the start of the function body. This depends on the layout
of the fixed parts of the stack frame and on how registers are saved.
On the 68k, if we have a frame, we must add one word to its length
to allow for the place that a6 is stored when we do have a frame pointer.
Otherwise, we would need to compute the offset from the frame pointer
of a local variable as a function of frame_pointer_needed, which
is hard. */
#define INITIAL_FRAME_POINTER_OFFSET(DEPTH) \
{ int regno; \
int offset = -4; \
for (regno = 16; regno < FIRST_PSEUDO_REGISTER; regno++) \
if (regs_ever_live[regno] && ! call_used_regs[regno]) \
offset += 12; \
for (regno = 0; regno < 16; regno++) \
if (regs_ever_live[regno] && ! call_used_regs[regno]) \
offset += 4; \
if (flag_pic && current_function_uses_pic_offset_table) \
offset += 4; \
(DEPTH) = (offset + ((get_frame_size () + 3) & -4) \
+ (get_frame_size () == 0 ? 0 : 4)); \
}
/* Output assembler code for a block containing the constant parts /* Output assembler code for a block containing the constant parts
of a trampoline, leaving space for the variable parts. */ of a trampoline, leaving space for the variable parts. */
...@@ -982,6 +959,38 @@ __transfer_from_trampoline () \ ...@@ -982,6 +959,38 @@ __transfer_from_trampoline () \
asm ("rts":); \ asm ("rts":); \
} }
/* Definitions for register eliminations.
This is an array of structures. Each structure initializes one pair
of eliminable registers. The "from" register number is given first,
followed by "to". Eliminations of the same "from" register are listed
in order of preference.
There are two registers that can always be eliminated on the m68k.
The frame pointer and the arg pointer can be replaced by either the
hard frame pointer or to the stack pointer, depending upon the
circumstances. The hard frame pointer is not used before reload and
so it is not eligible for elimination. */
#define ELIMINABLE_REGS \
{{ ARG_POINTER_REGNUM, STACK_POINTER_REGNUM }, \
{ ARG_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.
All other eliminations are valid. */
#define CAN_ELIMINATE(FROM, TO) \
((TO) == STACK_POINTER_REGNUM ? ! frame_pointer_needed : 1)
/* Define the offset between two registers, one to be eliminated, and the other
its replacement, at the start of a routine. */
#define INITIAL_ELIMINATION_OFFSET(FROM, TO, OFFSET) \
(OFFSET) = m68k_initial_elimination_offset(FROM, TO)
/* Addressing modes, and classification of registers for them. */ /* Addressing modes, and classification of registers for them. */
#define HAVE_POST_INCREMENT 1 #define HAVE_POST_INCREMENT 1
...@@ -1381,7 +1390,7 @@ __transfer_from_trampoline () \ ...@@ -1381,7 +1390,7 @@ __transfer_from_trampoline () \
#define REGISTER_NAMES \ #define REGISTER_NAMES \
{"d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", \ {"d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", \
"a0", "a1", "a2", "a3", "a4", "a5", "a6", "sp", \ "a0", "a1", "a2", "a3", "a4", "a5", "a6", "sp", \
"fp0", "fp1", "fp2", "fp3", "fp4", "fp5", "fp6", "fp7" } "fp0", "fp1", "fp2", "fp3", "fp4", "fp5", "fp6", "fp7", "argptr" }
/* How to renumber registers for dbx and gdb. /* How to renumber registers for dbx and gdb.
On the Sun-3, the floating point registers have numbers On the Sun-3, the floating point registers have numbers
......
...@@ -94,7 +94,7 @@ Boston, MA 02111-1307, USA. */ ...@@ -94,7 +94,7 @@ Boston, MA 02111-1307, USA. */
#define REGISTER_NAMES \ #define REGISTER_NAMES \
{"%d0", "%d1", "%d2", "%d3", "%d4", "%d5", "%d6", "%d7", \ {"%d0", "%d1", "%d2", "%d3", "%d4", "%d5", "%d6", "%d7", \
"%a0", "%a1", "%a2", "%a3", "%a4", "%a5", "%a6", "%sp", \ "%a0", "%a1", "%a2", "%a3", "%a4", "%a5", "%a6", "%sp", \
"%fp0", "%fp1", "%fp2", "%fp3", "%fp4", "%fp5", "%fp6", "%fp7" } "%fp0", "%fp1", "%fp2", "%fp3", "%fp4", "%fp5", "%fp6", "%fp7", "argptr" }
/* This is how to output an assembler line that says to advance the /* This is how to output an assembler line that says to advance the
location counter to a multiple of 2**LOG bytes. */ location counter to a multiple of 2**LOG bytes. */
......
...@@ -72,7 +72,7 @@ Boston, MA 02111-1307, USA. */ ...@@ -72,7 +72,7 @@ Boston, MA 02111-1307, USA. */
#define REGISTER_NAMES \ #define REGISTER_NAMES \
{"%d0", "%d1", "%d2", "%d3", "%d4", "%d5", "%d6", "%d7", \ {"%d0", "%d1", "%d2", "%d3", "%d4", "%d5", "%d6", "%d7", \
"%a0", "%a1", "%a2", "%a3", "%a4", "%a5", "%fp", "%sp", \ "%a0", "%a1", "%a2", "%a3", "%a4", "%a5", "%fp", "%sp", \
"%fp0", "%fp1", "%fp2", "%fp3", "%fp4", "%fp5", "%fp6", "%fp7" } "%fp0", "%fp1", "%fp2", "%fp3", "%fp4", "%fp5", "%fp6", "%fp7", "argptr" }
/* This is how to output an assembler line that says to advance the /* This is how to output an assembler line that says to advance the
location counter to a multiple of 2**LOG bytes. */ location counter to a multiple of 2**LOG bytes. */
......
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