Commit 2871d24f by Richard Kenner

(record_constant_1): Handle NON_LVALUE_EXPR.

Rewrite to use switch instead of if/then/elseif/else.

From-SVN: r9141
parent 9040d873
...@@ -2403,44 +2403,46 @@ record_constant_1 (exp) ...@@ -2403,44 +2403,46 @@ record_constant_1 (exp)
obstack_1grow (&permanent_obstack, (unsigned int) code); obstack_1grow (&permanent_obstack, (unsigned int) code);
if (code == INTEGER_CST) switch (code)
{ {
case INTEGER_CST:
obstack_1grow (&permanent_obstack, TYPE_PRECISION (TREE_TYPE (exp))); obstack_1grow (&permanent_obstack, TYPE_PRECISION (TREE_TYPE (exp)));
strp = (char *) &TREE_INT_CST_LOW (exp); strp = (char *) &TREE_INT_CST_LOW (exp);
len = 2 * sizeof TREE_INT_CST_LOW (exp); len = 2 * sizeof TREE_INT_CST_LOW (exp);
} break;
else if (code == REAL_CST)
{ case REAL_CST:
obstack_1grow (&permanent_obstack, TYPE_PRECISION (TREE_TYPE (exp))); obstack_1grow (&permanent_obstack, TYPE_PRECISION (TREE_TYPE (exp)));
strp = (char *) &TREE_REAL_CST (exp); strp = (char *) &TREE_REAL_CST (exp);
len = sizeof TREE_REAL_CST (exp); len = sizeof TREE_REAL_CST (exp);
} break;
else if (code == STRING_CST)
{ case STRING_CST:
if (flag_writable_strings) if (flag_writable_strings)
return; return;
strp = TREE_STRING_POINTER (exp); strp = TREE_STRING_POINTER (exp);
len = TREE_STRING_LENGTH (exp); len = TREE_STRING_LENGTH (exp);
obstack_grow (&permanent_obstack, (char *) &TREE_STRING_LENGTH (exp), obstack_grow (&permanent_obstack, (char *) &TREE_STRING_LENGTH (exp),
sizeof TREE_STRING_LENGTH (exp)); sizeof TREE_STRING_LENGTH (exp));
} break;
else if (code == COMPLEX_CST)
{ case COMPLEX_CST:
record_constant_1 (TREE_REALPART (exp)); record_constant_1 (TREE_REALPART (exp));
record_constant_1 (TREE_IMAGPART (exp)); record_constant_1 (TREE_IMAGPART (exp));
return; return;
}
else if (code == CONSTRUCTOR && TREE_CODE (TREE_TYPE (exp)) == SET_TYPE) case CONSTRUCTOR:
if (TREE_CODE (TREE_TYPE (exp)) == SET_TYPE)
{ {
int nbytes = int_size_in_bytes (TREE_TYPE (exp)); int nbytes = int_size_in_bytes (TREE_TYPE (exp));
obstack_grow (&permanent_obstack, &nbytes, sizeof (nbytes)); obstack_grow (&permanent_obstack, &nbytes, sizeof (nbytes));
obstack_blank (&permanent_obstack, nbytes); obstack_blank (&permanent_obstack, nbytes);
get_set_constructor_bytes (exp, get_set_constructor_bytes
(unsigned char *) permanent_obstack.next_free, (exp, (unsigned char *) permanent_obstack.next_free, nbytes);
nbytes);
return; return;
} }
else if (code == CONSTRUCTOR) else
{ {
register tree link; register tree link;
int length = list_length (CONSTRUCTOR_ELTS (exp)); int length = list_length (CONSTRUCTOR_ELTS (exp));
...@@ -2471,15 +2473,17 @@ record_constant_1 (exp) ...@@ -2471,15 +2473,17 @@ record_constant_1 (exp)
{ {
tree zero = 0; tree zero = 0;
obstack_grow (&permanent_obstack, (char *) &zero, sizeof zero); obstack_grow (&permanent_obstack,
(char *) &zero, sizeof zero);
} }
} }
return;
} }
else if (code == ADDR_EXPR) return;
case ADDR_EXPR:
{ {
struct addr_const value; struct addr_const value;
decode_addr_const (exp, &value); decode_addr_const (exp, &value);
/* Record the offset. */ /* Record the offset. */
obstack_grow (&permanent_obstack, obstack_grow (&permanent_obstack,
...@@ -2487,18 +2491,23 @@ record_constant_1 (exp) ...@@ -2487,18 +2491,23 @@ record_constant_1 (exp)
/* Record the symbol name. */ /* Record the symbol name. */
obstack_grow (&permanent_obstack, XSTR (value.base, 0), obstack_grow (&permanent_obstack, XSTR (value.base, 0),
strlen (XSTR (value.base, 0)) + 1); strlen (XSTR (value.base, 0)) + 1);
return;
} }
else if (code == PLUS_EXPR || code == MINUS_EXPR) return;
{
case PLUS_EXPR:
case MINUS_EXPR:
record_constant_1 (TREE_OPERAND (exp, 0)); record_constant_1 (TREE_OPERAND (exp, 0));
record_constant_1 (TREE_OPERAND (exp, 1)); record_constant_1 (TREE_OPERAND (exp, 1));
return; return;
}
else if (code == NOP_EXPR || code == CONVERT_EXPR) case NOP_EXPR:
{ case CONVERT_EXPR:
case NON_LVALUE_EXPR:
record_constant_1 (TREE_OPERAND (exp, 0)); record_constant_1 (TREE_OPERAND (exp, 0));
return; return;
default:
abort ();
} }
/* Record constant contents. */ /* Record constant contents. */
......
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