summaryrefslogtreecommitdiffstats
path: root/contrib/gcc/genattrtab.c
diff options
context:
space:
mode:
authorkan <kan@FreeBSD.org>2003-07-11 03:40:53 +0000
committerkan <kan@FreeBSD.org>2003-07-11 03:40:53 +0000
commitb2a8872fbe1ec1c49094559ac7b78e6ea4ab7180 (patch)
treef6b0610f4a17fd26aa234354f050080f789861a4 /contrib/gcc/genattrtab.c
parent52e69d78eee5612ac195e0701a5cebe40d1ab0e1 (diff)
downloadFreeBSD-src-b2a8872fbe1ec1c49094559ac7b78e6ea4ab7180.zip
FreeBSD-src-b2a8872fbe1ec1c49094559ac7b78e6ea4ab7180.tar.gz
Gcc 3.3.1-pre as of 2003-07-11.
Diffstat (limited to 'contrib/gcc/genattrtab.c')
-rw-r--r--contrib/gcc/genattrtab.c263
1 files changed, 144 insertions, 119 deletions
diff --git a/contrib/gcc/genattrtab.c b/contrib/gcc/genattrtab.c
index a485dee..47a6f00 100644
--- a/contrib/gcc/genattrtab.c
+++ b/contrib/gcc/genattrtab.c
@@ -86,15 +86,20 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
definitions (each would be accessed through a pointer).
We use the flags in an RTX as follows:
- `unchanging' (RTX_UNCHANGING_P): This rtx is fully simplified
+ `unchanging' (ATTR_IND_SIMPLIFIED_P): This rtx is fully simplified
independent of the insn code.
- `in_struct' (MEM_IN_STRUCT_P): This rtx is fully simplified
+ `in_struct' (ATTR_CURR_SIMPLIFIED_P): This rtx is fully simplified
for the insn code currently being processed (see optimize_attrs).
- `integrated' (RTX_INTEGRATED_P): This rtx is permanent and unique
+ `integrated' (ATTR_PERMANENT_P): This rtx is permanent and unique
(see attr_rtx).
- `volatil' (MEM_VOLATILE_P): During simplify_by_exploding the value of an
+ `volatil' (ATTR_EQ_ATTR_P): During simplify_by_exploding the value of an
EQ_ATTR rtx is true if !volatil and false if volatil. */
+#define ATTR_IND_SIMPLIFIED_P(RTX) (RTX_FLAG((RTX), unchanging))
+#define ATTR_CURR_SIMPLIFIED_P(RTX) (RTX_FLAG((RTX), in_struct))
+#define ATTR_PERMANENT_P(RTX) (RTX_FLAG((RTX), integrated))
+#define ATTR_EQ_ATTR_P(RTX) (RTX_FLAG((RTX), volatil))
+
#include "hconfig.h"
#include "system.h"
#include "rtl.h"
@@ -110,13 +115,12 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
#include "obstack.h"
#include "errors.h"
+#include "genattrtab.h"
+
static struct obstack obstack1, obstack2;
struct obstack *hash_obstack = &obstack1;
struct obstack *temp_obstack = &obstack2;
-#define obstack_chunk_alloc xmalloc
-#define obstack_chunk_free free
-
/* enough space to reserve for printing out ints */
#define MAX_DIGITS (HOST_BITS_PER_INT * 3 / 10 + 3)
@@ -262,7 +266,7 @@ static struct function_unit *units;
The algorithm relies on sharing EQ_ATTR nodes: if two nodes in an
expression are the same, the will also have the same address. We find
- all the EQ_ATTR nodes by marking them MEM_VOLATILE_P. This bit later
+ all the EQ_ATTR nodes by marking them ATTR_EQ_ATTR_P. This bit later
represents the value of an EQ_ATTR node, so once all nodes are marked,
they are also given an initial value of FALSE.
@@ -304,6 +308,8 @@ static int have_annul_true, have_annul_false;
static int num_units, num_unit_opclasses;
static int num_insn_ents;
+int num_dfa_decls;
+
/* Used as operand to `operate_exp': */
enum operator {PLUS_OP, MINUS_OP, POS_MINUS_OP, EQ_OP, OR_OP, ORX_OP, MAX_OP, MIN_OP, RANGE_OP};
@@ -344,7 +350,7 @@ int optimize = 0;
/* Simplify an expression. Only call the routine if there is something to
simplify. */
#define SIMPLIFY_TEST_EXP(EXP,INSN_CODE,INSN_INDEX) \
- (RTX_UNCHANGING_P (EXP) || MEM_IN_STRUCT_P (EXP) ? (EXP) \
+ (ATTR_IND_SIMPLIFIED_P (EXP) || ATTR_CURR_SIMPLIFIED_P (EXP) ? (EXP) \
: simplify_test_exp (EXP, INSN_CODE, INSN_INDEX))
/* Simplify (eq_attr ("alternative") ...)
@@ -366,10 +372,7 @@ static void attr_hash_add_rtx PARAMS ((int, rtx));
static void attr_hash_add_string PARAMS ((int, char *));
static rtx attr_rtx PARAMS ((enum rtx_code, ...));
static rtx attr_rtx_1 PARAMS ((enum rtx_code, va_list));
-static char *attr_printf PARAMS ((unsigned int, const char *, ...))
- ATTRIBUTE_PRINTF_2;
static char *attr_string PARAMS ((const char *, int));
-static rtx check_attr_test PARAMS ((rtx, int, int));
static rtx check_attr_value PARAMS ((rtx, struct attr_desc *));
static rtx convert_set_attr_alternative PARAMS ((rtx, struct insn_def *));
static rtx convert_set_attr PARAMS ((rtx, struct insn_def *));
@@ -387,7 +390,6 @@ static void expand_units PARAMS ((void));
static rtx simplify_knowing PARAMS ((rtx, rtx));
static rtx encode_units_mask PARAMS ((rtx));
static void fill_attr PARAMS ((struct attr_desc *));
-/* dpx2 compiler chokes if we specify the arg types of the args. */
static rtx substitute_address PARAMS ((rtx, rtx (*) (rtx), rtx (*) (rtx)));
static void make_length_attrs PARAMS ((void));
static rtx identity_fn PARAMS ((rtx));
@@ -450,13 +452,10 @@ 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 void make_internal_attr PARAMS ((const char *, rtx, int));
static struct attr_value *find_most_used PARAMS ((struct attr_desc *));
static rtx find_single_value PARAMS ((struct attr_desc *));
-static rtx make_numeric_value PARAMS ((int));
static void extend_range PARAMS ((struct range *, int, int));
static rtx attr_eq PARAMS ((const char *, const char *));
static const char *attr_numeral PARAMS ((int));
@@ -532,10 +531,10 @@ attr_hash_add_string (hashcode, str)
}
/* Generate an RTL expression, but avoid duplicates.
- Set the RTX_INTEGRATED_P flag for these permanent objects.
+ Set the ATTR_PERMANENT_P flag for these permanent objects.
In some cases we cannot uniquify; then we return an ordinary
- impermanent rtx with RTX_INTEGRATED_P clear.
+ impermanent rtx with ATTR_PERMANENT_P clear.
Args are like gen_rtx, but without the mode:
@@ -560,7 +559,7 @@ attr_rtx_1 (code, p)
rtx arg0 = va_arg (p, rtx);
/* A permanent object cannot point to impermanent ones. */
- if (! RTX_INTEGRATED_P (arg0))
+ if (! ATTR_PERMANENT_P (arg0))
{
rt_val = rtx_alloc (code);
XEXP (rt_val, 0) = arg0;
@@ -589,7 +588,7 @@ attr_rtx_1 (code, p)
rtx arg1 = va_arg (p, rtx);
/* A permanent object cannot point to impermanent ones. */
- if (! RTX_INTEGRATED_P (arg0) || ! RTX_INTEGRATED_P (arg1))
+ if (! ATTR_PERMANENT_P (arg0) || ! ATTR_PERMANENT_P (arg1))
{
rt_val = rtx_alloc (code);
XEXP (rt_val, 0) = arg0;
@@ -713,7 +712,7 @@ attr_rtx_1 (code, p)
rtl_obstack = old_obstack;
attr_hash_add_rtx (hashcode, rt_val);
- RTX_INTEGRATED_P (rt_val) = 1;
+ ATTR_PERMANENT_P (rt_val) = 1;
return rt_val;
}
@@ -734,7 +733,7 @@ attr_rtx VPARAMS ((enum rtx_code code, ...))
rtx attr_printf (len, format, [arg1, ..., argn]) */
-static char *
+char *
attr_printf VPARAMS ((unsigned int len, const char *fmt, ...))
{
char str[256];
@@ -810,7 +809,7 @@ static int
attr_equal_p (x, y)
rtx x, y;
{
- return (x == y || (! (RTX_INTEGRATED_P (x) && RTX_INTEGRATED_P (y))
+ return (x == y || (! (ATTR_PERMANENT_P (x) && ATTR_PERMANENT_P (y))
&& rtx_equal_p (x, y)));
}
@@ -828,7 +827,7 @@ attr_copy_rtx (orig)
const char *format_ptr;
/* No need to copy a permanent object. */
- if (RTX_INTEGRATED_P (orig))
+ if (ATTR_PERMANENT_P (orig))
return orig;
code = GET_CODE (orig);
@@ -852,10 +851,10 @@ attr_copy_rtx (orig)
copy = rtx_alloc (code);
PUT_MODE (copy, GET_MODE (orig));
- copy->in_struct = orig->in_struct;
- copy->volatil = orig->volatil;
- copy->unchanging = orig->unchanging;
- copy->integrated = orig->integrated;
+ ATTR_IND_SIMPLIFIED_P (copy) = ATTR_IND_SIMPLIFIED_P (orig);
+ ATTR_CURR_SIMPLIFIED_P (copy) = ATTR_CURR_SIMPLIFIED_P (orig);
+ ATTR_PERMANENT_P (copy) = ATTR_PERMANENT_P (orig);
+ ATTR_EQ_ATTR_P (copy) = ATTR_EQ_ATTR_P (orig);
format_ptr = GET_RTX_FORMAT (GET_CODE (copy));
@@ -915,7 +914,7 @@ attr_copy_rtx (orig)
Return the new expression, if any. */
-static rtx
+rtx
check_attr_test (exp, is_const, lineno)
rtx exp;
int is_const;
@@ -945,7 +944,7 @@ check_attr_test (exp, is_const, lineno)
{
XSTR (exp, 0) = alternative_name;
/* This can't be simplified any further. */
- RTX_UNCHANGING_P (exp) = 1;
+ ATTR_IND_SIMPLIFIED_P (exp) = 1;
return exp;
}
else
@@ -964,7 +963,7 @@ check_attr_test (exp, is_const, lineno)
constant attribute, so don't expand this until it's time to
write the test expression. */
if (attr->is_const)
- RTX_UNCHANGING_P (exp) = 1;
+ ATTR_IND_SIMPLIFIED_P (exp) = 1;
if (attr->is_numeric)
{
@@ -1026,7 +1025,7 @@ check_attr_test (exp, is_const, lineno)
fatal ("RTL operator \"%s\" not valid in constant attribute test",
GET_RTX_NAME (GET_CODE (exp)));
/* These cases can't be simplified. */
- RTX_UNCHANGING_P (exp) = 1;
+ ATTR_IND_SIMPLIFIED_P (exp) = 1;
break;
case LE: case LT: case GT: case GE:
@@ -1038,7 +1037,7 @@ check_attr_test (exp, is_const, lineno)
attr_rtx (SYMBOL_REF, XSTR (XEXP (exp, 0), 0)),
attr_rtx (SYMBOL_REF, XSTR (XEXP (exp, 1), 0)));
/* These cases can't be simplified. */
- RTX_UNCHANGING_P (exp) = 1;
+ ATTR_IND_SIMPLIFIED_P (exp) = 1;
break;
case SYMBOL_REF:
@@ -1047,7 +1046,7 @@ check_attr_test (exp, is_const, lineno)
/* These cases are valid for constant attributes, but can't be
simplified. */
exp = attr_rtx (SYMBOL_REF, XSTR (exp, 0));
- RTX_UNCHANGING_P (exp) = 1;
+ ATTR_IND_SIMPLIFIED_P (exp) = 1;
break;
}
default:
@@ -1405,7 +1404,7 @@ convert_const_symbol_ref (exp, attr)
*p = TOUPPER (*p);
value = attr_rtx (SYMBOL_REF, string);
- RTX_UNCHANGING_P (value) = 1;
+ ATTR_IND_SIMPLIFIED_P (value) = 1;
XVECEXP (condexp, 0, 2 * i) = attr_rtx (EQ, exp, value);
@@ -1446,18 +1445,18 @@ make_canonical (attr, exp)
break;
case SYMBOL_REF:
- if (!attr->is_const || RTX_UNCHANGING_P (exp))
+ if (!attr->is_const || ATTR_IND_SIMPLIFIED_P (exp))
break;
/* The SYMBOL_REF is constant for a given run, so mark it as unchanging.
This makes the COND something that won't be considered an arbitrary
expression by walk_attr_value. */
- RTX_UNCHANGING_P (exp) = 1;
+ ATTR_IND_SIMPLIFIED_P (exp) = 1;
#if 0
/* ??? Why do we do this? With attribute values { A B C D E }, this
tends to generate (!(x==A) && !(x==B) && !(x==C) && !(x==D)) rather
than (x==E). */
exp = convert_const_symbol_ref (exp, attr);
- RTX_UNCHANGING_P (exp) = 1;
+ ATTR_IND_SIMPLIFIED_P (exp) = 1;
exp = check_attr_value (exp, attr);
/* Goto COND case since this is now a COND. Note that while the
new expression is rescanned, all symbol_ref notes are marked as
@@ -1839,7 +1838,7 @@ operate_exp (op, left, right)
The first produces a function `function_units_used' which is given an
insn and produces an encoding showing which function units are required
for the execution of that insn. If the value is non-negative, the insn
- uses that unit; otherwise, the value is a one's compliment mask of units
+ uses that unit; otherwise, the value is a one's complement mask of units
used.
The second produces a function `result_ready_cost' which is used to
@@ -2094,7 +2093,7 @@ expand_units ()
fill the unit given the minimum issue delay. FILL-TIME is the
constant "MIN (ISSUE-DELAY (*,*)) * (SIMULTANEITY - 1)", and
the simultaneity constraint is "READY-COST (E) - FILL-TIME"
- if SIMULTANEITY is non-zero and zero otherwise.
+ if SIMULTANEITY is nonzero and zero otherwise.
Thus, BLOCKAGE (E,C) when SIMULTANEITY is zero is
@@ -2247,7 +2246,7 @@ simplify_knowing (exp, known_true)
/* Translate the CONST_STRING expressions in X to change the encoding of
value. On input, the value is a bitmask with a one bit for each unit
used; on output, the value is the unit number (zero based) if one
- and only one unit is used or the one's compliment of the bitmask. */
+ and only one unit is used or the one's complement of the bitmask. */
static rtx
encode_units_mask (x)
@@ -2265,7 +2264,7 @@ encode_units_mask (x)
case CONST_STRING:
i = atoi (XSTR (x, 0));
if (i < 0)
- /* The sign bit encodes a one's compliment mask. */
+ /* The sign bit encodes a one's complement mask. */
abort ();
else if (i != 0 && i == (i & -i))
/* Only one bit is set, so yield that unit number. */
@@ -2824,7 +2823,7 @@ make_alternative_compare (mask)
;
newexp = attr_rtx (EQ_ATTR, alternative_name, attr_numeral (i));
- RTX_UNCHANGING_P (newexp) = 1;
+ ATTR_IND_SIMPLIFIED_P (newexp) = 1;
return newexp;
}
@@ -2932,7 +2931,7 @@ evaluate_eq_attr (exp, value, insn_code, insn_index)
abort ();
/* If uses an address, must return original expression. But set the
- RTX_UNCHANGING_P bit so we don't try to simplify it again. */
+ ATTR_IND_SIMPLIFIED_P bit so we don't try to simplify it again. */
address_used = 0;
walk_attr_value (newexp);
@@ -2940,7 +2939,7 @@ evaluate_eq_attr (exp, value, insn_code, insn_index)
if (address_used)
{
/* This had `&& current_alternative_string', which seems to be wrong. */
- if (! RTX_UNCHANGING_P (exp))
+ if (! ATTR_IND_SIMPLIFIED_P (exp))
return copy_rtx_unchanging (exp);
return exp;
}
@@ -3198,7 +3197,7 @@ attr_rtx_cost (x)
/* Simplify test expression and use temporary obstack in order to avoid
- memory bloat. Use RTX_UNCHANGING_P to avoid unnecesary simplifications
+ memory bloat. Use ATTR_IND_SIMPLIFIED to avoid unnecesary simplifications
and avoid unnecesary copying if possible. */
static rtx
@@ -3208,7 +3207,7 @@ simplify_test_exp_in_temp (exp, insn_code, insn_index)
{
rtx x;
struct obstack *old;
- if (RTX_UNCHANGING_P (exp))
+ if (ATTR_IND_SIMPLIFIED_P (exp))
return exp;
old = rtl_obstack;
rtl_obstack = temp_obstack;
@@ -3241,7 +3240,7 @@ simplify_test_exp (exp, insn_code, insn_index)
rtx newexp = exp;
/* Don't re-simplify something we already simplified. */
- if (RTX_UNCHANGING_P (exp) || MEM_IN_STRUCT_P (exp))
+ if (ATTR_IND_SIMPLIFIED_P (exp) || ATTR_CURR_SIMPLIFIED_P (exp))
return exp;
switch (GET_CODE (exp))
@@ -3491,7 +3490,7 @@ simplify_test_exp (exp, insn_code, insn_index)
won't buy anything unless we weren't given a valid insn code
to process (i.e., we are canonicalizing something.). */
if (insn_code != -2 /* Seems wrong: && current_alternative_string. */
- && ! RTX_UNCHANGING_P (newexp))
+ && ! ATTR_IND_SIMPLIFIED_P (newexp))
return copy_rtx_unchanging (newexp);
return newexp;
@@ -3559,7 +3558,7 @@ optimize_attrs ()
/* Process one insn code at a time. */
for (i = -2; i < insn_code_number; i++)
{
- /* Clear the MEM_IN_STRUCT_P flag everywhere relevant.
+ /* Clear the ATTR_CURR_SIMPLIFIED_P flag everywhere relevant.
We use it to mean "already simplified for this insn". */
for (iv = insn_code_values[i]; iv; iv = iv->next)
clear_struct_flag (iv->av->value);
@@ -3747,13 +3746,13 @@ simplify_by_exploding (exp)
most_tests = -1;
for (i = num_marks = 0; i < total; i++)
if (GET_CODE (condval[i]) == CONST_STRING
- && ! MEM_VOLATILE_P (condval[i]))
+ && ! ATTR_EQ_ATTR_P (condval[i]))
{
/* Mark the unmarked constant value and count how many are marked. */
- MEM_VOLATILE_P (condval[i]) = 1;
+ ATTR_EQ_ATTR_P (condval[i]) = 1;
for (j = new_marks = 0; j < total; j++)
if (GET_CODE (condval[j]) == CONST_STRING
- && MEM_VOLATILE_P (condval[j]))
+ && ATTR_EQ_ATTR_P (condval[j]))
new_marks++;
if (new_marks - num_marks > most_tests)
{
@@ -3764,7 +3763,7 @@ simplify_by_exploding (exp)
}
/* Clear all the marks. */
for (i = 0; i < total; i++)
- MEM_VOLATILE_P (condval[i]) = 0;
+ ATTR_EQ_ATTR_P (condval[i]) = 0;
/* Give up if nothing is constant. */
if (num_marks == 0)
@@ -3796,7 +3795,7 @@ simplify_by_exploding (exp)
return ret;
}
-/* Set the MEM_VOLATILE_P flag for all EQ_ATTR expressions in EXP and
+/* Set the ATTR_EQ_ATTR_P flag for all EQ_ATTR expressions in EXP and
verify that EXP can be simplified to a constant term if all the EQ_ATTR
tests have known value. */
@@ -3810,14 +3809,14 @@ find_and_mark_used_attributes (exp, terms, nterms)
switch (GET_CODE (exp))
{
case EQ_ATTR:
- if (! MEM_VOLATILE_P (exp))
+ if (! ATTR_EQ_ATTR_P (exp))
{
rtx link = rtx_alloc (EXPR_LIST);
XEXP (link, 0) = exp;
XEXP (link, 1) = *terms;
*terms = link;
*nterms += 1;
- MEM_VOLATILE_P (exp) = 1;
+ ATTR_EQ_ATTR_P (exp) = 1;
}
return 1;
@@ -3850,7 +3849,7 @@ find_and_mark_used_attributes (exp, terms, nterms)
}
}
-/* Clear the MEM_VOLATILE_P flag in all EQ_ATTR expressions on LIST and
+/* Clear the ATTR_EQ_ATTR_P flag in all EQ_ATTR expressions on LIST and
in the values of the NDIM-dimensional attribute space SPACE. */
static void
@@ -3869,7 +3868,7 @@ unmark_used_attributes (list, space, ndim)
{
exp = XEXP (link, 0);
if (GET_CODE (exp) == EQ_ATTR)
- MEM_VOLATILE_P (exp) = 0;
+ ATTR_EQ_ATTR_P (exp) = 0;
}
}
@@ -3905,7 +3904,7 @@ add_values_to_cover (dim)
if (GET_CODE (av->value) == CONST_STRING)
{
exp = attr_eq (dim->attr->name, XSTR (av->value, 0));
- if (MEM_VOLATILE_P (exp))
+ if (ATTR_EQ_ATTR_P (exp))
continue;
link = rtx_alloc (EXPR_LIST);
@@ -3995,7 +3994,7 @@ simplify_with_current_value (exp, space, ndim)
{
x = XEXP (space[i].current_value, 0);
if (GET_CODE (x) == EQ_ATTR)
- MEM_VOLATILE_P (x) = 0;
+ ATTR_EQ_ATTR_P (x) = 0;
}
exp = simplify_with_current_value_aux (exp);
@@ -4005,13 +4004,13 @@ simplify_with_current_value (exp, space, ndim)
{
x = XEXP (space[i].current_value, 0);
if (GET_CODE (x) == EQ_ATTR)
- MEM_VOLATILE_P (x) = 1;
+ ATTR_EQ_ATTR_P (x) = 1;
}
return exp;
}
-/* Reduce the expression EXP based on the MEM_VOLATILE_P settings of
+/* Reduce the expression EXP based on the ATTR_EQ_ATTR_P settings of
all EQ_ATTR expressions. */
static rtx
@@ -4024,7 +4023,7 @@ simplify_with_current_value_aux (exp)
switch (GET_CODE (exp))
{
case EQ_ATTR:
- if (MEM_VOLATILE_P (exp))
+ if (ATTR_EQ_ATTR_P (exp))
return false_rtx;
else
return true_rtx;
@@ -4091,7 +4090,7 @@ simplify_with_current_value_aux (exp)
}
}
-/* Clear the MEM_IN_STRUCT_P flag in EXP and its subexpressions. */
+/* Clear the ATTR_CURR_SIMPLIFIED_P flag in EXP and its subexpressions. */
static void
clear_struct_flag (x)
@@ -4102,8 +4101,8 @@ clear_struct_flag (x)
enum rtx_code code;
const char *fmt;
- MEM_IN_STRUCT_P (x) = 0;
- if (RTX_UNCHANGING_P (x))
+ ATTR_CURR_SIMPLIFIED_P (x) = 0;
+ if (ATTR_IND_SIMPLIFIED_P (x))
return;
code = GET_CODE (x);
@@ -4316,7 +4315,7 @@ count_alternatives (exp)
return 0;
}
-/* Returns non-zero if the given expression contains an EQ_ATTR with the
+/* Returns nonzero if the given expression contains an EQ_ATTR with the
`alternative' attribute. */
static int
@@ -4349,7 +4348,7 @@ compares_alternatives_p (exp)
return 0;
}
-/* Returns non-zero is INNER is contained in EXP. */
+/* Returns nonzero is INNER is contained in EXP. */
static int
contained_in_p (inner, exp)
@@ -4559,7 +4558,7 @@ gen_unit (def, lineno)
/* Given a piece of RTX, print a C expression to test its truth value.
We use AND and IOR both for logical and bit-wise operations, so
interpret them as logical unless they are inside a comparison expression.
- The first bit of FLAGS will be non-zero in that case.
+ The first bit of FLAGS will be nonzero in that case.
Set the second bit of FLAGS to make references to attribute values use
a cached local variable instead of calling a function. */
@@ -4914,7 +4913,7 @@ walk_attr_value (exp)
switch (code)
{
case SYMBOL_REF:
- if (! RTX_UNCHANGING_P (exp))
+ if (! ATTR_IND_SIMPLIFIED_P (exp))
/* Since this is an arbitrary expression, it can look at anything.
However, constant expressions do not depend on any particular
insn. */
@@ -5489,7 +5488,7 @@ write_indent (indent)
}
/* Write a subroutine that is given an insn that requires a delay slot, a
- delay slot ordinal, and a candidate insn. It returns non-zero if the
+ delay slot ordinal, and a candidate insn. It returns nonzero if the
candidate can be placed in the specified delay slot of the insn.
We can write as many as three subroutines. `eligible_for_delay'
@@ -5688,6 +5687,8 @@ write_function_unit_info ()
printf ("}, \n");
}
+ if (num_units == 0)
+ printf ("{\"dummy\", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} /* a dummy element */");
printf ("};\n\n");
}
@@ -5787,25 +5788,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. */
@@ -5814,27 +5796,18 @@ static char *
next_comma_elt (pstr)
const char **pstr;
{
- char *out_str;
- const char *p;
-
- if (**pstr == '\0')
- return NULL;
+ const char *start;
- /* Find end of string to compute length. */
- for (p = *pstr; *p != ',' && *p != '\0'; p++)
- ;
-
- 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
- is non-zero, build a new attribute, if one does not exist. */
+ is nonzero, build a new attribute, if one does not exist. */
static struct attr_desc *
find_attr (name, create)
@@ -5875,7 +5848,7 @@ find_attr (name, create)
/* Create internal attribute with the given default value. */
-static void
+void
make_internal_attr (name, value, special)
const char *name;
rtx value;
@@ -5942,7 +5915,7 @@ find_single_value (attr)
/* Return (attr_value "n") */
-static rtx
+rtx
make_numeric_value (n)
int n;
{
@@ -5986,10 +5959,10 @@ copy_rtx_unchanging (orig)
RTX_CODE code;
#endif
- if (RTX_UNCHANGING_P (orig) || MEM_IN_STRUCT_P (orig))
+ if (ATTR_IND_SIMPLIFIED_P (orig) || ATTR_CURR_SIMPLIFIED_P (orig))
return orig;
- MEM_IN_STRUCT_P (orig) = 1;
+ ATTR_CURR_SIMPLIFIED_P (orig) = 1;
return orig;
#if 0
@@ -6008,7 +5981,7 @@ copy_rtx_unchanging (orig)
copy = rtx_alloc (code);
PUT_MODE (copy, GET_MODE (orig));
- RTX_UNCHANGING_P (copy) = 1;
+ ATTR_IND_SIMPLIFIED_P (copy) = 1;
memcpy (&XEXP (copy, 0), &XEXP (orig, 0),
GET_RTX_LENGTH (GET_CODE (copy)) * sizeof (rtx));
@@ -6082,8 +6055,8 @@ main (argc, argv)
XWINT (true_rtx, 0) = 1;
false_rtx = rtx_alloc (CONST_INT);
XWINT (false_rtx, 0) = 0;
- RTX_UNCHANGING_P (true_rtx) = RTX_UNCHANGING_P (false_rtx) = 1;
- RTX_INTEGRATED_P (true_rtx) = RTX_INTEGRATED_P (false_rtx) = 1;
+ ATTR_IND_SIMPLIFIED_P (true_rtx) = ATTR_IND_SIMPLIFIED_P (false_rtx) = 1;
+ ATTR_PERMANENT_P (true_rtx) = ATTR_PERMANENT_P (false_rtx) = 1;
alternative_name = attr_string ("alternative", strlen ("alternative"));
@@ -6092,6 +6065,7 @@ from the machine description file `md'. */\n\n");
/* Read the machine description. */
+ initiate_automaton_gen (argc, argv);
while (1)
{
int lineno;
@@ -6120,6 +6094,46 @@ from the machine description file `md'. */\n\n");
gen_unit (desc, lineno);
break;
+ case DEFINE_CPU_UNIT:
+ gen_cpu_unit (desc);
+ break;
+
+ case DEFINE_QUERY_CPU_UNIT:
+ gen_query_cpu_unit (desc);
+ break;
+
+ case DEFINE_BYPASS:
+ gen_bypass (desc);
+ break;
+
+ case EXCLUSION_SET:
+ gen_excl_set (desc);
+ break;
+
+ case PRESENCE_SET:
+ gen_presence_set (desc);
+ break;
+
+ case ABSENCE_SET:
+ gen_absence_set (desc);
+ break;
+
+ case DEFINE_AUTOMATON:
+ gen_automaton (desc);
+ break;
+
+ case AUTOMATA_OPTION:
+ gen_automata_option (desc);
+ break;
+
+ case DEFINE_RESERVATION:
+ gen_reserv (desc);
+ break;
+
+ case DEFINE_INSN_RESERVATION:
+ gen_insn_reserv (desc);
+ break;
+
default:
break;
}
@@ -6144,9 +6158,14 @@ from the machine description file `md'. */\n\n");
if (num_delays)
expand_delays ();
- /* Expand DEFINE_FUNCTION_UNIT information into new attributes. */
- if (num_units)
- expand_units ();
+ if (num_units || num_dfa_decls)
+ {
+ /* Expand DEFINE_FUNCTION_UNIT information into new attributes. */
+ expand_units ();
+ /* Build DFA, output some functions and expand DFA information
+ into new attributes. */
+ expand_automata ();
+ }
printf ("#include \"config.h\"\n");
printf ("#include \"system.h\"\n");
@@ -6160,6 +6179,7 @@ from the machine description file `md'. */\n\n");
printf ("#include \"insn-attr.h\"\n");
printf ("#include \"toplev.h\"\n");
printf ("#include \"flags.h\"\n");
+ printf ("#include \"function.h\"\n");
printf ("\n");
printf ("#define operands recog_data.operand\n\n");
@@ -6221,9 +6241,14 @@ from the machine description file `md'. */\n\n");
write_eligible_delay ("annul_false");
}
- /* Write out information about function units. */
- if (num_units)
- write_function_unit_info ();
+ if (num_units || num_dfa_decls)
+ {
+ /* Write out information about function units. */
+ write_function_unit_info ();
+ /* Output code for pipeline hazards recognition based on DFA
+ (deterministic finite state automata. */
+ write_automata ();
+ }
/* Write out constant delay slot info */
write_const_num_delay_slots ();
OpenPOWER on IntegriCloud