Move over patch from Bernd Schmidt from GC branch:
* emit-rtl.c (gen_rtx_CONST_DOUBLE): New function. (gen_rtx): Call it. Tidy cases. * rtl.h (gen_rtx_CONST_DOUBLE): Prototype it. * gengenrtl.c: Add commentary. (special_rtx): Also match CONST_DOUBLE. (gencode): Emit call to memset instead of bzero. From-SVN: r26110
This commit is contained in:
parent
4b97aaeb34
commit
0133b7d92c
@ -1,3 +1,13 @@
|
||||
Thu Apr 1 17:01:50 1999 Richard Henderson <rth@cygnus.com>
|
||||
|
||||
Move over patch from Bernd Schmidt from GC branch:
|
||||
* emit-rtl.c (gen_rtx_CONST_DOUBLE): New function.
|
||||
(gen_rtx): Call it. Tidy cases.
|
||||
* rtl.h (gen_rtx_CONST_DOUBLE): Prototype it.
|
||||
* gengenrtl.c: Add commentary.
|
||||
(special_rtx): Also match CONST_DOUBLE.
|
||||
(gencode): Emit call to memset instead of bzero.
|
||||
|
||||
Fri Apr 2 12:58:26 1999 Michael Hayes <m.hayes@elec.canterbury.ac.nz>
|
||||
|
||||
* config/c4x/c4x.md (ashlhi3, lshrhi3, ashrhi3): Force operand 1
|
||||
|
@ -264,6 +264,22 @@ gen_rtx_CONST_INT (mode, arg)
|
||||
return gen_rtx_raw_CONST_INT (mode, arg);
|
||||
}
|
||||
|
||||
/* CONST_DOUBLEs needs special handling because its length is known
|
||||
only at run-time. */
|
||||
rtx
|
||||
gen_rtx_CONST_DOUBLE (mode, arg0, arg1, arg2)
|
||||
enum machine_mode mode;
|
||||
rtx arg0;
|
||||
HOST_WIDE_INT arg1, arg2;
|
||||
{
|
||||
rtx r = rtx_alloc (CONST_DOUBLE);
|
||||
PUT_MODE (r, mode);
|
||||
XEXP (r, 0) = arg0;
|
||||
XINT (r, 2) = arg1;
|
||||
XINT (r, 3) = arg2;
|
||||
return r;
|
||||
}
|
||||
|
||||
rtx
|
||||
gen_rtx_REG (mode, regno)
|
||||
enum machine_mode mode;
|
||||
@ -366,14 +382,30 @@ gen_rtx VPROTO((enum rtx_code code, enum machine_mode mode, ...))
|
||||
mode = va_arg (p, enum machine_mode);
|
||||
#endif
|
||||
|
||||
if (code == CONST_INT)
|
||||
rt_val = gen_rtx_CONST_INT (mode, va_arg (p, HOST_WIDE_INT));
|
||||
else if (code == REG)
|
||||
rt_val = gen_rtx_REG (mode, va_arg (p, int));
|
||||
else if (code == MEM)
|
||||
rt_val = gen_rtx_MEM (mode, va_arg (p, rtx));
|
||||
else
|
||||
switch (code)
|
||||
{
|
||||
case CONST_INT:
|
||||
rt_val = gen_rtx_CONST_INT (mode, va_arg (p, HOST_WIDE_INT));
|
||||
break;
|
||||
|
||||
case CONST_DOUBLE:
|
||||
{
|
||||
rtx arg0 = va_arg (p, rtx);
|
||||
HOST_WIDE_INT arg1 = va_arg (p, HOST_WIDE_INT);
|
||||
HOST_WIDE_INT arg2 = va_arg (p, HOST_WIDE_INT);
|
||||
rt_val = gen_rtx_CONST_DOUBLE (mode, arg0, arg1, arg2);
|
||||
}
|
||||
break;
|
||||
|
||||
case REG:
|
||||
rt_val = gen_rtx_REG (mode, va_arg (p, int));
|
||||
break;
|
||||
|
||||
case MEM:
|
||||
rt_val = gen_rtx_MEM (mode, va_arg (p, rtx));
|
||||
break;
|
||||
|
||||
default:
|
||||
rt_val = rtx_alloc (code); /* Allocate the storage space. */
|
||||
rt_val->mode = mode; /* Store the machine mode... */
|
||||
|
||||
@ -418,9 +450,11 @@ gen_rtx VPROTO((enum rtx_code code, enum machine_mode mode, ...))
|
||||
abort ();
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
va_end (p);
|
||||
return rt_val; /* Return the new RTX... */
|
||||
return rt_val;
|
||||
}
|
||||
|
||||
/* gen_rtvec (n, [rt1, ..., rtn])
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* Generate code to allocate RTL structures.
|
||||
Copyright (C) 1997, 1998 Free Software Foundation, Inc.
|
||||
Copyright (C) 1997, 1998, 1999 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU CC.
|
||||
|
||||
@ -52,6 +52,8 @@ static void genlegend PROTO((FILE *));
|
||||
static void genheader PROTO((FILE *));
|
||||
static void gencode PROTO((FILE *));
|
||||
|
||||
/* Decode a format letter into a C type string. */
|
||||
|
||||
static const char *
|
||||
type_from_format (c)
|
||||
int c;
|
||||
@ -84,6 +86,8 @@ type_from_format (c)
|
||||
}
|
||||
}
|
||||
|
||||
/* Decode a format letter into the proper accessor function. */
|
||||
|
||||
static const char *
|
||||
accessor_from_format (c)
|
||||
int c;
|
||||
@ -110,6 +114,8 @@ accessor_from_format (c)
|
||||
}
|
||||
}
|
||||
|
||||
/* Return true if a format character doesn't need normal processing. */
|
||||
|
||||
static int
|
||||
special_format (fmt)
|
||||
const char *fmt;
|
||||
@ -120,15 +126,20 @@ special_format (fmt)
|
||||
|| strchr (fmt, 'n') != 0);
|
||||
}
|
||||
|
||||
/* Return true if an rtx requires special processing. */
|
||||
|
||||
static int
|
||||
special_rtx (idx)
|
||||
int idx;
|
||||
{
|
||||
return (strcmp (defs[idx].enumname, "CONST_INT") == 0
|
||||
|| strcmp (defs[idx].enumname, "CONST_DOUBLE") == 0
|
||||
|| strcmp (defs[idx].enumname, "REG") == 0
|
||||
|| strcmp (defs[idx].enumname, "MEM") == 0);
|
||||
}
|
||||
|
||||
/* Fill `formats' with all unique format strings. */
|
||||
|
||||
static void
|
||||
find_formats ()
|
||||
{
|
||||
@ -142,7 +153,7 @@ find_formats ()
|
||||
continue;
|
||||
|
||||
for (f = formats; *f ; ++f)
|
||||
if (!strcmp(*f, defs[i].format))
|
||||
if (! strcmp (*f, defs[i].format))
|
||||
break;
|
||||
|
||||
if (!*f)
|
||||
@ -150,6 +161,8 @@ find_formats ()
|
||||
}
|
||||
}
|
||||
|
||||
/* Emit a prototype for the rtx generator for a format. */
|
||||
|
||||
static void
|
||||
gendecl (f, format)
|
||||
FILE *f;
|
||||
@ -166,6 +179,8 @@ gendecl (f, format)
|
||||
fprintf (f, "));\n");
|
||||
}
|
||||
|
||||
/* Emit a define mapping an rtx code to the generator for its format. */
|
||||
|
||||
static void
|
||||
genmacro (f, idx)
|
||||
FILE *f;
|
||||
@ -189,6 +204,8 @@ genmacro (f, idx)
|
||||
fprintf (f, ")\n");
|
||||
}
|
||||
|
||||
/* Emit the implementation for the rtx generator for a format. */
|
||||
|
||||
static void
|
||||
gendef (f, format)
|
||||
FILE *f;
|
||||
@ -225,14 +242,18 @@ gendef (f, format)
|
||||
fprintf (f, "\n return rt;\n}\n\n");
|
||||
}
|
||||
|
||||
/* Emit the `do not edit' banner. */
|
||||
|
||||
static void
|
||||
genlegend (f)
|
||||
FILE *f;
|
||||
{
|
||||
fprintf (f, "/* Generated automaticaly by the program `gengenrtl'\n");
|
||||
fprintf (f, " from the RTL description file `rtl.def' */\n\n");
|
||||
fputs ("/* Generated automaticaly by the program `gengenrtl'\n", f);
|
||||
fputs (" from the RTL description file `rtl.def' */\n\n", f);
|
||||
}
|
||||
|
||||
/* Emit "genrtl.h". */
|
||||
|
||||
static void
|
||||
genheader (f)
|
||||
FILE *f;
|
||||
@ -243,7 +264,7 @@ genheader (f)
|
||||
for (fmt = formats; *fmt; ++fmt)
|
||||
gendecl (f, *fmt);
|
||||
|
||||
fprintf(f, "\n");
|
||||
fprintf (f, "\n");
|
||||
|
||||
for (i = 0; i < NUM_RTX_CODE; i++)
|
||||
{
|
||||
@ -253,6 +274,8 @@ genheader (f)
|
||||
}
|
||||
}
|
||||
|
||||
/* Emit "genrtl.c". */
|
||||
|
||||
static void
|
||||
gencode (f)
|
||||
FILE *f;
|
||||
@ -268,7 +291,7 @@ gencode (f)
|
||||
fputs ("static rtx obstack_alloc_rtx (length)\n", f);
|
||||
fputs (" register int length;\n{\n", f);
|
||||
fputs (" rtx rt = (rtx) obstack_alloc (rtl_obstack, length);\n\n", f);
|
||||
fputs (" bzero((char *) rt, sizeof(struct rtx_def) - sizeof(rtunion));\n\n", f);
|
||||
fputs (" memset(rt, 0, sizeof(struct rtx_def) - sizeof(rtunion));\n\n", f);
|
||||
fputs (" return rt;\n}\n\n", f);
|
||||
|
||||
for (fmt = formats; *fmt; ++fmt)
|
||||
@ -308,22 +331,22 @@ main(argc, argv)
|
||||
f = fopen (argv[1], "w");
|
||||
if (f == NULL)
|
||||
{
|
||||
perror(argv[1]);
|
||||
perror (argv[1]);
|
||||
exit (1);
|
||||
}
|
||||
genlegend (f);
|
||||
genheader (f);
|
||||
fclose(f);
|
||||
fclose (f);
|
||||
|
||||
f = fopen (argv[2], "w");
|
||||
if (f == NULL)
|
||||
{
|
||||
perror(argv[2]);
|
||||
perror (argv[2]);
|
||||
exit (1);
|
||||
}
|
||||
genlegend (f);
|
||||
gencode (f);
|
||||
fclose(f);
|
||||
fclose (f);
|
||||
|
||||
exit (0);
|
||||
}
|
||||
|
@ -1136,6 +1136,8 @@ extern rtx return_address_pointer_rtx;
|
||||
add to this list, modify special_rtx in gengenrtl.c as well. You
|
||||
should also modify gen_rtx to use the special function. */
|
||||
|
||||
extern rtx gen_rtx_CONST_DOUBLE PROTO((enum machine_mode, rtx,
|
||||
HOST_WIDE_INT, HOST_WIDE_INT));
|
||||
extern rtx gen_rtx_CONST_INT PROTO((enum machine_mode, HOST_WIDE_INT));
|
||||
extern rtx gen_rtx_REG PROTO((enum machine_mode, int));
|
||||
extern rtx gen_rtx_MEM PROTO((enum machine_mode, rtx));
|
||||
|
Loading…
Reference in New Issue
Block a user