summaryrefslogtreecommitdiff
path: root/gcc/config/sh/sh-c.c
diff options
context:
space:
mode:
authoramylaar <amylaar@138bc75d-0d04-0410-961f-82ee72b054a4>2006-01-30 15:07:43 +0000
committeramylaar <amylaar@138bc75d-0d04-0410-961f-82ee72b054a4>2006-01-30 15:07:43 +0000
commit57d5535b031f85ada1a22059d8215cb349aa0e97 (patch)
tree2c0dc139501a3b56003fa7a9d0a9f3e5ae212d8e /gcc/config/sh/sh-c.c
parentcdd306bef327393903d2a2f3fe658feba87606e3 (diff)
downloadgcc-57d5535b031f85ada1a22059d8215cb349aa0e97.tar.gz
PR target/14798:
gcc: * sh.c (pragma_interrupt, trap_exit, sp_switch): Remove variable. (pragma_trap, pragma_nosave_low_regs): Likewise. (current_function_anonymous_args): Likewise. (sh_deferred_function_attributes): New variable. (sh_deferred_function_attributes_tail): Likewise. (print_operand): For '@', look up trap_exit attribute. (calc_live_regs): Look up trapa_handler attribute. For trapa handlers, save/restore fpscr, but don't do any other interrupt-specific saves. Don't save r0..r7 if the nosave_low_regs attribute is in effect. Fix check for partially saved registers to check for SHmedia. (sh_expand_prologue, sh_expand_epilogue): Look up sp_switch attribute. (sh_output_function_epilogue): Don't clear any of the removed variables. (sh_insert_attributes): Don't check pragma_interrupt. Insert deferred attributes. Check that interrupt attribute is present for other attributes that require its presence. (sh_attribute_table): Add new attributes trapa_handler and nosave_low_regs. (sh_handle_sp_switch_attribute, sh_handle_trap_exit_attribute): Don't check for pragma_interrupt. Don't store argument. * sh.h (pragma_interrupt, sp_switch): Don't declare. (sh_deferred_function_attributes): Declare. (sh_deferred_function_attributes_tail): Likewise. * sh.md (sp_switch_1): Add operand. Change generator caller. (sh_pr_interrupt, sh_pr_trapa, sh_pr_nosave_low_regs): Remove. (*return_i): Don't use when trap_exit attribute is in effect. (*return_trapa): New insn pattern. * sh-c.c: New file. * config.gcc (sh[123456ble]*-* | sh-*-*): New trailer stanza, setting c_target_objs and cxx_target_objs. * t-sh: Add rule for sh-c.o. gcc/testsuite: * gcc.dg/pragma-isr.c: Added target sh[1234ble]*-*-*. * gcc.dg/pragma-isr2.c, gcc.dg/pragma-isr-trapa.c: New tests. * gcc.dg/pragma-isr-trapa2.c: Likewise. * gcc.dg/pragma-isr-nosave_low_regs.c: Likewise. * gcc.dg/pragma-isr-trap_exit.c: Likewise. * gcc.dg/attr-isr.c, gcc.dg/attr-isr-trapa.c: Likewise. * gcc.dg/attr-isr-trap_exit.c: Likewise. * gcc.dg/attr-isr-nosave_low_regs.c: Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@110398 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/config/sh/sh-c.c')
-rw-r--r--gcc/config/sh/sh-c.c69
1 files changed, 69 insertions, 0 deletions
diff --git a/gcc/config/sh/sh-c.c b/gcc/config/sh/sh-c.c
new file mode 100644
index 00000000000..7b9ec1c1e4d
--- /dev/null
+++ b/gcc/config/sh/sh-c.c
@@ -0,0 +1,69 @@
+/* Pragma handling for GCC for Renesas / SuperH SH.
+ Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+ 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+ Contributed by Joern Rennecke <joern.rennecke@st.com>.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GCC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GCC; see the file COPYING. If not, write to
+the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA. */
+
+#include "config.h"
+#include "system.h"
+#include "coretypes.h"
+#include "tm.h"
+#include "tree.h"
+#include "tm_p.h"
+
+/* Handle machine specific pragmas to be semi-compatible with Renesas
+ compiler. */
+
+/* Add ATTR to the attributes of the current function. If there is no
+ such function, save it to be added to the attributes of the next
+ function. */
+static void
+sh_add_function_attribute (const char *attr)
+{
+ tree id = get_identifier (attr);
+
+ if (current_function_decl)
+ decl_attributes (&current_function_decl,
+ tree_cons (id, NULL_TREE, NULL_TREE), 0);
+ else
+ {
+ *sh_deferred_function_attributes_tail
+ = tree_cons (id, NULL_TREE, *sh_deferred_function_attributes_tail);
+ sh_deferred_function_attributes_tail
+ = &TREE_CHAIN (*sh_deferred_function_attributes_tail);
+ }
+}
+
+void
+sh_pr_interrupt (struct cpp_reader *pfile ATTRIBUTE_UNUSED)
+{
+ sh_add_function_attribute ("interrupt_handler");
+}
+
+void
+sh_pr_trapa (struct cpp_reader *pfile ATTRIBUTE_UNUSED)
+{
+ sh_add_function_attribute ("trapa_handler");
+}
+
+void
+sh_pr_nosave_low_regs (struct cpp_reader *pfile ATTRIBUTE_UNUSED)
+{
+ sh_add_function_attribute ("nosave_low_regs");
+}