summaryrefslogtreecommitdiff
path: root/gcc/gencodes.c
diff options
context:
space:
mode:
authorzack <zack@138bc75d-0d04-0410-961f-82ee72b054a4>2002-07-29 18:02:47 +0000
committerzack <zack@138bc75d-0d04-0410-961f-82ee72b054a4>2002-07-29 18:02:47 +0000
commitb70bd5426e751c76b70d8d569862671a10ecac13 (patch)
tree8880ef10951d3d1fbca761d1c3b95b762f0409e5 /gcc/gencodes.c
parent22ac052b185623a692f9173da4e7d61070afeec0 (diff)
downloadgcc-b70bd5426e751c76b70d8d569862671a10ecac13.tar.gz
* 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@55839 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/gencodes.c')
-rw-r--r--gcc/gencodes.c24
1 files changed, 18 insertions, 6 deletions
diff --git a/gcc/gencodes.c b/gcc/gencodes.c
index 0611eecaf03..5a292821c39 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 */");