aboutsummaryrefslogtreecommitdiff
path: root/gcc/genopinit.c
diff options
context:
space:
mode:
authorRichard Sandiford <richard.sandiford@arm.com>2015-09-17 14:28:59 +0000
committerRichard Sandiford <rsandifo@gcc.gnu.org>2015-09-17 14:28:59 +0000
commit385399a8759c233f487ddd7e158802a1ee4f960d (patch)
treeb4c04d6027cb1108af25cc0d42827303e661abb5 /gcc/genopinit.c
parenta78eb72ac066743c8c11dbc1032a1909963719a3 (diff)
downloadgcc-385399a8759c233f487ddd7e158802a1ee4f960d.zip
gcc-385399a8759c233f487ddd7e158802a1ee4f960d.tar.gz
gcc-385399a8759c233f487ddd7e158802a1ee4f960d.tar.bz2
Split up optabs.[hc]
optabs.[hc] is a bit of a behemoth. It includes basic functions for querying what a target can do, related tree- and gimple-level query functions, related rtl-level query functions, and the functions that actually generate code. Some gimple optimisations therefore need: #include "insn-config.h" #include "expmed.h" #include "dojump.h" #include "explow.h" #include "emit-rtl.h" #include "varasm.h" #include "stmt.h" #include "expr.h" purely to query whether the target has support for a particular operation. This patch splits optabs up as follows: - optabs-query.[hc]: IL-independent functions for querying what a target can do natively. - optabs-tree.[hc]: tree and gimple query functions (an extension of optabs-query.[hc]). - optabs-libfuncs.[hc]: optabs-specific libfuncs (an extension of libfuncs.h) - optabs.h: For now includes optabs-query.h and optabs-libfuncs.h. Only two files outside optabs need to include both optabs.h and optabs-tree.h: expr.c and function.c. I think that's expected given that both are related to expand. It might be good to split optabs.h further, but this is already quite a big patch. I changed can_conditionally_move_p from returning an int to returning a bool and fixed a few formatting glitches. There should be no other changes to the functions themselves. gcc/ * Makefile.in (OBJS): Add optabs-libfuncs.o, optabs-query.o and optabs-tree.o. (GTFILES): Replace optabs.c with optabs-libfunc.c. * genopinit.c (main): Add an include guard to insn-opinit.h. Protect the rtx_code parts with NUM_RTX_CODE. * optabs.h: Split parts out to... * optabs-libfuncs.h, optabs-query.h, optabs-tree.h: ...these new files. * optabs.c: Split parts out to... * optabs-libfuncs.c, optabs-query.c, optabs-tree.c: ...these new files. * cilk-common.c: Include optabs-query.h rather than optabs.h. * fold-const.c: Likewise. * target-globals.c: Likewise. * tree-if-conv.c: Likewise. * tree-ssa-forwprop.c: Likewise. * tree-ssa-loop-prefetch.c: Likewise. * tree-ssa-math-opts.c: Include optabs-tree.h rather than optabs.h. Remove unncessary include files. * tree-ssa-phiopt.c: Likewise. * tree-ssa-reassoc.c: Likewise. * tree-switch-conversion.c: Likewise. * tree-vect-data-refs.c: Likewise. * tree-vect-generic.c: Likewise. * tree-vect-loop.c: Likewise. * tree-vect-patterns.c: Likewise. * tree-vect-slp.c: Likewise. * tree-vect-stmts.c: Likewise. * tree-vrp.c: Likewise. * toplev.c: Include optabs-query.h and optabs-libfuncs.h rather than optabs.h. * expr.c: Include optabs-tree.h. * function.c: Likewise. From-SVN: r227865
Diffstat (limited to 'gcc/genopinit.c')
-rw-r--r--gcc/genopinit.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/gcc/genopinit.c b/gcc/genopinit.c
index 77e81f5..167815d 100644
--- a/gcc/genopinit.c
+++ b/gcc/genopinit.c
@@ -377,6 +377,9 @@ main (int argc, char **argv)
purging of the X patterns above. */
qsort (optabs, n, sizeof (optab_def), optab_kind_cmp);
+ fprintf (h_file, "#ifndef GCC_INSN_OPINIT_H\n");
+ fprintf (h_file, "#define GCC_INSN_OPINIT_H 1\n");
+
/* Emit the optab enumeration for the header file. */
fprintf (h_file, "enum optab_tag {\n");
for (i = j = 0; i < n; ++i)
@@ -426,6 +429,7 @@ main (int argc, char **argv)
" the body of that kind of insn. */\n"
"#define GEN_FCN(CODE) (insn_data[CODE].genfun)\n"
"\n"
+ "#ifdef NUM_RTX_CODE\n"
"/* Contains the optab used for each rtx code, and vice-versa. */\n"
"extern const optab code_to_optab_[NUM_RTX_CODE];\n"
"extern const enum rtx_code optab_to_code_[NUM_OPTABS];\n"
@@ -441,6 +445,7 @@ main (int argc, char **argv)
"{\n"
" return optab_to_code_[op];\n"
"}\n"
+ "#endif\n"
"\n"
"extern const struct convert_optab_libcall_d convlib_def[NUM_CONVLIB_OPTABS];\n"
"extern const struct optab_libcall_d normlib_def[NUM_NORMLIB_OPTABS];\n"
@@ -594,6 +599,7 @@ main (int argc, char **argv)
}
fprintf (s_file, "};\n\n");
+ fprintf (h_file, "#endif\n");
return (fclose (h_file) == 0 && fclose (s_file) == 0
? SUCCESS_EXIT_CODE : FATAL_EXIT_CODE);
}