aboutsummaryrefslogtreecommitdiff
path: root/gcc/config/m32c/m32c-pragma.c
diff options
context:
space:
mode:
authorDJ Delorie <dj@redhat.com>2005-07-20 19:27:02 -0400
committerDJ Delorie <dj@gcc.gnu.org>2005-07-20 19:27:02 -0400
commit38b2d076326a730238139d00c940fd306a5ddf3e (patch)
tree49956253fc931fdfea43fb640512022daf032ae2 /gcc/config/m32c/m32c-pragma.c
parent50b69666aa028b3f643d69eda72bd3729428f8ed (diff)
downloadgcc-38b2d076326a730238139d00c940fd306a5ddf3e.zip
gcc-38b2d076326a730238139d00c940fd306a5ddf3e.tar.gz
gcc-38b2d076326a730238139d00c940fd306a5ddf3e.tar.bz2
config.gcc: Add m32c-elf support.
* config.gcc: Add m32c-elf support. * doc/contrib.texi: Mention m32c. * doc/extend.texi: Document m32c extensions. * doc/install.texi: Mention m32c. * doc/invoke.texi: Document m32c options. * doc/md.texi: Document m32c constraints. * config/m32c/addsub.md: New file. * config/m32c/bitops.md: New file. * config/m32c/cond.md: New file. * config/m32c/jump.md: New file. * config/m32c/m32c-lib1.S: New file. * config/m32c/m32c-lib2.c: New file. * config/m32c/m32c-modes.def: New file. * config/m32c/m32c-pragma.c: New file. * config/m32c/m32c-protos.h: New file. * config/m32c/m32c.abi: New file. * config/m32c/m32c.c: New file. * config/m32c/m32c.h: New file. * config/m32c/m32c.md: New file. * config/m32c/m32c.opt: New file. * config/m32c/minmax.md: New file. * config/m32c/mov.md: New file. * config/m32c/muldiv.md: New file. * config/m32c/predicates.md: New file. * config/m32c/prologue.md: New file. * config/m32c/shift.md: New file. * config/m32c/t-m32c: New file. From-SVN: r102207
Diffstat (limited to 'gcc/config/m32c/m32c-pragma.c')
-rw-r--r--gcc/config/m32c/m32c-pragma.c97
1 files changed, 97 insertions, 0 deletions
diff --git a/gcc/config/m32c/m32c-pragma.c b/gcc/config/m32c/m32c-pragma.c
new file mode 100644
index 0000000..2360878
--- /dev/null
+++ b/gcc/config/m32c/m32c-pragma.c
@@ -0,0 +1,97 @@
+/* M32C Pragma support
+ Copyright (C) 2004 Free Software Foundation, Inc.
+ Contributed by Red Hat, Inc.
+
+ 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 <stdio.h>
+#include "config.h"
+#include "system.h"
+#include "coretypes.h"
+#include "tm.h"
+#include "tree.h"
+#include "rtl.h"
+#include "toplev.h"
+#include "c-pragma.h"
+#include "cpplib.h"
+#include "hard-reg-set.h"
+#include "output.h"
+#include "m32c-protos.h"
+#include "function.h"
+#define MAX_RECOG_OPERANDS 10
+#include "reload.h"
+#include "target.h"
+
+/* Implements the "GCC memregs" pragma. This pragma takes only an
+ integer, and is semantically identical to the -memregs= command
+ line option. The only catch is, the programmer should only use
+ this pragma at the beginning of the file (preferably, in some
+ project-wide header) to avoid ABI changes related to changing the
+ list of available "registers". */
+static void
+m32c_pragma_memregs (cpp_reader * reader ATTRIBUTE_UNUSED)
+{
+ /* on off */
+ tree val;
+ enum cpp_ttype type;
+ HOST_WIDE_INT i;
+ static char new_number[3];
+
+ type = c_lex (&val);
+ if (type == CPP_NUMBER)
+ {
+ if (host_integerp (val, 1))
+ {
+ i = tree_low_cst (val, 1);
+
+ type = c_lex (&val);
+ if (type != CPP_EOF)
+ warning (0, "junk at end of #pragma GCC memregs [0..16]");
+
+ if (0 <= i && i <= 16)
+ {
+ if (!ok_to_change_target_memregs)
+ {
+ warning (0,
+ "#pragma GCC memregs must precede any function decls");
+ return;
+ }
+ new_number[0] = (i / 10) + '0';
+ new_number[1] = (i % 10) + '0';
+ new_number[2] = 0;
+ target_memregs = new_number;
+ m32c_conditional_register_usage ();
+ }
+ else
+ {
+ warning (0, "#pragma GCC memregs takes a number [0..16]");
+ }
+
+ return;
+ }
+ }
+
+ error ("#pragma GCC memregs takes a number [0..16]");
+}
+
+/* Implements REGISTER_TARGET_PRAGMAS. */
+void
+m32c_register_pragmas (void)
+{
+ c_register_pragma ("GCC", "memregs", m32c_pragma_memregs);
+}