diff options
author | Zack Weinberg <zack@gcc.gnu.org> | 2002-07-29 18:02:47 +0000 |
---|---|---|
committer | Zack Weinberg <zack@gcc.gnu.org> | 2002-07-29 18:02:47 +0000 |
commit | 2199e5fade2d41cbdb19bb730e494613b9b7e262 (patch) | |
tree | 8880ef10951d3d1fbca761d1c3b95b762f0409e5 /gcc/gencodes.c | |
parent | 6ab185d6a53a5d77b86144d26414b5167778384a (diff) | |
download | gcc-2199e5fade2d41cbdb19bb730e494613b9b7e262.zip gcc-2199e5fade2d41cbdb19bb730e494613b9b7e262.tar.gz gcc-2199e5fade2d41cbdb19bb730e494613b9b7e262.tar.bz2 |
gensupport.c: Include hashtab.h.
* gensupport.c: Include hashtab.h.
(insn_elision, condition_table, hash_c_test, cmp_c_test,
maybe_eval_c_test): New routines and data structures to
support insn elision.
(init_md_reader): Read and initialize the condition_table.
(read_md_rtx): Discard insn patterns whose C test is provably
always false.
* gensupport.h: Declare new functions and data structures.
* genconditions.c, dummy-conditions.c: New files.
* Makefile.in: Build genconditions; run it to construct
insn-conditions.c; build that and link it into most gen*
programs.
(HOST_SUPPORT, HOST_EARLY_SUPPORT): New variables.
(GEN): Delete, unused.
(STAGESTUFF): Update.
* gencodes.c: (gen_insn): #define CODE_FOR_xxx equal to
CODE_FOR_nothing for all elided patterns.
(main): Tweaked to support this.
* genflags.c (gen_proto): Emit a static inline generator
function here for all elided patterns, which simply returns
NULL_RTX.
(gen_insn): Do not define HAVE_xxx for elided patterns.
(main): Tweaked to support this. No need to forward-declare
struct rtx_def.
* genrecog.c: Do not bother emitting the C test if it's known
to be true at compile time.
From-SVN: r55839
Diffstat (limited to 'gcc/gencodes.c')
-rw-r--r-- | gcc/gencodes.c | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/gcc/gencodes.c b/gcc/gencodes.c index 0611eec..5a29282 100644 --- a/gcc/gencodes.c +++ b/gcc/gencodes.c @@ -28,18 +28,26 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include "errors.h" #include "gensupport.h" -static void gen_insn PARAMS ((const char *, int)); +static void gen_insn PARAMS ((rtx, int)); static void -gen_insn (name, code) - const char *name; +gen_insn (insn, code) + rtx insn; int code; { + const char *name = XSTR (insn, 0); + int truth = maybe_eval_c_test (XSTR (insn, 2)); + /* Don't mention instructions whose names are the null string or begin with '*'. They are in the machine description just to be recognized. */ if (name[0] != 0 && name[0] != '*') - printf (" CODE_FOR_%s = %d,\n", name, code); + { + if (truth == 0) + printf ("#define CODE_FOR_%s CODE_FOR_nothing\n", name); + else + printf (" CODE_FOR_%s = %d,\n", name, code); + } } extern int main PARAMS ((int, char **)); @@ -53,6 +61,10 @@ main (argc, argv) progname = "gencodes"; + /* We need to see all the possibilities. Elided insns may have + direct references to CODE_FOR_xxx in C code. */ + insn_elision = 0; + if (argc <= 1) fatal ("no input file name"); @@ -80,10 +92,10 @@ enum insn_code {"); break; if (GET_CODE (desc) == DEFINE_INSN || GET_CODE (desc) == DEFINE_EXPAND) - gen_insn (XSTR (desc, 0), insn_code_number); + gen_insn (desc, insn_code_number); } - puts ("CODE_FOR_nothing\n\ + puts (" CODE_FOR_nothing\n\ };\n\ \n\ #endif /* GCC_INSN_CODES_H */"); |