OSDN Git Service

2010-04-06 Kai Tietz <kai.tietz@onevision.com>
[pf3gnuchains/gcc-fork.git] / gcc / config / sh / sh-c.c
1 /* Pragma handling for GCC for Renesas / SuperH SH.
2    Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
3    2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
4    Contributed by Joern Rennecke <joern.rennecke@st.com>.
5
6 This file is part of GCC.
7
8 GCC is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 3, or (at your option)
11 any later version.
12
13 GCC is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with GCC; see the file COPYING3.  If not see
20 <http://www.gnu.org/licenses/>.  */
21
22 #include "config.h"
23 #include "system.h"
24 #include "coretypes.h"
25 #include "tm.h"
26 #include "tree.h"
27 #include "tm_p.h"
28
29 /* Handle machine specific pragmas to be semi-compatible with Renesas
30    compiler.  */
31
32 /* Add ATTR to the attributes of the current function.  If there is no
33    such function, save it to be added to the attributes of the next
34    function.  */
35 static void
36 sh_add_function_attribute (const char *attr)
37 {
38   tree id = get_identifier (attr);
39
40   if (current_function_decl)
41     decl_attributes (&current_function_decl,
42                      tree_cons (id, NULL_TREE, NULL_TREE), 0);
43   else
44     {
45       *sh_deferred_function_attributes_tail
46         = tree_cons (id, NULL_TREE, *sh_deferred_function_attributes_tail);
47       sh_deferred_function_attributes_tail
48         = &TREE_CHAIN (*sh_deferred_function_attributes_tail);
49     }
50 }
51
52 void
53 sh_pr_interrupt (struct cpp_reader *pfile ATTRIBUTE_UNUSED)
54 {
55   sh_add_function_attribute ("interrupt_handler");
56 }
57
58 void
59 sh_pr_trapa (struct cpp_reader *pfile ATTRIBUTE_UNUSED)
60 {
61   sh_add_function_attribute ("trapa_handler");
62 }
63
64 void
65 sh_pr_nosave_low_regs (struct cpp_reader *pfile ATTRIBUTE_UNUSED)
66 {
67   sh_add_function_attribute ("nosave_low_regs");
68 }