This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Generate md_constants in insn-config.h, not insn-codes.h
- To: gcc-patches at gcc dot gnu dot org
- Subject: Generate md_constants in insn-config.h, not insn-codes.h
- From: Alexandre Oliva <aoliva at redhat dot com>
- Date: 22 Nov 2000 19:14:22 -0200
- Organization: GCC Team, Red Hat
If constants defined in the MD file are used in macros in the target
machine header file as extensively as I intend to do in sh.h, having
the constants defined in insn-codes.h isn't enough. I think it makes
more sense to have them in insn-flags.h or insn-config.h. I ended up
doing it in insn-config.h, that needed fewer additional #includes, and
makes a little bit more sense to me. sh-elf still builds on
i686-pc-linux-gnu, after `make clean'. Ok to install?
Index: gcc/ChangeLog
from Alexandre Oliva <aoliva@redhat.com>
* gencodes.c (print_md_constant): Moved to...
* genconfig.c: Adjusted callers.
* alias.c, calls.c, resource.c, rtlanal.c: Include insn-config.h.
* Makefile.in: Adjust dependencies.
Index: gcc/gencodes.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/gencodes.c,v
retrieving revision 1.33
diff -u -p -r1.33 gencodes.c
--- gcc/gencodes.c 2000/11/22 01:22:01 1.33
+++ gcc/gencodes.c 2000/11/22 21:05:19
@@ -32,7 +32,6 @@ Boston, MA 02111-1307, USA. */
static int insn_code_number;
static void gen_insn PARAMS ((rtx));
-static int print_md_constant PARAMS ((void **, void *));
static void
gen_insn (insn)
@@ -89,8 +88,6 @@ from the machine description file `md'.
printf ("\n#define MAX_INSN_CODE ((int) CODE_FOR_nothing)\n\n");
- traverse_md_constants (print_md_constant, stdout);
-
printf ("\n#endif /* MAX_INSN_CODE */\n");
fflush (stdout);
@@ -103,18 +100,4 @@ get_insn_name (code)
int code ATTRIBUTE_UNUSED;
{
return NULL;
-}
-
-/* Called via traverse_md_constants; emit a #define for
- the current constant definition. */
-static int
-print_md_constant (slot, info)
- void **slot;
- void *info;
-{
- struct md_constant *def = *slot;
- FILE *file = info;
-
- fprintf (file, "#define %s %s\n", def->name, def->value);
- return 1;
}
Index: gcc/genconfig.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/genconfig.c,v
retrieving revision 1.39
diff -u -p -r1.39 genconfig.c
--- gcc/genconfig.c 2000/05/28 02:17:58 1.39
+++ gcc/genconfig.c 2000/11/22 21:05:19
@@ -54,6 +54,7 @@ static void gen_expand PARAMS ((rtx));
static void gen_split PARAMS ((rtx));
static void gen_peephole PARAMS ((rtx));
static void gen_peephole2 PARAMS ((rtx));
+static int print_md_constant PARAMS ((void **, void *));
/* RECOG_P will be non-zero if this pattern was seen in a context where it will
be used to recognize, rather than just generate an insn.
@@ -356,6 +357,8 @@ from the machine description file `md'.
printf ("#define MAX_INSNS_PER_PEEP2 %d\n", max_insns_per_peep2);
}
+ traverse_md_constants (print_md_constant, stdout);
+
fflush (stdout);
return (ferror (stdout) != 0 ? FATAL_EXIT_CODE : SUCCESS_EXIT_CODE);
}
@@ -366,4 +369,18 @@ get_insn_name (code)
int code ATTRIBUTE_UNUSED;
{
return NULL;
+}
+
+/* Called via traverse_md_constants; emit a #define for
+ the current constant definition. */
+static int
+print_md_constant (slot, info)
+ void **slot;
+ void *info;
+{
+ struct md_constant *def = (struct md_constant *)*slot;
+ FILE *file = (FILE *)info;
+
+ fprintf (file, "#define %s %s\n", def->name, def->value);
+ return 1;
}
Index: gcc/alias.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/alias.c,v
retrieving revision 1.106
diff -u -p -r1.106 alias.c
--- gcc/alias.c 2000/11/19 19:39:17 1.106
+++ gcc/alias.c 2000/11/22 21:05:00
@@ -26,6 +26,7 @@ Boston, MA 02111-1307, USA. */
#include "tm_p.h"
#include "function.h"
#include "insn-flags.h"
+#include "insn-config.h"
#include "expr.h"
#include "regs.h"
#include "hard-reg-set.h"
Index: gcc/calls.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/calls.c,v
retrieving revision 1.165
diff -u -p -r1.165 calls.c
--- gcc/calls.c 2000/11/09 07:45:13 1.165
+++ gcc/calls.c 2000/11/22 21:05:05
@@ -28,6 +28,7 @@ Boston, MA 02111-1307, USA. */
#include "function.h"
#include "regs.h"
#include "insn-flags.h"
+#include "insn-config.h"
#include "toplev.h"
#include "output.h"
#include "tm_p.h"
Index: gcc/resource.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/resource.c,v
retrieving revision 1.35
diff -u -p -r1.35 resource.c
--- gcc/resource.c 2000/10/13 06:26:28 1.35
+++ gcc/resource.c 2000/11/22 21:05:21
@@ -32,6 +32,7 @@ Boston, MA 02111-1307, USA. */
#include "resource.h"
#include "except.h"
#include "insn-attr.h"
+#include "insn-config.h"
/* This structure is used to record liveness information at the targets or
fallthrough insns of branches. We will most likely need the information
Index: gcc/rtlanal.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/rtlanal.c,v
retrieving revision 1.74
diff -u -p -r1.74 rtlanal.c
--- gcc/rtlanal.c 2000/10/24 23:01:11 1.74
+++ gcc/rtlanal.c 2000/11/22 21:05:23
@@ -24,6 +24,7 @@ Boston, MA 02111-1307, USA. */
#include "system.h"
#include "toplev.h"
#include "rtl.h"
+#include "insn-config.h"
static int rtx_addr_can_trap_p PARAMS ((rtx));
static void reg_set_p_1 PARAMS ((rtx, rtx, void *));
Index: gcc/Makefile.in
===================================================================
RCS file: /cvs/gcc/egcs/gcc/Makefile.in,v
retrieving revision 1.548
diff -u -p -r1.548 Makefile.in
--- gcc/Makefile.in 2000/11/22 08:32:25 1.548
+++ gcc/Makefile.in 2000/11/22 21:04:58
@@ -1308,12 +1308,13 @@ rtl.o : rtl.c $(CONFIG_H) system.h $(RTL
print-rtl.o : print-rtl.c $(CONFIG_H) system.h $(RTL_H) hard-reg-set.h \
$(BASIC_BLOCK_H)
-rtlanal.o : rtlanal.c $(CONFIG_H) system.h toplev.h $(RTL_H)
+rtlanal.o : rtlanal.c $(CONFIG_H) system.h toplev.h $(RTL_H) insn-config.h
errors.o : errors.c $(CONFIG_H) system.h errors.h
varasm.o : varasm.c $(CONFIG_H) system.h $(TREE_H) $(RTL_H) flags.h \
function.h defaults.h $(EXPR_H) hard-reg-set.h $(REGS_H) \
- xcoffout.h output.h c-pragma.h toplev.h dbxout.h sdbout.h $(GGC_H)
+ xcoffout.h output.h c-pragma.h toplev.h dbxout.h sdbout.h $(GGC_H) \
+ insn-config.h
function.o : function.c $(CONFIG_H) system.h $(RTL_H) $(TREE_H) flags.h \
function.h insn-flags.h insn-codes.h $(EXPR_H) $(REGS_H) hard-reg-set.h \
insn-config.h $(RECOG_H) output.h toplev.h except.h hash.h $(GGC_H)
@@ -1332,7 +1333,8 @@ builtins.o : builtins.c $(CONFIG_H) syst
$(RECOG_H) output.h typeclass.h hard-reg-set.h toplev.h hard-reg-set.h \
except.h
calls.o : calls.c $(CONFIG_H) system.h $(RTL_H) $(TREE_H) flags.h $(EXPR_H) \
- insn-flags.h $(REGS_H) toplev.h output.h function.h $(TIMEVAR_H)
+ insn-flags.h $(REGS_H) toplev.h output.h function.h $(TIMEVAR_H) \
+ insn-config.h
expmed.o : expmed.c $(CONFIG_H) system.h $(RTL_H) $(TREE_H) flags.h \
insn-flags.h insn-config.h insn-codes.h $(EXPR_H) $(RECOG_H) real.h toplev.h
explow.o : explow.c $(CONFIG_H) system.h $(RTL_H) $(TREE_H) flags.h \
@@ -1381,7 +1383,7 @@ sibcall.o : sibcall.c $(CONFIG_H) system
hard-reg-set.h flags.h insn-config.h $(RECOG_H) $(BASIC_BLOCK_H)
resource.o : resource.c $(CONFIG_H) $(RTL_H) hard-reg-set.h system.h \
$(BASIC_BLOCK_H) $(REGS_H) flags.h output.h resource.h function.h toplev.h \
- $(INSN_ATTR_H) except.h
+ $(INSN_ATTR_H) except.h insn-config.h
lcm.o : lcm.c $(CONFIG_H) system.h $(RTL_H) $(REGS_H) hard-reg-set.h flags.h \
real.h insn-config.h $(INSN_ATTR_H) $(RECOG_H) $(EXPR_H) $(BASIC_BLOCK_H)
ssa.o : ssa.c $(CONFIG_H) system.h $(REGS_H) varray.h \
@@ -1435,7 +1437,7 @@ reorg.o : reorg.c $(CONFIG_H) system.h $
$(RECOG_H) function.h flags.h output.h $(EXPR_H) toplev.h
alias.o : alias.c $(CONFIG_H) system.h $(RTL_H) flags.h hard-reg-set.h \
$(BASIC_BLOCK_H) $(REGS_H) toplev.h output.h $(EXPR_H) insn-flags.h \
- $(GGC_H) function.h cselib.h $(TREE_H)
+ $(GGC_H) function.h cselib.h $(TREE_H) insn-config.h
regmove.o : regmove.c $(CONFIG_H) system.h $(RTL_H) insn-config.h \
$(RECOG_H) output.h $(REGS_H) hard-reg-set.h flags.h function.h \
$(EXPR_H) insn-flags.h $(BASIC_BLOCK_H) toplev.h
@@ -1764,7 +1766,8 @@ $(HOST_PREFIX_1)bitmap.o: $(srcdir)/bitm
sed -e 's/config[.]h/hconfig.h/' $(srcdir)/bitmap.c > $(HOST_PREFIX)bitmap.c
$(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(HOST_PREFIX)bitmap.c
-$(HOST_PREFIX_1)rtlanal.o: $(srcdir)/rtlanal.c $(CONFIG_H) system.h $(RTL_H)
+$(HOST_PREFIX_1)rtlanal.o: $(srcdir)/rtlanal.c $(CONFIG_H) system.h $(RTL_H) \
+ insn-config.h
rm -f $(HOST_PREFIX)rtlanal.c
sed -e 's/config[.]h/hconfig.h/' $(srcdir)/rtlanal.c > $(HOST_PREFIX)rtlanal.c
$(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(HOST_PREFIX)rtlanal.c
--
Alexandre Oliva Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer aoliva@{cygnus.com, redhat.com}
CS PhD student at IC-Unicamp oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist *Please* write to mailing lists, not to me