summaryrefslogtreecommitdiffstats
path: root/gcc
diff options
context:
space:
mode:
authorzack <zack@138bc75d-0d04-0410-961f-82ee72b054a4>2002-05-12 18:43:33 +0000
committerzack <zack@138bc75d-0d04-0410-961f-82ee72b054a4>2002-05-12 18:43:33 +0000
commitbe46690ee3370d9008b0220bfa7074563edd7ded (patch)
tree041a0c07e04b7b1e912cc3fbfff87c4cb5742d5e /gcc
parent0ef911744f03203291e910fd511fc5fbe17b692f (diff)
downloadppe42-gcc-be46690ee3370d9008b0220bfa7074563edd7ded.tar.gz
ppe42-gcc-be46690ee3370d9008b0220bfa7074563edd7ded.zip
* gensupport.c (n_comma_elts): Moved here from genattrtab.c.
(scan_comma_elt): New function. Accepts whitespace in comma lists. * gensupport.h: Prototype new routines. * genattr.c (gen_attr): Use scan_comma_elt. Avoid unnecessary use of printf. * genattrtab.c (n_comma_elts): Moved to gensupport.c. (next_comma_elt): Use scan_comma_elt. * config/i386/i386.md: Use new attribute notation to break up long lines in define_attr forms. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@53403 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog13
-rw-r--r--gcc/config/i386/i386.md39
-rw-r--r--gcc/genattr.c35
-rw-r--r--gcc/genattrtab.c39
-rw-r--r--gcc/gensupport.c50
-rw-r--r--gcc/gensupport.h6
6 files changed, 119 insertions, 63 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 235d652c0cc..4a547c1ed91 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,16 @@
+2002-05-12 Zack Weinberg <zack@codesourcery.com>
+
+ * gensupport.c (n_comma_elts): Moved here from genattrtab.c.
+ (scan_comma_elt): New function. Accepts whitespace in comma lists.
+ * gensupport.h: Prototype new routines.
+ * genattr.c (gen_attr): Use scan_comma_elt. Avoid unnecessary
+ use of printf.
+ * genattrtab.c (n_comma_elts): Moved to gensupport.c.
+ (next_comma_elt): Use scan_comma_elt.
+
+ * config/i386/i386.md: Use new attribute notation to break up
+ long lines in define_attr forms.
+
2002-05-12 Richard Henderson <rth@redhat.com>
* expr.c (compress_float_constant): New.
diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md
index 11ab6f42177..ad463c37741 100644
--- a/gcc/config/i386/i386.md
+++ b/gcc/config/i386/i386.md
@@ -123,20 +123,31 @@
;; A basic instruction type. Refinements due to arguments to be
;; provided in other attributes.
(define_attr "type"
- "other,multi,alu1,negnot,alu,icmp,test,imov,imovx,lea,incdec,ishift,rotate,imul,idiv,ibr,setcc,push,pop,call,callv,icmov,fmov,fop,fsgn,fmul,fdiv,fpspc,fcmov,fcmp,fxch,str,cld,sse,sseadd,ssemul,ssediv,ssemov,ssecmp,ssecvt,sselog,sseiadd,sseishft,sseimul,mmx,mmxmov,mmxadd,mmxshft,mmxcmp,mmxcvt,mmxmul,fistp"
+ "other,multi,
+ alu,alu1,negnot,imov,imovx,lea,
+ incdec,ishift,rotate,imul,idiv,
+ icmp,test,ibr,setcc,icmov,
+ push,pop,call,callv,
+ str,cld,
+ fmov,fop,fsgn,fmul,fdiv,fpspc,fcmov,fcmp,fxch,fistp,
+ sselog,sseiadd,sseishft,sseimul,
+ sse,ssemov,sseadd,ssemul,ssecmp,ssecvt,ssediv,
+ mmx,mmxmov,mmxadd,mmxmul,mmxcmp,mmxcvt,mmxshft"
(const_string "other"))
;; Main data type used by the insn
-(define_attr "mode" "unknown,none,QI,HI,SI,DI,unknownfp,SF,DF,XF,TI,V4SF,V2DF,V2SF"
+(define_attr "mode"
+ "unknown,none,QI,HI,SI,DI,unknownfp,SF,DF,XF,TI,V4SF,V2DF,V2SF"
(const_string "unknown"))
;; The CPU unit operations uses.
(define_attr "unit" "integer,i387,sse,mmx,unknown"
(cond [(eq_attr "type" "fmov,fop,fsgn,fmul,fdiv,fpspc,fcmov,fcmp,fxch,fistp")
(const_string "i387")
- (eq_attr "type" "sse,sseadd,ssemul,ssediv,ssemov,ssecmp,ssecvt,sselog,sseiadd,sseishft,sseimul")
+ (eq_attr "type" "sselog,sseiadd,sseishft,sseimul,
+ sse,ssemov,sseadd,ssemul,ssecmp,ssecvt,ssediv")
(const_string "sse")
- (eq_attr "type" "mmx,mmxmov,mmxadd,mmxshft,mmxcmp,mmxcvt,mmxmul")
+ (eq_attr "type" "mmx,mmxmov,mmxadd,mmxmul,mmxcmp,mmxcvt,mmxshft")
(const_string "mmx")]
(const_string "integer")))
@@ -146,7 +157,8 @@
(const_int 0)
(eq_attr "unit" "i387,sse,mmx")
(const_int 0)
- (eq_attr "type" "alu1,negnot,alu,icmp,imovx,ishift,rotate,imul,push,pop")
+ (eq_attr "type" "alu,alu1,negnot,imovx,ishift,rotate,imul,
+ icmp,push,pop")
(symbol_ref "ix86_attr_length_immediate_default(insn,1)")
(eq_attr "type" "imov,test")
(symbol_ref "ix86_attr_length_immediate_default(insn,0)")
@@ -166,7 +178,8 @@
(const_int 1)
(const_int 4))
]
- (symbol_ref "/* Update immediate_length and other attributes! */ abort(),1")))
+ (symbol_ref "/* Update immediate_length and other attributes! */
+ abort(),1")))
;; The (bounding maximum) length of an instruction address.
(define_attr "length_address" ""
@@ -196,7 +209,12 @@
;; Set when 0f opcode prefix is used.
(define_attr "prefix_0f" ""
- (if_then_else (eq_attr "type" "imovx,setcc,icmov,sse,sseadd,ssemul,ssediv,ssemov,ssecmp,ssecvt,sselog,sseiadd,sseishft,sseimul,mmx,mmxmov,mmxadd,mmxshft,mmxcmp,mmxcvt,mmxmul")
+ (if_then_else
+ (eq_attr "type"
+ "imovx,setcc,icmov,
+ sselog,sseiadd,sseishft,sseimul,
+ sse,ssemov,sseadd,ssemul,ssecmp,ssecvt,ssediv,
+ mmx,mmxmov,mmxadd,mmxmul,mmxcmp,mmxcvt,mmxshft")
(const_int 1)
(const_int 0)))
@@ -287,7 +305,12 @@
(const_string "store")
(match_operand 1 "memory_operand" "")
(const_string "load")
- (and (eq_attr "type" "!icmp,test,alu1,negnot,fsgn,imov,imovx,fmov,fcmp,sse,ssecmp,mmx,ssemov,mmxmov,ssecvt,mmxcvt,mmxcmp")
+ (and (eq_attr "type"
+ "!alu1,negnot,
+ imov,imovx,icmp,test,
+ fmov,fcmp,fsgn,
+ sse,ssemov,ssecmp,ssecvt,
+ mmx,mmxmov,mmxcmp,mmxcvt")
(match_operand 2 "memory_operand" ""))
(const_string "load")
(and (eq_attr "type" "icmov")
diff --git a/gcc/genattr.c b/gcc/genattr.c
index 60045ff8083..b688bd49bad 100644
--- a/gcc/genattr.c
+++ b/gcc/genattr.c
@@ -86,34 +86,30 @@ static void
gen_attr (attr)
rtx attr;
{
- const char *p;
+ const char *p, *tag;
int is_const = GET_CODE (XEXP (attr, 2)) == CONST;
printf ("#define HAVE_ATTR_%s\n", XSTR (attr, 0));
/* If numeric attribute, don't need to write an enum. */
- if (*XSTR (attr, 1) == '\0')
+ p = XSTR (attr, 1);
+ if (*p == '\0')
printf ("extern int get_attr_%s PARAMS ((%s));\n", XSTR (attr, 0),
(is_const ? "void" : "rtx"));
else
{
printf ("enum attr_%s {", XSTR (attr, 0));
- write_upcase (XSTR (attr, 0));
- printf ("_");
- for (p = XSTR (attr, 1); *p != '\0'; p++)
+ while ((tag = scan_comma_elt (&p)) != 0)
{
- if (*p == ',')
- {
- printf (", ");
- write_upcase (XSTR (attr, 0));
- printf ("_");
- }
- else
- putchar (TOUPPER(*p));
+ write_upcase (XSTR (attr, 0));
+ putchar ('_');
+ while (tag != p)
+ putchar (TOUPPER (*tag++));
+ fputs (", ", stdout);
}
- printf ("};\n");
+ fputs ("};\n", stdout);
printf ("extern enum attr_%s get_attr_%s PARAMS ((%s));\n\n",
XSTR (attr, 0), XSTR (attr, 0), (is_const ? "void" : "rtx"));
}
@@ -122,11 +118,12 @@ gen_attr (attr)
variables used by `insn_current_length'. */
if (! strcmp (XSTR (attr, 0), "length"))
{
- printf ("extern void shorten_branches PARAMS ((rtx));\n");
- printf ("extern int insn_default_length PARAMS ((rtx));\n");
- printf ("extern int insn_variable_length_p PARAMS ((rtx));\n");
- printf ("extern int insn_current_length PARAMS ((rtx));\n\n");
- printf ("#include \"insn-addr.h\"\n\n");
+ puts ("\
+extern void shorten_branches PARAMS ((rtx));\n\
+extern int insn_default_length PARAMS ((rtx));\n\
+extern int insn_variable_length_p PARAMS ((rtx));\n\
+extern int insn_current_length PARAMS ((rtx));\n\n\
+#include \"insn-addr.h\"\n");
}
}
diff --git a/gcc/genattrtab.c b/gcc/genattrtab.c
index 2e2b0015034..1561e77218d 100644
--- a/gcc/genattrtab.c
+++ b/gcc/genattrtab.c
@@ -456,7 +456,6 @@ static void write_complex_function PARAMS ((struct function_unit *, const char *
static int write_expr_attr_cache PARAMS ((rtx, struct attr_desc *));
static void write_toplevel_expr PARAMS ((rtx));
static void write_const_num_delay_slots PARAMS ((void));
-static int n_comma_elts PARAMS ((const char *));
static char *next_comma_elt PARAMS ((const char **));
static struct attr_desc *find_attr PARAMS ((const char *, int));
static struct attr_value *find_most_used PARAMS ((struct attr_desc *));
@@ -5793,25 +5792,6 @@ write_complex_function (unit, name, connection)
/* This page contains miscellaneous utility routines. */
-/* Given a string, return the number of comma-separated elements in it.
- Return 0 for the null string. */
-
-static int
-n_comma_elts (s)
- const char *s;
-{
- int n;
-
- if (*s == '\0')
- return 0;
-
- for (n = 1; *s; s++)
- if (*s == ',')
- n++;
-
- return n;
-}
-
/* Given a pointer to a (char *), return a malloc'ed string containing the
next comma-separated element. Advance the pointer to after the string
scanned, or the end-of-string. Return NULL if at end of string. */
@@ -5820,23 +5800,14 @@ static char *
next_comma_elt (pstr)
const char **pstr;
{
- char *out_str;
- const char *p;
-
- if (**pstr == '\0')
- return NULL;
-
- /* Find end of string to compute length. */
- for (p = *pstr; *p != ',' && *p != '\0'; p++)
- ;
+ const char *start;
- out_str = attr_string (*pstr, p - *pstr);
- *pstr = p;
+ start = scan_comma_elt (pstr);
- if (**pstr == ',')
- (*pstr)++;
+ if (start == NULL)
+ return NULL;
- return out_str;
+ return attr_string (start, *pstr - start);
}
/* Return a `struct attr_desc' pointer for a given named attribute. If CREATE
diff --git a/gcc/gensupport.c b/gcc/gensupport.c
index d7cb6732145..e6292d9981f 100644
--- a/gcc/gensupport.c
+++ b/gcc/gensupport.c
@@ -1,5 +1,5 @@
/* Support routines for the various generation passes.
- Copyright (C) 2000, 2001 Free Software Foundation, Inc.
+ Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc.
This file is part of GCC.
@@ -1099,3 +1099,51 @@ read_md_rtx (lineno, seqnr)
return desc;
}
+
+/* Given a string, return the number of comma-separated elements in it.
+ Return 0 for the null string. */
+int
+n_comma_elts (s)
+ const char *s;
+{
+ int n;
+
+ if (*s == '\0')
+ return 0;
+
+ for (n = 1; *s; s++)
+ if (*s == ',')
+ n++;
+
+ return n;
+}
+
+/* Given a pointer to a (char *), return a pointer to the beginning of the
+ next comma-separated element in the string. Advance the pointer given
+ to the end of that element. Return NULL if at end of string. Caller
+ is responsible for copying the string if necessary. White space between
+ a comma and an element is ignored. */
+
+const char *
+scan_comma_elt (pstr)
+ const char **pstr;
+{
+ const char *start;
+ const char *p = *pstr;
+
+ if (*p == ',')
+ p++;
+ while (ISSPACE(*p))
+ p++;
+
+ if (*p == '\0')
+ return NULL;
+
+ start = p;
+
+ while (*p != ',' && *p != '\0')
+ p++;
+
+ *pstr = p;
+ return start;
+}
diff --git a/gcc/gensupport.h b/gcc/gensupport.h
index 96c8c87ba25..bac804b22a6 100644
--- a/gcc/gensupport.h
+++ b/gcc/gensupport.h
@@ -1,5 +1,5 @@
/* Declarations for rtx-reader support for gen* routines.
- Copyright (C) 2000 Free Software Foundation, Inc.
+ Copyright (C) 2000, 2002 Free Software Foundation, Inc.
This file is part of GCC.
@@ -27,3 +27,7 @@ extern rtx read_md_rtx PARAMS ((int *, int *));
extern void message_with_line PARAMS ((int, const char *, ...))
ATTRIBUTE_PRINTF_2;
+
+extern int n_comma_elts PARAMS ((const char *));
+extern const char *scan_comma_elt PARAMS ((const char **));
+
OpenPOWER on IntegriCloud