diff options
author | Chao-ying Fu <fu@mips.com> | 2009-04-10 18:20:22 +0000 |
---|---|---|
committer | Chao-ying Fu <chaoyingfu@gcc.gnu.org> | 2009-04-10 18:20:22 +0000 |
commit | 1afc5373043f7cc388ceed855be6f7d0f5dc24d1 (patch) | |
tree | 6e37fe7e1f86ddb16c584d6ceb5493f7b05e1620 /gcc/config/mips | |
parent | aa070a60c3bdc70201b0fdc44da357cab854a50f (diff) | |
download | gcc-1afc5373043f7cc388ceed855be6f7d0f5dc24d1.zip gcc-1afc5373043f7cc388ceed855be6f7d0f5dc24d1.tar.gz gcc-1afc5373043f7cc388ceed855be6f7d0f5dc24d1.tar.bz2 |
tm.texi (Instruction Output): Document TARGET_ASM_FINAL_POSTSCAN_INSN.
2009-04-10 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.
From-SVN: r145934
Diffstat (limited to 'gcc/config/mips')
-rw-r--r-- | gcc/config/mips/mips-protos.h | 1 | ||||
-rw-r--r-- | gcc/config/mips/mips.c | 43 | ||||
-rw-r--r-- | gcc/config/mips/mips.h | 3 |
3 files changed, 47 insertions, 0 deletions
diff --git a/gcc/config/mips/mips-protos.h b/gcc/config/mips/mips-protos.h index a704750..1f8054e 100644 --- a/gcc/config/mips/mips-protos.h +++ b/gcc/config/mips/mips-protos.h @@ -333,5 +333,6 @@ extern void mips_expand_atomic_qihi (union mips_gen_fn_ptrs, extern void mips_expand_vector_init (rtx, rtx); extern bool mips_epilogue_uses (unsigned int); +extern void mips_final_prescan_insn (rtx, rtx *, int); #endif /* ! GCC_MIPS_PROTOS_H */ diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c index 9912105..0b51c78 100644 --- a/gcc/config/mips/mips.c +++ b/gcc/config/mips/mips.c @@ -14697,6 +14697,46 @@ mips_epilogue_uses (unsigned int regno) return false; } + +/* A for_each_rtx callback. Stop the search if *X is an AT register. */ + +static int +mips_at_reg_p (rtx *x, void *data ATTRIBUTE_UNUSED) +{ + return GET_CODE (*x) == REG && REGNO (*x) == AT_REGNUM; +} + + +/* Implement FINAL_PRESCAN_INSN. */ + +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"); +} + +/* Implement TARGET_ASM_FINAL_POSTSCAN_INSN. */ + +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"); +} /* Initialize the GCC target structure. */ #undef TARGET_ASM_ALIGNED_HI_OP @@ -14865,6 +14905,9 @@ mips_epilogue_uses (unsigned int regno) #undef TARGET_IRA_COVER_CLASSES #define TARGET_IRA_COVER_CLASSES mips_ira_cover_classes +#undef TARGET_ASM_FINAL_POSTSCAN_INSN +#define TARGET_ASM_FINAL_POSTSCAN_INSN mips_final_postscan_insn + struct gcc_target targetm = TARGET_INITIALIZER; #include "gt-mips.h" diff --git a/gcc/config/mips/mips.h b/gcc/config/mips/mips.h index fbcfdca..45971ac 100644 --- a/gcc/config/mips/mips.h +++ b/gcc/config/mips/mips.h @@ -3459,3 +3459,6 @@ extern enum mips_code_readable_setting mips_code_readable; /* Enable querying of DFA units. */ #define CPU_UNITS_QUERY 1 + +#define FINAL_PRESCAN_INSN(INSN, OPVEC, NOPERANDS) \ + mips_final_prescan_insn (INSN, OPVEC, NOPERANDS) |