Commit b01896cc by Michael Matz Committed by Michael Matz

genattrtab.c (current_alternative_string): Remove.

        * genattrtab.c (current_alternative_string): Remove.
        (SIMPLIFY_ALTERNATIVE): Ditto.
        (attr_alt_bit_p): Ditto.
        (alternative_name): Make const char *.
        (evaluate_eq_attr): Remove use of above things.
        (simplify_test_exp): Ditto.
        (simplify_test_exp <EQ_ATTR>): Guard for insn_code < 0 .
        (simplify_test_exp <AND>): Correct typo (test 'right' not 'left').

From-SVN: r102765
parent 3f94bdec
2005-08-05 Michael Matz <matz@suse.de>
* genattrtab.c (current_alternative_string): Remove.
(SIMPLIFY_ALTERNATIVE): Ditto.
(attr_alt_bit_p): Ditto.
(alternative_name): Make const char *.
(evaluate_eq_attr): Remove use of above things.
(simplify_test_exp): Ditto.
(simplify_test_exp <EQ_ATTR>): Guard for insn_code < 0 .
(simplify_test_exp <AND>): Correct typo (test 'right' not 'left').
2005-08-04 James E Wilson <wilson@specifix.com> 2005-08-04 James E Wilson <wilson@specifix.com>
* config/ptx4.h, config/sol2.h, config/arm/freebsd.h, * config/ptx4.h, config/sol2.h, config/arm/freebsd.h,
......
...@@ -228,19 +228,13 @@ static int *insn_n_alternatives; ...@@ -228,19 +228,13 @@ static int *insn_n_alternatives;
static int *insn_alternatives; static int *insn_alternatives;
/* If nonzero, assume that the `alternative' attr has this value.
This is the hashed, unique string for the numeral
whose value is chosen alternative. */
static const char *current_alternative_string;
/* Used to simplify expressions. */ /* Used to simplify expressions. */
static rtx true_rtx, false_rtx; static rtx true_rtx, false_rtx;
/* Used to reduce calls to `strcmp' */ /* Used to reduce calls to `strcmp' */
static char *alternative_name; static const char *alternative_name;
static const char *length_str; static const char *length_str;
static const char *delay_type_str; static const char *delay_type_str;
static const char *delay_1_0_str; static const char *delay_1_0_str;
...@@ -262,15 +256,6 @@ int optimize = 0; ...@@ -262,15 +256,6 @@ int optimize = 0;
(ATTR_IND_SIMPLIFIED_P (EXP) || ATTR_CURR_SIMPLIFIED_P (EXP) ? (EXP) \ (ATTR_IND_SIMPLIFIED_P (EXP) || ATTR_CURR_SIMPLIFIED_P (EXP) ? (EXP) \
: simplify_test_exp (EXP, INSN_CODE, INSN_INDEX)) : simplify_test_exp (EXP, INSN_CODE, INSN_INDEX))
/* Simplify (eq_attr ("alternative") ...)
when we are working with a particular alternative. */
#define SIMPLIFY_ALTERNATIVE(EXP) \
if (current_alternative_string \
&& GET_CODE ((EXP)) == EQ_ATTR \
&& XSTR ((EXP), 0) == alternative_name) \
(EXP) = (XSTR ((EXP), 1) == current_alternative_string \
? true_rtx : false_rtx);
#define DEF_ATTR_STRING(S) (attr_string ((S), strlen (S))) #define DEF_ATTR_STRING(S) (attr_string ((S), strlen (S)))
/* These are referenced by rtlanal.c and hence need to be defined somewhere. /* These are referenced by rtlanal.c and hence need to be defined somewhere.
...@@ -352,7 +337,6 @@ static bool attr_alt_subset_of_compl_p (rtx, rtx); ...@@ -352,7 +337,6 @@ static bool attr_alt_subset_of_compl_p (rtx, rtx);
static rtx attr_alt_intersection (rtx, rtx); static rtx attr_alt_intersection (rtx, rtx);
static rtx attr_alt_union (rtx, rtx); static rtx attr_alt_union (rtx, rtx);
static rtx attr_alt_complement (rtx); static rtx attr_alt_complement (rtx);
static bool attr_alt_bit_p (rtx, int);
static rtx mk_attr_alt (int); static rtx mk_attr_alt (int);
#define oballoc(size) obstack_alloc (hash_obstack, size) #define oballoc(size) obstack_alloc (hash_obstack, size)
...@@ -1106,7 +1090,7 @@ check_attr_value (rtx exp, struct attr_desc *attr) ...@@ -1106,7 +1090,7 @@ check_attr_value (rtx exp, struct attr_desc *attr)
} }
/* Given an SET_ATTR_ALTERNATIVE expression, convert to the canonical SET. /* Given an SET_ATTR_ALTERNATIVE expression, convert to the canonical SET.
It becomes a COND with each test being (eq_attr "alternative "n") */ It becomes a COND with each test being (eq_attr "alternative" "n") */
static rtx static rtx
convert_set_attr_alternative (rtx exp, struct insn_def *id) convert_set_attr_alternative (rtx exp, struct insn_def *id)
...@@ -2035,16 +2019,11 @@ evaluate_eq_attr (rtx exp, rtx value, int insn_code, int insn_index) ...@@ -2035,16 +2019,11 @@ evaluate_eq_attr (rtx exp, rtx value, int insn_code, int insn_index)
orexp = false_rtx; orexp = false_rtx;
andexp = true_rtx; andexp = true_rtx;
if (current_alternative_string)
clear_struct_flag (value);
for (i = 0; i < XVECLEN (value, 0); i += 2) for (i = 0; i < XVECLEN (value, 0); i += 2)
{ {
rtx this = simplify_test_exp_in_temp (XVECEXP (value, 0, i), rtx this = simplify_test_exp_in_temp (XVECEXP (value, 0, i),
insn_code, insn_index); insn_code, insn_index);
SIMPLIFY_ALTERNATIVE (this);
right = insert_right_side (AND, andexp, this, right = insert_right_side (AND, andexp, this,
insn_code, insn_index); insn_code, insn_index);
right = insert_right_side (AND, right, right = insert_right_side (AND, right,
...@@ -2082,7 +2061,6 @@ evaluate_eq_attr (rtx exp, rtx value, int insn_code, int insn_index) ...@@ -2082,7 +2061,6 @@ evaluate_eq_attr (rtx exp, rtx value, int insn_code, int insn_index)
if (address_used) if (address_used)
{ {
/* This had `&& current_alternative_string', which seems to be wrong. */
if (! ATTR_IND_SIMPLIFIED_P (exp)) if (! ATTR_IND_SIMPLIFIED_P (exp))
return copy_rtx_unchanging (exp); return copy_rtx_unchanging (exp);
return exp; return exp;
...@@ -2490,14 +2468,6 @@ attr_alt_complement (rtx s) ...@@ -2490,14 +2468,6 @@ attr_alt_complement (rtx s)
return result; return result;
} }
/* Tests whether a bit B belongs to the set represented by S. */
static bool
attr_alt_bit_p (rtx s, int b)
{
return XINT (s, 1) ^ ((XINT (s, 0) >> b) & 1);
}
/* Return EQ_ATTR_ALT expression representing set containing elements set /* Return EQ_ATTR_ALT expression representing set containing elements set
in E. */ in E. */
...@@ -2540,12 +2510,10 @@ simplify_test_exp (rtx exp, int insn_code, int insn_index) ...@@ -2540,12 +2510,10 @@ simplify_test_exp (rtx exp, int insn_code, int insn_index)
{ {
case AND: case AND:
left = SIMPLIFY_TEST_EXP (XEXP (exp, 0), insn_code, insn_index); left = SIMPLIFY_TEST_EXP (XEXP (exp, 0), insn_code, insn_index);
SIMPLIFY_ALTERNATIVE (left);
if (left == false_rtx) if (left == false_rtx)
return false_rtx; return false_rtx;
right = SIMPLIFY_TEST_EXP (XEXP (exp, 1), insn_code, insn_index); right = SIMPLIFY_TEST_EXP (XEXP (exp, 1), insn_code, insn_index);
SIMPLIFY_ALTERNATIVE (right); if (right == false_rtx)
if (left == false_rtx)
return false_rtx; return false_rtx;
if (GET_CODE (left) == EQ_ATTR_ALT if (GET_CODE (left) == EQ_ATTR_ALT
...@@ -2646,11 +2614,9 @@ simplify_test_exp (rtx exp, int insn_code, int insn_index) ...@@ -2646,11 +2614,9 @@ simplify_test_exp (rtx exp, int insn_code, int insn_index)
case IOR: case IOR:
left = SIMPLIFY_TEST_EXP (XEXP (exp, 0), insn_code, insn_index); left = SIMPLIFY_TEST_EXP (XEXP (exp, 0), insn_code, insn_index);
SIMPLIFY_ALTERNATIVE (left);
if (left == true_rtx) if (left == true_rtx)
return true_rtx; return true_rtx;
right = SIMPLIFY_TEST_EXP (XEXP (exp, 1), insn_code, insn_index); right = SIMPLIFY_TEST_EXP (XEXP (exp, 1), insn_code, insn_index);
SIMPLIFY_ALTERNATIVE (right);
if (right == true_rtx) if (right == true_rtx)
return true_rtx; return true_rtx;
...@@ -2744,12 +2710,10 @@ simplify_test_exp (rtx exp, int insn_code, int insn_index) ...@@ -2744,12 +2710,10 @@ simplify_test_exp (rtx exp, int insn_code, int insn_index)
{ {
left = SIMPLIFY_TEST_EXP (XEXP (XEXP (exp, 0), 0), left = SIMPLIFY_TEST_EXP (XEXP (XEXP (exp, 0), 0),
insn_code, insn_index); insn_code, insn_index);
SIMPLIFY_ALTERNATIVE (left);
return left; return left;
} }
left = SIMPLIFY_TEST_EXP (XEXP (exp, 0), insn_code, insn_index); left = SIMPLIFY_TEST_EXP (XEXP (exp, 0), insn_code, insn_index);
SIMPLIFY_ALTERNATIVE (left);
if (GET_CODE (left) == NOT) if (GET_CODE (left) == NOT)
return XEXP (left, 0); return XEXP (left, 0);
...@@ -2788,18 +2752,11 @@ simplify_test_exp (rtx exp, int insn_code, int insn_index) ...@@ -2788,18 +2752,11 @@ simplify_test_exp (rtx exp, int insn_code, int insn_index)
break; break;
case EQ_ATTR_ALT: case EQ_ATTR_ALT:
if (current_alternative_string)
return attr_alt_bit_p (exp, atoi (current_alternative_string)) ? true_rtx : false_rtx;
if (!XINT (exp, 0)) if (!XINT (exp, 0))
return XINT (exp, 1) ? true_rtx : false_rtx; return XINT (exp, 1) ? true_rtx : false_rtx;
break; break;
case EQ_ATTR: case EQ_ATTR:
if (current_alternative_string && XSTR (exp, 0) == alternative_name)
return (XSTR (exp, 1) == current_alternative_string
? true_rtx : false_rtx);
if (XSTR (exp, 0) == alternative_name) if (XSTR (exp, 0) == alternative_name)
{ {
newexp = mk_attr_alt (1 << atoi (XSTR (exp, 1))); newexp = mk_attr_alt (1 << atoi (XSTR (exp, 1)));
...@@ -2809,7 +2766,7 @@ simplify_test_exp (rtx exp, int insn_code, int insn_index) ...@@ -2809,7 +2766,7 @@ simplify_test_exp (rtx exp, int insn_code, int insn_index)
/* Look at the value for this insn code in the specified attribute. /* Look at the value for this insn code in the specified attribute.
We normally can replace this comparison with the condition that We normally can replace this comparison with the condition that
would give this insn the values being tested for. */ would give this insn the values being tested for. */
if (XSTR (exp, 0) != alternative_name if (insn_code >= 0
&& (attr = find_attr (&XSTR (exp, 0), 0)) != NULL) && (attr = find_attr (&XSTR (exp, 0), 0)) != NULL)
for (av = attr->first_value; av; av = av->next) for (av = attr->first_value; av; av = av->next)
for (ie = av->first_insn; ie; ie = ie->next) for (ie = av->first_insn; ie; ie = ie->next)
...@@ -2830,7 +2787,7 @@ simplify_test_exp (rtx exp, int insn_code, int insn_index) ...@@ -2830,7 +2787,7 @@ simplify_test_exp (rtx exp, int insn_code, int insn_index)
/* We have already simplified this expression. Simplifying it again /* We have already simplified this expression. Simplifying it again
won't buy anything unless we weren't given a valid insn code won't buy anything unless we weren't given a valid insn code
to process (i.e., we are canonicalizing something.). */ to process (i.e., we are canonicalizing something.). */
if (insn_code != -2 /* Seems wrong: && current_alternative_string. */ if (insn_code != -2
&& ! ATTR_IND_SIMPLIFIED_P (newexp)) && ! ATTR_IND_SIMPLIFIED_P (newexp))
return copy_rtx_unchanging (newexp); return copy_rtx_unchanging (newexp);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment