Commit 5839708b by Richard Sandiford Committed by Richard Sandiford

genattrtab.c (check_attr_value): Remove handling of null attrs.

gcc/
	* genattrtab.c (check_attr_value): Remove handling of null attrs.
	(make_canonical): Likewise.

From-SVN: r225875
parent ce967e93
2015-07-16 Richard Sandiford <richard.sandiford@arm.com>
* genattrtab.c (check_attr_value): Remove handling of null attrs.
(make_canonical): Likewise.
2015-07-16 Eric Botcazou <ebotcazou@adacore.com> 2015-07-16 Eric Botcazou <ebotcazou@adacore.com>
* config/sparc/sparc.md (save_stack_nonlocal): Use adjust_address * config/sparc/sparc.md (save_stack_nonlocal): Use adjust_address
......
...@@ -899,7 +899,7 @@ check_attr_test (rtx exp, int is_const, int lineno) ...@@ -899,7 +899,7 @@ check_attr_test (rtx exp, int is_const, int lineno)
/* Given an expression, ensure that it is validly formed and that all named /* Given an expression, ensure that it is validly formed and that all named
attribute values are valid for the given attribute. Issue a fatal error attribute values are valid for the given attribute. Issue a fatal error
if not. If no attribute is specified, assume a numeric attribute. if not.
Return a perhaps modified replacement expression for the value. */ Return a perhaps modified replacement expression for the value. */
...@@ -913,7 +913,7 @@ check_attr_value (rtx exp, struct attr_desc *attr) ...@@ -913,7 +913,7 @@ check_attr_value (rtx exp, struct attr_desc *attr)
switch (GET_CODE (exp)) switch (GET_CODE (exp))
{ {
case CONST_INT: case CONST_INT:
if (attr && ! attr->is_numeric) if (!attr->is_numeric)
{ {
error_with_line (attr->lineno, error_with_line (attr->lineno,
"CONST_INT not valid for non-numeric attribute %s", "CONST_INT not valid for non-numeric attribute %s",
...@@ -934,15 +934,15 @@ check_attr_value (rtx exp, struct attr_desc *attr) ...@@ -934,15 +934,15 @@ check_attr_value (rtx exp, struct attr_desc *attr)
if (! strcmp (XSTR (exp, 0), "*")) if (! strcmp (XSTR (exp, 0), "*"))
break; break;
if (attr == 0 || attr->is_numeric) if (attr->is_numeric)
{ {
p = XSTR (exp, 0); p = XSTR (exp, 0);
for (; *p; p++) for (; *p; p++)
if (! ISDIGIT (*p)) if (! ISDIGIT (*p))
{ {
error_with_line (attr ? attr->lineno : 0, error_with_line (attr->lineno,
"non-numeric value for numeric attribute %s", "non-numeric value for numeric attribute %s",
attr ? attr->name : "internal"); attr->name);
break; break;
} }
break; break;
...@@ -956,13 +956,12 @@ check_attr_value (rtx exp, struct attr_desc *attr) ...@@ -956,13 +956,12 @@ check_attr_value (rtx exp, struct attr_desc *attr)
if (av == NULL) if (av == NULL)
error_with_line (attr->lineno, error_with_line (attr->lineno,
"unknown value `%s' for `%s' attribute", "unknown value `%s' for `%s' attribute",
XSTR (exp, 0), attr ? attr->name : "internal"); XSTR (exp, 0), attr->name);
break; break;
case IF_THEN_ELSE: case IF_THEN_ELSE:
XEXP (exp, 0) = check_attr_test (XEXP (exp, 0), XEXP (exp, 0) = check_attr_test (XEXP (exp, 0), attr->is_const,
attr ? attr->is_const : 0, attr->lineno);
attr ? attr->lineno : 0);
XEXP (exp, 1) = check_attr_value (XEXP (exp, 1), attr); XEXP (exp, 1) = check_attr_value (XEXP (exp, 1), attr);
XEXP (exp, 2) = check_attr_value (XEXP (exp, 2), attr); XEXP (exp, 2) = check_attr_value (XEXP (exp, 2), attr);
break; break;
...@@ -972,7 +971,7 @@ check_attr_value (rtx exp, struct attr_desc *attr) ...@@ -972,7 +971,7 @@ check_attr_value (rtx exp, struct attr_desc *attr)
case MULT: case MULT:
case DIV: case DIV:
case MOD: case MOD:
if (attr && !attr->is_numeric) if (!attr->is_numeric)
{ {
error_with_line (attr->lineno, error_with_line (attr->lineno,
"invalid operation `%s' for non-numeric" "invalid operation `%s' for non-numeric"
...@@ -1007,8 +1006,8 @@ check_attr_value (rtx exp, struct attr_desc *attr) ...@@ -1007,8 +1006,8 @@ check_attr_value (rtx exp, struct attr_desc *attr)
for (i = 0; i < XVECLEN (exp, 0); i += 2) for (i = 0; i < XVECLEN (exp, 0); i += 2)
{ {
XVECEXP (exp, 0, i) = check_attr_test (XVECEXP (exp, 0, i), XVECEXP (exp, 0, i) = check_attr_test (XVECEXP (exp, 0, i),
attr ? attr->is_const : 0, attr->is_const,
attr ? attr->lineno : 0); attr->lineno);
XVECEXP (exp, 0, i + 1) XVECEXP (exp, 0, i + 1)
= check_attr_value (XVECEXP (exp, 0, i + 1), attr); = check_attr_value (XVECEXP (exp, 0, i + 1), attr);
} }
...@@ -1020,15 +1019,13 @@ check_attr_value (rtx exp, struct attr_desc *attr) ...@@ -1020,15 +1019,13 @@ check_attr_value (rtx exp, struct attr_desc *attr)
{ {
struct attr_desc *attr2 = find_attr (&XSTR (exp, 0), 0); struct attr_desc *attr2 = find_attr (&XSTR (exp, 0), 0);
if (attr2 == NULL) if (attr2 == NULL)
error_with_line (attr ? attr->lineno : 0, error_with_line (attr->lineno, "unknown attribute `%s' in ATTR",
"unknown attribute `%s' in ATTR",
XSTR (exp, 0)); XSTR (exp, 0));
else if (attr && attr->is_const && ! attr2->is_const) else if (attr->is_const && ! attr2->is_const)
error_with_line (attr->lineno, error_with_line (attr->lineno,
"non-constant attribute `%s' referenced from `%s'", "non-constant attribute `%s' referenced from `%s'",
XSTR (exp, 0), attr->name); XSTR (exp, 0), attr->name);
else if (attr else if (attr->is_numeric != attr2->is_numeric)
&& attr->is_numeric != attr2->is_numeric)
error_with_line (attr->lineno, error_with_line (attr->lineno,
"numeric attribute mismatch calling `%s' from `%s'", "numeric attribute mismatch calling `%s' from `%s'",
XSTR (exp, 0), attr->name); XSTR (exp, 0), attr->name);
...@@ -1042,7 +1039,7 @@ check_attr_value (rtx exp, struct attr_desc *attr) ...@@ -1042,7 +1039,7 @@ check_attr_value (rtx exp, struct attr_desc *attr)
return attr_rtx (SYMBOL_REF, XSTR (exp, 0)); return attr_rtx (SYMBOL_REF, XSTR (exp, 0));
default: default:
error_with_line (attr ? attr->lineno : 0, error_with_line (attr->lineno,
"invalid operation `%s' for attribute value", "invalid operation `%s' for attribute value",
GET_RTX_NAME (GET_CODE (exp))); GET_RTX_NAME (GET_CODE (exp)));
break; break;
...@@ -1199,7 +1196,7 @@ make_canonical (struct attr_desc *attr, rtx exp) ...@@ -1199,7 +1196,7 @@ make_canonical (struct attr_desc *attr, rtx exp)
case CONST_STRING: case CONST_STRING:
if (! strcmp (XSTR (exp, 0), "*")) if (! strcmp (XSTR (exp, 0), "*"))
{ {
if (attr == 0 || attr->default_val == 0) if (attr->default_val == 0)
fatal ("(attr_value \"*\") used in invalid context"); fatal ("(attr_value \"*\") used in invalid context");
exp = attr->default_val->value; exp = attr->default_val->value;
} }
......
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