Commit f3ffec8e by Per Bothner

tree.c (get_set_constructor_bytes): New function. Replaces ...

(get_set_constructor_words):  ... removed old function.

From-SVN: r8952
parent 4745ddae
...@@ -4109,23 +4109,22 @@ get_set_constructor_bits (init, buffer, bit_size) ...@@ -4109,23 +4109,22 @@ get_set_constructor_bits (init, buffer, bit_size)
} }
/* Expand (the constant part of) a SET_TYPE CONTRUCTOR node. /* Expand (the constant part of) a SET_TYPE CONTRUCTOR node.
The result is placed in BUFFER (which is an array of WD_SIZE The result is placed in BUFFER (which is an array of bytes).
words). TYPE_ALIGN bits are stored in each element of BUFFER.
If the constructor is constant, NULL_TREE is returned. If the constructor is constant, NULL_TREE is returned.
Otherwise, a TREE_LIST of the non-constant elements is emitted. */ Otherwise, a TREE_LIST of the non-constant elements is emitted. */
tree tree
get_set_constructor_words (init, buffer, wd_size) get_set_constructor_bytes (init, buffer, wd_size)
tree init; tree init;
HOST_WIDE_INT *buffer; unsigned char *buffer;
int wd_size; int wd_size;
{ {
int i; int i;
tree vals = TREE_OPERAND (init, 1); tree vals = TREE_OPERAND (init, 1);
int set_word_size = TYPE_ALIGN (TREE_TYPE (init)); int set_word_size = BITS_PER_UNIT;
int bit_size = wd_size * set_word_size; int bit_size = wd_size * set_word_size;
int bit_pos = 0; int bit_pos = 0;
HOST_WIDE_INT *wordp = buffer; unsigned char *bytep = buffer;
char *bit_buffer = (char*)alloca(bit_size); char *bit_buffer = (char*)alloca(bit_size);
tree non_const_bits = get_set_constructor_bits (init, bit_buffer, bit_size); tree non_const_bits = get_set_constructor_bits (init, bit_buffer, bit_size);
...@@ -4137,13 +4136,13 @@ get_set_constructor_words (init, buffer, wd_size) ...@@ -4137,13 +4136,13 @@ get_set_constructor_words (init, buffer, wd_size)
if (bit_buffer[i]) if (bit_buffer[i])
{ {
if (BITS_BIG_ENDIAN) if (BITS_BIG_ENDIAN)
*wordp |= (1 << (set_word_size - 1 - bit_pos)); *bytep |= (1 << (set_word_size - 1 - bit_pos));
else else
*wordp |= 1 << bit_pos; *bytep |= 1 << bit_pos;
} }
bit_pos++; bit_pos++;
if (bit_pos >= set_word_size) if (bit_pos >= set_word_size)
bit_pos = 0, wordp++; bit_pos = 0, bytep++;
} }
return non_const_bits; return non_const_bits;
} }
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