aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorPer Bothner <bothner@gcc.gnu.org>1995-02-14 22:41:25 -0800
committerPer Bothner <bothner@gcc.gnu.org>1995-02-14 22:41:25 -0800
commit474bda6c46cd9bc40c35f8c7220a88f9587aa354 (patch)
treecbbb89df1716f5cad381fe699dc2d404e122403b /gcc
parentb4ee5a7269b4712db5cbd8e71eefad7df5fbec54 (diff)
downloadgcc-474bda6c46cd9bc40c35f8c7220a88f9587aa354.zip
gcc-474bda6c46cd9bc40c35f8c7220a88f9587aa354.tar.gz
gcc-474bda6c46cd9bc40c35f8c7220a88f9587aa354.tar.bz2
varasm.c (const_hash): Add support for SET_TYPE constructors.
* varasm.c (const_hash): Add support for SET_TYPE constructors. (record_constant_1), (copy_constant): Likewise. (output_constant): Likewise. (Also SET_TYPE INTEGER_CSTs.) From-SVN: r8955
Diffstat (limited to 'gcc')
-rw-r--r--gcc/varasm.c41
1 files changed, 41 insertions, 0 deletions
diff --git a/gcc/varasm.c b/gcc/varasm.c
index 9091023..42cde91 100644
--- a/gcc/varasm.c
+++ b/gcc/varasm.c
@@ -2149,6 +2149,12 @@ const_hash (exp)
else if (code == COMPLEX_CST)
return const_hash (TREE_REALPART (exp)) * 5
+ const_hash (TREE_IMAGPART (exp));
+ else if (code == CONSTRUCTOR && TREE_CODE (TREE_TYPE (exp)) == SET_TYPE)
+ {
+ len = int_size_in_bytes (TREE_TYPE (exp));
+ p = (char*) alloca (len);
+ get_set_constructor_bytes (exp, (unsigned char *) p, len);
+ }
else if (code == CONSTRUCTOR)
{
register tree link;
@@ -2274,6 +2280,12 @@ compare_constant_1 (exp, p)
p = compare_constant_1 (TREE_IMAGPART (exp), p);
return p;
}
+ else if (code == CONSTRUCTOR && TREE_CODE (TREE_TYPE (exp)) == SET_TYPE)
+ {
+ len = int_size_in_bytes (TREE_TYPE (exp));
+ strp = (char*) alloca (len);
+ get_set_constructor_bytes (exp, (unsigned char *) strp, len);
+ }
else if (code == CONSTRUCTOR)
{
register tree link;
@@ -2418,6 +2430,16 @@ record_constant_1 (exp)
record_constant_1 (TREE_IMAGPART (exp));
return;
}
+ else if (code == CONSTRUCTOR && TREE_CODE (TREE_TYPE (exp)) == SET_TYPE)
+ {
+ int nbytes = int_size_in_bytes (TREE_TYPE (exp));
+ obstack_grow (&permanent_obstack, &nbytes, sizeof (nbytes));
+ obstack_blank (&permanent_obstack, nbytes);
+ get_set_constructor_bytes (exp,
+ (unsigned char *) permanent_obstack.next_free,
+ nbytes);
+ return;
+ }
else if (code == CONSTRUCTOR)
{
register tree link;
@@ -2573,6 +2595,9 @@ copy_constant (exp)
CONSTRUCTOR_ELTS (copy) = list;
for (tail = list; tail; tail = TREE_CHAIN (tail))
TREE_VALUE (tail) = copy_constant (TREE_VALUE (tail));
+ if (TREE_CODE (TREE_TYPE (exp)) == SET_TYPE)
+ for (tail = list; tail; tail = TREE_CHAIN (tail))
+ TREE_PURPOSE (tail) = copy_constant (TREE_PURPOSE (tail));
return copy;
}
@@ -3489,6 +3514,22 @@ output_constant (exp, size)
else
abort ();
return;
+
+ case SET_TYPE:
+ if (TREE_CODE (exp) == INTEGER_CST)
+ assemble_integer (expand_expr (exp, NULL_RTX,
+ VOIDmode, EXPAND_INITIALIZER),
+ byte_size, 1);
+ else if (TREE_CODE (exp) == CONSTRUCTOR)
+ {
+ unsigned char *buffer = (unsigned char *) alloca (byte_size);
+ if (get_set_constructor_bytes (constructor, buffer, byte_size))
+ abort ();
+ assemble_string (buffer, byte_size);
+ }
+ else
+ error ("unknown set constructor type");
+ return;
}
if (size > 0)