diff options
author | Richard Sandiford <rsandifo@nildram.co.uk> | 2007-10-19 08:41:44 +0000 |
---|---|---|
committer | Richard Sandiford <rsandifo@gcc.gnu.org> | 2007-10-19 08:41:44 +0000 |
commit | 6a68a25874dca20011eaa9c6c0a67d5d026a68e2 (patch) | |
tree | b48c319648b2875542800c0480a83a1b2b927e70 | |
parent | 5b372d333746bac155f9ed14d57e2cbb93508078 (diff) | |
download | gcc-6a68a25874dca20011eaa9c6c0a67d5d026a68e2.zip gcc-6a68a25874dca20011eaa9c6c0a67d5d026a68e2.tar.gz gcc-6a68a25874dca20011eaa9c6c0a67d5d026a68e2.tar.bz2 |
mips.c (build_mips16_function_stub): Load the target address into $1 before transfering the arguments.
gcc/
* config/mips/mips.c (build_mips16_function_stub): Load the
target address into $1 before transfering the arguments.
Don't use ".set noreorder".
(build_mips16_call_stub): Likewise.
From-SVN: r129476
-rw-r--r-- | gcc/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/config/mips/mips.c | 47 |
2 files changed, 23 insertions, 31 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index de27aee..e0f6a4e 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,12 @@ 2007-10-19 Richard Sandiford <rsandifo@nildram.co.uk> + * config/mips/mips.c (build_mips16_function_stub): Load the + target address into $1 before transfering the arguments. + Don't use ".set noreorder". + (build_mips16_call_stub): Likewise. + +2007-10-19 Richard Sandiford <rsandifo@nildram.co.uk> + * config/mips/mips.c (mips_output_32bit_xfer): New function. (mips_output_64bit_xfer): Likewise. (mips16_fp_args): Rename to... diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c index 21abe73..4ee701c 100644 --- a/gcc/config/mips/mips.c +++ b/gcc/config/mips/mips.c @@ -5200,26 +5200,18 @@ build_mips16_function_stub (void) assemble_name (asm_out_file, stubname); fputs (":\n", asm_out_file); - /* We don't want the assembler to insert any nops here. */ - fprintf (asm_out_file, "\t.set\tnoreorder\n"); - - mips_output_args_xfer (current_function_args_info.fp_code, 'f'); - + /* Load the address of the MIPS16 function into $at. Do this first so + that targets with coprocessor interlocks can use an MFC1 to fill the + delay slot. */ fprintf (asm_out_file, "\t.set\tnoat\n"); fprintf (asm_out_file, "\tla\t%s,", reg_names[GP_REG_FIRST + 1]); assemble_name (asm_out_file, fnname); fprintf (asm_out_file, "\n"); - fprintf (asm_out_file, "\tjr\t%s\n", reg_names[GP_REG_FIRST + 1]); - fprintf (asm_out_file, "\t.set\tat\n"); - /* Unfortunately, we can't fill the jump delay slot. We can't fill - with one of the mfc1 instructions, because the result is not - available for one instruction, so if the very first instruction - in the function refers to the register, it will see the wrong - value. */ - fprintf (asm_out_file, "\tnop\n"); + mips_output_args_xfer (current_function_args_info.fp_code, 'f'); - fprintf (asm_out_file, "\t.set\treorder\n"); + fprintf (asm_out_file, "\tjr\t%s\n", reg_names[GP_REG_FIRST + 1]); + fprintf (asm_out_file, "\t.set\tat\n"); if (!FUNCTION_NAME_ALREADY_DECLARED) { @@ -5418,32 +5410,29 @@ build_mips16_call_stub (rtx retval, rtx fn, rtx arg_size, int fp_code) do it, since we can't generate 32-bit code during a 16-bit compilation. */ - /* We don't want the assembler to insert any nops here. */ - fprintf (asm_out_file, "\t.set\tnoreorder\n"); - - mips_output_args_xfer (fp_code, 't'); - if (! fpret) { + /* Load the address of the MIPS16 function into $at. Do this + first so that targets with coprocessor interlocks can use + an MFC1 to fill the delay slot. */ fprintf (asm_out_file, "\t.set\tnoat\n"); fprintf (asm_out_file, "\tla\t%s,%s\n", reg_names[GP_REG_FIRST + 1], fnname); + } + + mips_output_args_xfer (fp_code, 't'); + + if (! fpret) + { + /* Jump to the previously-loaded address. */ fprintf (asm_out_file, "\tjr\t%s\n", reg_names[GP_REG_FIRST + 1]); fprintf (asm_out_file, "\t.set\tat\n"); - /* Unfortunately, we can't fill the jump delay slot. We - can't fill with one of the mtc1 instructions, because the - result is not available for one instruction, so if the - very first instruction in the function refers to the - register, it will see the wrong value. */ - fprintf (asm_out_file, "\tnop\n"); } else { fprintf (asm_out_file, "\tmove\t%s,%s\n", reg_names[GP_REG_FIRST + 18], reg_names[GP_REG_FIRST + 31]); fprintf (asm_out_file, "\tjal\t%s\n", fnname); - /* As above, we can't fill the delay slot. */ - fprintf (asm_out_file, "\tnop\n"); switch (GET_MODE (retval)) { case SCmode: @@ -5480,12 +5469,8 @@ build_mips16_call_stub (rtx retval, rtx fn, rtx arg_size, int fp_code) gcc_unreachable (); } fprintf (asm_out_file, "\tj\t%s\n", reg_names[GP_REG_FIRST + 18]); - /* As above, we can't fill the delay slot. */ - fprintf (asm_out_file, "\tnop\n"); } - fprintf (asm_out_file, "\t.set\treorder\n"); - #ifdef ASM_DECLARE_FUNCTION_SIZE ASM_DECLARE_FUNCTION_SIZE (asm_out_file, stubname, stubdecl); #endif |