This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] New MIPS interrupt handler patch


Ian Lance Taylor <iant@google.com> writes:
> "Fu, Chao-Ying" <fu@mips.com> writes:
>
>> gcc/ChangeLog
>> 2009-04-09  Chao-ying Fu  <fu@mips.com>
>>
>> 	* doc/tm.texi (Instruction Output): Document
>> 	TARGET_ASM_FINAL_POSTSCAN_INSN.
>> 	* target.h (final_postscan_insn): New field in asm_out.
>> 	* target-def.h (TARGET_ASM_FINAL_POSTSCAN_INSN): New define.
>> 	(TARGET_ASM_OUT): Add TARGET_ASM_FINAL_POSTSCAN_INSN.
>> 	* final.c (final_scan_insn): Call
>> 	targetm.asm_out.final_postscan_insn after outputting
>> 	an asm macro and a normal instruction.
>>
>> 	* config/mips/mips.h (FINAL_PRESCAN_INSN): New define.
>> 	* config/mips/mips-protos.h (mips_final_prescan_insn):
>> 	Declare.
>> 	* config/mips/mips.c (mips_at_reg_p): New for_each_rtx callback.
>> 	(mips_final_prescan_insn, mips_final_postscan_insn): New
>> 	functions.
>> 	(TARGET_ASM_FINAL_POSTSCAN_INSN): New define.
>>
>> gcc/testsuite/ChangeLog
>> 2009-04-09  Chao-ying Fu  <fu@mips.com>
>>
>> 	* gcc.target/mips/interrupt_handler.c: Change from compile to
>> 	assemble.
>
> The changes to the middle-end and the documentation are OK.
>
> I did not look at the changes to the MIPS backend or at the test case; I
> will leave those to the MIPS backend maintainers.

The MIPS parts are OK too, except:

> /* Implement FINAL_POSTSCAN_INSN.  */

should now be:

  /* Implement TARGET_ASM_FINAL_POSTSCAN_INSN.  */

> /* For an instruction that accesses $1 (AT), we need to output ".set noat"
>    before the instruction, and output ".set at" after the instruction.  */
> #define FINAL_PRESCAN_INSN(INSN, OPVEC, NOPERANDS)	\
>   mips_final_prescan_insn (INSN, OPVEC, NOPERANDS);

No ";".  I don't think the comment belongs here; it should go in the
code instead.  How about:

void
mips_final_prescan_insn (rtx insn, rtx *opvec, int noperands)
{
  int i;

  /* We need to emit ".set noat" before an instruction that accesses
     $1 (AT).  */
  if (recog_memoized (insn) >= 0)
    for (i = 0; i < noperands; i++)
      if (for_each_rtx (&opvec[i], mips_at_reg_p, NULL))
	if (set_noat++ == 0)
	  fprintf (asm_out_file, "\t.set\tnoat\n");
}

and:

void
mips_final_postscan_insn (FILE *file, rtx insn, rtx *opvec, int noperands)
{
  int i;

  /* Close any ".set noat" block opened by mips_final_prescan_insn.  */
  if (recog_memoized (insn) >= 0)
    for (i = 0; i < noperands; i++)
      if (for_each_rtx (&opvec[i], mips_at_reg_p, NULL))
	if (--set_noat == 0)
	  fprintf (file, "\t.set\tat\n");
}

OK with those changes, thanks.

Richard


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]