summaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Sandiford <rdsandiford@googlemail.com>2010-07-12 19:03:35 +0000
committerRichard Sandiford <rsandifo@gcc.gnu.org>2010-07-12 19:03:35 +0000
commitfa19795ec4394113e1d79f4660d97b2da23cfaca (patch)
tree62ef72086ece76b905d83fddffb7913f0ad12b2e /gcc
parentc371bb73807c48f1a708c51f113caea45f0347b1 (diff)
Makefile.in (target-globals.o): Depend on builtins.h.
gcc/ * Makefile.in (target-globals.o): Depend on builtins.h. * builtins.h: New file. * builtins.c: Include builtins.h. (default_target_builtins): New variable. (this_target_builtins): New conditional variable. (apply_args_mode, apply_result_mode): Redefine as macros. * target-globals.h (this_target_builtins): Declare. (target_globals): Add a builtins field. (restore_target_globals): Copy the builtins field to this_target_builtins. * target-globals.c: Include builtins.h. (default_target_globals): Initialize the builtins field. (save_target_globals): Likewise. From-SVN: r162105
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog16
-rw-r--r--gcc/Makefile.in2
-rw-r--r--gcc/builtins.c23
-rw-r--r--gcc/builtins.h49
-rw-r--r--gcc/target-globals.c5
-rw-r--r--gcc/target-globals.h3
6 files changed, 83 insertions, 15 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 7aca51933b6..be54183d7e7 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,21 @@
2010-07-12 Richard Sandiford <rdsandiford@googlemail.com>
+ * Makefile.in (target-globals.o): Depend on builtins.h.
+ * builtins.h: New file.
+ * builtins.c: Include builtins.h.
+ (default_target_builtins): New variable.
+ (this_target_builtins): New conditional variable.
+ (apply_args_mode, apply_result_mode): Redefine as macros.
+ * target-globals.h (this_target_builtins): Declare.
+ (target_globals): Add a builtins field.
+ (restore_target_globals): Copy the builtins field to
+ this_target_builtins.
+ * target-globals.c: Include builtins.h.
+ (default_target_globals): Initialize the builtins field.
+ (save_target_globals): Likewise.
+
+2010-07-12 Richard Sandiford <rdsandiford@googlemail.com>
+
* expmed.h (alg_code, mult_cost, MULT_COST_LESS, CHEAPER_MULT_COST)
(algorithm, alg_hash_entry, NUM_ALG_HASH_ENTRIES, alg_hash): Moved
from expmed.c.
diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index e6a172d8943..1db2ecbda56 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -3483,7 +3483,7 @@ lower-subreg.o : lower-subreg.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
target-globals.o : target-globals.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
$(TM_H) insn-config.h $(MACHMODE_H) $(GGC_H) $(TOPLEV_H) target-globals.h \
$(FLAGS_H) $(REGS_H) $(RTL_H) reload.h expmed.h $(EXPR_H) $(OPTABS_H) \
- $(LIBFUNCS_H) $(CFGLOOP_H) $(IRA_INT_H)
+ $(LIBFUNCS_H) $(CFGLOOP_H) $(IRA_INT_H) builtins.h
$(out_object_file): $(out_file) $(CONFIG_H) coretypes.h $(TM_H) $(TREE_H) \
$(RTL_H) $(REGS_H) hard-reg-set.h insn-config.h conditions.h \
diff --git a/gcc/builtins.c b/gcc/builtins.c
index 8039f9b8b11..73a70f22ffe 100644
--- a/gcc/builtins.c
+++ b/gcc/builtins.c
@@ -50,6 +50,7 @@ along with GCC; see the file COPYING3. If not see
#include "tree-flow.h"
#include "value-prof.h"
#include "diagnostic-core.h"
+#include "builtins.h"
#ifndef SLOW_UNALIGNED_ACCESS
#define SLOW_UNALIGNED_ACCESS(MODE, ALIGN) STRICT_ALIGNMENT
@@ -60,6 +61,11 @@ along with GCC; see the file COPYING3. If not see
#endif
static tree do_mpc_arg1 (tree, tree, int (*)(mpc_ptr, mpc_srcptr, mpc_rnd_t));
+struct target_builtins default_target_builtins;
+#if SWITCHABLE_TARGET
+struct target_builtins *this_target_builtins = &default_target_builtins;
+#endif
+
/* Define the names of the builtin function types and codes. */
const char *const built_in_class_names[4]
= {"NOT_BUILT_IN", "BUILT_IN_FRONTEND", "BUILT_IN_MD", "BUILT_IN_NORMAL"};
@@ -1249,19 +1255,10 @@ get_memory_rtx (tree exp, tree len)
/* Built-in functions to perform an untyped call and return. */
-/* For each register that may be used for calling a function, this
- gives a mode used to copy the register's value. VOIDmode indicates
- the register is not used for calling a function. If the machine
- has register windows, this gives only the outbound registers.
- INCOMING_REGNO gives the corresponding inbound register. */
-static enum machine_mode apply_args_mode[FIRST_PSEUDO_REGISTER];
-
-/* For each register that may be used for returning values, this gives
- a mode used to copy the register's value. VOIDmode indicates the
- register is not used for returning values. If the machine has
- register windows, this gives only the outbound registers.
- INCOMING_REGNO gives the corresponding inbound register. */
-static enum machine_mode apply_result_mode[FIRST_PSEUDO_REGISTER];
+#define apply_args_mode \
+ (this_target_builtins->x_apply_args_mode)
+#define apply_result_mode \
+ (this_target_builtins->x_apply_result_mode)
/* Return the size required for the block returned by __builtin_apply_args,
and initialize apply_args_mode. */
diff --git a/gcc/builtins.h b/gcc/builtins.h
new file mode 100644
index 00000000000..a7d14581e99
--- /dev/null
+++ b/gcc/builtins.h
@@ -0,0 +1,49 @@
+/* Expand builtin functions.
+ Copyright (C) 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+ 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
+ Free Software Foundation, 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 3, 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 COPYING3. If not see
+<http://www.gnu.org/licenses/>. */
+
+#ifndef GCC_BUILTINS_H
+#define GCC_BUILTINS_H
+
+/* Target-dependent globals. */
+struct target_builtins {
+ /* For each register that may be used for calling a function, this
+ gives a mode used to copy the register's value. VOIDmode indicates
+ the register is not used for calling a function. If the machine
+ has register windows, this gives only the outbound registers.
+ INCOMING_REGNO gives the corresponding inbound register. */
+ enum machine_mode x_apply_args_mode[FIRST_PSEUDO_REGISTER];
+
+ /* For each register that may be used for returning values, this gives
+ a mode used to copy the register's value. VOIDmode indicates the
+ register is not used for returning values. If the machine has
+ register windows, this gives only the outbound registers.
+ INCOMING_REGNO gives the corresponding inbound register. */
+ enum machine_mode x_apply_result_mode[FIRST_PSEUDO_REGISTER];
+};
+
+extern GTY(()) struct target_builtins default_target_builtins;
+#if SWITCHABLE_TARGET
+extern struct target_builtins *this_target_builtins;
+#else
+#define this_target_builtins (&default_target_builtins)
+#endif
+
+#endif
diff --git a/gcc/target-globals.c b/gcc/target-globals.c
index 9d3d6666fff..cca93a53f91 100644
--- a/gcc/target-globals.c
+++ b/gcc/target-globals.c
@@ -37,6 +37,7 @@ along with GCC; see the file COPYING3. If not see
#include "libfuncs.h"
#include "cfgloop.h"
#include "ira-int.h"
+#include "builtins.h"
#if SWITCHABLE_TARGET
struct target_globals default_target_globals = {
@@ -50,7 +51,8 @@ struct target_globals default_target_globals = {
&default_target_libfuncs,
&default_target_cfgloop,
&default_target_ira,
- &default_target_ira_int
+ &default_target_ira_int,
+ &default_target_builtins
};
struct target_globals *
@@ -70,6 +72,7 @@ save_target_globals (void)
g->cfgloop = XCNEW (struct target_cfgloop);
g->ira = XCNEW (struct target_ira);
g->ira_int = XCNEW (struct target_ira_int);
+ g->builtins = XCNEW (struct target_builtins);
restore_target_globals (g);
target_reinit ();
return g;
diff --git a/gcc/target-globals.h b/gcc/target-globals.h
index b1458cc42a0..a0cf73730c2 100644
--- a/gcc/target-globals.h
+++ b/gcc/target-globals.h
@@ -32,6 +32,7 @@ extern struct target_libfuncs *this_target_libfuncs;
extern struct target_cfgloop *this_target_cfgloop;
extern struct target_ira *this_target_ira;
extern struct target_ira_int *this_target_ira_int;
+extern struct target_builtins *this_target_builtins;
struct GTY(()) target_globals {
struct target_flag_state *GTY((skip)) flag_state;
@@ -45,6 +46,7 @@ struct GTY(()) target_globals {
struct target_cfgloop *GTY((skip)) cfgloop;
struct target_ira *GTY((skip)) ira;
struct target_ira_int *GTY((skip)) ira_int;
+ struct target_builtins *GTY((skip)) builtins;
};
extern struct target_globals default_target_globals;
@@ -65,6 +67,7 @@ restore_target_globals (struct target_globals *g)
this_target_cfgloop = g->cfgloop;
this_target_ira = g->ira;
this_target_ira_int = g->ira_int;
+ this_target_builtins = g->builtins;
}
#endif