200x-xx-xx Nathan Sidwell <nathan@codesourcery.com>
Richard Sandiford <richard@codesourcery.com>
* config/m68k/m68k.h (M68K_STATIC_CHAIN_REG_NAME): New macro.
(INITIALIZE_TRAMPOLINE): Use STATIC_CHAIN_REGNUM.
(__transfer_from_trampoline): Use M68K_STATIC_CHAIN_REG_NAME.
* config/m68k/m68kelf.h (STATIC_CHAIN_REGNUM): Override.
(M68K_STATIC_CHAIN_REG_NAME): Likewise.
* config/m68k/netbsd-elf.h (M68K_STATIC_CHAIN_REG_NAME): Likewise.
gcc/testsuite/
200x-xx-xx Nathan Sidwell <nathan@codesourcery.com>
* gcc.c-torture/execute/nestfunc-7.c: New.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@120964
138bc75d-0d04-0410-961f-
82ee72b054a4
+2007-01-19 Nathan Sidwell <nathan@codesourcery.com>
+ Richard Sandiford <richard@codesourcery.com>
+
+ * config/m68k/m68k.h (M68K_STATIC_CHAIN_REG_NAME): New macro.
+ (INITIALIZE_TRAMPOLINE): Use STATIC_CHAIN_REGNUM.
+ (__transfer_from_trampoline): Use M68K_STATIC_CHAIN_REG_NAME.
+ * config/m68k/m68kelf.h (STATIC_CHAIN_REGNUM): Override.
+ (M68K_STATIC_CHAIN_REG_NAME): Likewise.
+ * config/m68k/netbsd-elf.h (M68K_STATIC_CHAIN_REG_NAME): Likewise.
+
2007-01-19 Richard Sandiford <richard@codesourcery.com>
* config/m68k/m68k.md (adddi_dilshr32): Rename to...
#define ARG_POINTER_REGNUM 24
#define STATIC_CHAIN_REGNUM 8
+#define M68K_STATIC_CHAIN_REG_NAME REGISTER_PREFIX "a0"
/* Register in which address to store a structure value
is passed to a function. */
jmp FNADDR */
#define INITIALIZE_TRAMPOLINE(TRAMP, FNADDR, CXT) \
{ \
- emit_move_insn (gen_rtx_MEM (HImode, TRAMP), GEN_INT(0x207C)); \
+ emit_move_insn (gen_rtx_MEM (HImode, TRAMP), \
+ GEN_INT(0x207C + ((STATIC_CHAIN_REGNUM-8) << 9))); \
emit_move_insn (gen_rtx_MEM (SImode, plus_constant (TRAMP, 2)), CXT); \
emit_move_insn (gen_rtx_MEM (HImode, plus_constant (TRAMP, 6)), \
GEN_INT(0x4EF9)); \
void \
__transfer_from_trampoline () \
{ \
- register char *a0 asm ("%a0"); \
+ register char *a0 asm (M68K_STATIC_CHAIN_REG_NAME); \
asm (GLOBAL_ASM_OP "___trampoline"); \
asm ("___trampoline:"); \
asm volatile ("move%.l %0,%@" : : "m" (a0[22])); \
#undef M68K_STRUCT_VALUE_REGNUM
#define M68K_STRUCT_VALUE_REGNUM 8
+/* The static chain regnum defaults to a0, but we use that for
+ structure return, so have to use a1 for the static chain. */
+
+#undef STATIC_CHAIN_REGNUM
+#define STATIC_CHAIN_REGNUM 9
+#undef M68K_STATIC_CHAIN_REG_NAME
+#define M68K_STATIC_CHAIN_REG_NAME REGISTER_PREFIX "a1"
+
#define ASM_COMMENT_START "|"
/* Define how the m68k registers should be numbered for Dwarf output.
#undef STATIC_CHAIN_REGNUM
#define STATIC_CHAIN_REGNUM 9
+#undef M68K_STATIC_CHAIN_REG_NAME
+#define M68K_STATIC_CHAIN_REG_NAME REGISTER_PREFIX "a1"
/* Now to renumber registers for dbx and gdb.
+2007-01-19 Nathan Sidwell <nathan@codesourcery.com>
+
+ * gcc.c-torture/execute/nestfunc-7.c: New.
+
2007-01-18 Hui-May Chang <hm.chang@apple.com>
* gcc.c-torture/compile/pr27528.c: Add -fno-pic option.
--- /dev/null
+struct A
+{
+ int one;
+ int two;
+ int three;
+ int four;
+ int five;
+ int six;
+};
+
+static int test (void)
+{
+ int base;
+
+ struct A Foo (void)
+ {
+ struct A a;
+
+ a.one = base + 1;
+ a.two = base + 2;
+ a.three = base + 3;
+ a.four = base + 4;
+ a.five = base + 5;
+ a.six = base + 6;
+
+ return a;
+ }
+
+ base = 10;
+ struct A a = Foo ();
+
+ return (a.one == 11
+ && a.two == 12
+ && a.three == 13
+ && a.four == 14
+ && a.five == 15
+ && a.six == 16);
+}
+
+int main (void)
+{
+ return !test ();
+}
+