summaryrefslogtreecommitdiff
path: root/gcc/optabs.c
diff options
context:
space:
mode:
authorrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>2010-07-12 18:55:48 +0000
committerrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>2010-07-12 18:55:48 +0000
commitd0f03375468f173a33fe2f655e260c0ff6209e25 (patch)
tree3386f4b0b387575b31aa4559e02d101b1270353f /gcc/optabs.c
parent63027472f4239a38a77c77cd487c4ee9b1033c09 (diff)
downloadgcc-d0f03375468f173a33fe2f655e260c0ff6209e25.tar.gz
gcc/
* Makefile.in (LIBFUNCS_H): Add $(HASHTAB_H). (target-globals.o): Depend on $(LIBFUNCS_H). * libfuncs.h: Include hashtab.h. (libfunc_entry): Moved from optabs.c. (target_libfuncs): New structure. (default_target_libfuncs): Declare. (this_target_libfuncs): Declare as a variable or define as a macro. (libfunc_table): Redefine as a macro. * optabs.c (default_target_libfuncs): New variable. (this_target_libfuncs): New conditional variable. (libfunc_table): Delete. (libfunc_entry): Moved to optabs.h. (libfunc_hash): Redefine as a macro. (hash_libfunc, eq_libfunc): Fix comments. (init_optabs): Use libfunc_hash to detect cases where the function has already been called. Clear the hash table instead of recreating it. * target-globals.h (this_target_libfuncs): Declare. (target_globals): Add a libfuncs field. (restore_target_globals): Copy the libfuncs field to this_target_libfuncs. * target-globals.c: Include libfuncs.h. (default_target_globals): Initialize the libfuncs field. (save_target_globals): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@162099 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/optabs.c')
-rw-r--r--gcc/optabs.c40
1 files changed, 15 insertions, 25 deletions
diff --git a/gcc/optabs.c b/gcc/optabs.c
index e9487d0367e..b9db02fe83f 100644
--- a/gcc/optabs.c
+++ b/gcc/optabs.c
@@ -46,11 +46,14 @@ along with GCC; see the file COPYING3. If not see
#include "target.h"
struct target_optabs default_target_optabs;
+struct target_libfuncs default_target_libfuncs;
#if SWITCHABLE_TARGET
struct target_optabs *this_target_optabs = &default_target_optabs;
+struct target_libfuncs *this_target_libfuncs = &default_target_libfuncs;
#endif
-rtx libfunc_table[LTI_MAX];
+#define libfunc_hash \
+ (this_target_libfuncs->x_libfunc_hash)
/* Contains the optab used for each rtx code. */
optab code_to_optab[NUM_RTX_CODE + 1];
@@ -69,19 +72,7 @@ void debug_optab_libfuncs (void);
#define DECIMAL_PREFIX "dpd_"
#endif
-
-/* Info about libfunc. We use same hashtable for normal optabs and conversion
- optab. In the first case mode2 is unused. */
-struct GTY(()) libfunc_entry {
- size_t optab;
- enum machine_mode mode1, mode2;
- rtx libfunc;
-};
-
-/* Hash table used to convert declarations into nodes. */
-static GTY((param_is (struct libfunc_entry))) htab_t libfunc_hash;
-
-/* Used for attribute_hash. */
+/* Used for libfunc_hash. */
static hashval_t
hash_libfunc (const void *p)
@@ -92,7 +83,7 @@ hash_libfunc (const void *p)
^ e->optab);
}
-/* Used for optab_hash. */
+/* Used for libfunc_hash. */
static int
eq_libfunc (const void *p, const void *q)
@@ -6124,14 +6115,15 @@ set_conv_libfunc (convert_optab optable, enum machine_mode tmode,
void
init_optabs (void)
{
- static bool reinit;
-
- libfunc_hash = htab_create_ggc (10, hash_libfunc, eq_libfunc, NULL);
-
- /* We statically initialize the insn_codes with the equivalent of
- CODE_FOR_nothing. Repeat the process if reinitialising. */
- if (reinit)
- init_insn_codes ();
+ if (libfunc_hash)
+ {
+ htab_empty (libfunc_hash);
+ /* We statically initialize the insn_codes with the equivalent of
+ CODE_FOR_nothing. Repeat the process if reinitialising. */
+ init_insn_codes ();
+ }
+ else
+ libfunc_hash = htab_create_ggc (10, hash_libfunc, eq_libfunc, NULL);
init_optab (add_optab, PLUS);
init_optabv (addv_optab, PLUS);
@@ -6572,8 +6564,6 @@ init_optabs (void)
/* Allow the target to add more libcalls or rename some, etc. */
targetm.init_libfuncs ();
-
- reinit = true;
}
/* Print information about the current contents of the optabs on