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 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 2, 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 COPYING. If not, write to 20 the Free Software Foundation, 51 Franklin Street, Fifth Floor, 21 Boston, MA 02110-1301, USA. */ 22 23 #include "config.h" 24 #include "system.h" 25 #include "coretypes.h" 26 #include "tm.h" 27 #include "tree.h" 28 #include "tm_p.h" 29 30 /* Handle machine specific pragmas to be semi-compatible with Renesas 31 compiler. */ 32 33 /* Add ATTR to the attributes of the current function. If there is no 34 such function, save it to be added to the attributes of the next 35 function. */ 36 static void 37 sh_add_function_attribute (const char *attr) 38 { 39 tree id = get_identifier (attr); 40 41 if (current_function_decl) 42 decl_attributes (¤t_function_decl, 43 tree_cons (id, NULL_TREE, NULL_TREE), 0); 44 else 45 { 46 *sh_deferred_function_attributes_tail 47 = tree_cons (id, NULL_TREE, *sh_deferred_function_attributes_tail); 48 sh_deferred_function_attributes_tail 49 = &TREE_CHAIN (*sh_deferred_function_attributes_tail); 50 } 51 } 52 53 void 54 sh_pr_interrupt (struct cpp_reader *pfile ATTRIBUTE_UNUSED) 55 { 56 sh_add_function_attribute ("interrupt_handler"); 57 } 58 59 void 60 sh_pr_trapa (struct cpp_reader *pfile ATTRIBUTE_UNUSED) 61 { 62 sh_add_function_attribute ("trapa_handler"); 63 } 64 65 void 66 sh_pr_nosave_low_regs (struct cpp_reader *pfile ATTRIBUTE_UNUSED) 67 { 68 sh_add_function_attribute ("nosave_low_regs"); 69 } 70