diff options
Diffstat (limited to 'gcc/varasm.c')
-rw-r--r-- | gcc/varasm.c | 135 |
1 files changed, 71 insertions, 64 deletions
diff --git a/gcc/varasm.c b/gcc/varasm.c index 1e6a8ae..28165a5 100644 --- a/gcc/varasm.c +++ b/gcc/varasm.c @@ -3554,17 +3554,20 @@ bc_assemble_integer (exp, size) } else if (size == 8) { -#if WORDS_BIG_ENDIAN - int i = TREE_INT_CST_HIGH (const_part); - bc_emit ((char *) &i, 4); - i = TREE_INT_CST_LOW (const_part); - bc_emit ((char *) &i, 4); -#else - int i = TREE_INT_CST_LOW (const_part); - bc_emit ((char *) &i, 4); - i = TREE_INT_CST_HIGH (const_part); - bc_emit ((char *) &i, 4); -#endif + if (WORDS_BIG_ENDIAN) + { + int i = TREE_INT_CST_HIGH (const_part); + bc_emit ((char *) &i, 4); + i = TREE_INT_CST_LOW (const_part); + bc_emit ((char *) &i, 4); + } + else + { + int i = TREE_INT_CST_LOW (const_part); + bc_emit ((char *) &i, 4); + i = TREE_INT_CST_HIGH (const_part); + bc_emit ((char *) &i, 4); + } size -= 8; } } @@ -3767,64 +3770,68 @@ output_constructor (exp, size) (all part of the same byte). */ this_time = MIN (end_offset - next_offset, BITS_PER_UNIT - next_bit); -#if BYTES_BIG_ENDIAN - /* On big-endian machine, take the most significant bits - first (of the bits that are significant) - and put them into bytes from the most significant end. */ - shift = end_offset - next_offset - this_time; - /* Don't try to take a bunch of bits that cross - the word boundary in the INTEGER_CST. */ - if (shift < HOST_BITS_PER_WIDE_INT - && shift + this_time > HOST_BITS_PER_WIDE_INT) + if (BYTES_BIG_ENDIAN) { - this_time -= (HOST_BITS_PER_WIDE_INT - shift); - shift = HOST_BITS_PER_WIDE_INT; - } - - /* Now get the bits from the appropriate constant word. */ - if (shift < HOST_BITS_PER_WIDE_INT) - { - value = TREE_INT_CST_LOW (val); - } - else if (shift < 2 * HOST_BITS_PER_WIDE_INT) - { - value = TREE_INT_CST_HIGH (val); - shift -= HOST_BITS_PER_WIDE_INT; + /* On big-endian machine, take the most significant bits + first (of the bits that are significant) + and put them into bytes from the most significant end. */ + shift = end_offset - next_offset - this_time; + /* Don't try to take a bunch of bits that cross + the word boundary in the INTEGER_CST. */ + if (shift < HOST_BITS_PER_WIDE_INT + && shift + this_time > HOST_BITS_PER_WIDE_INT) + { + this_time -= (HOST_BITS_PER_WIDE_INT - shift); + shift = HOST_BITS_PER_WIDE_INT; + } + + /* Now get the bits from the appropriate constant word. */ + if (shift < HOST_BITS_PER_WIDE_INT) + { + value = TREE_INT_CST_LOW (val); + } + else if (shift < 2 * HOST_BITS_PER_WIDE_INT) + { + value = TREE_INT_CST_HIGH (val); + shift -= HOST_BITS_PER_WIDE_INT; + } + else + abort (); + byte |= (((value >> shift) + & (((HOST_WIDE_INT) 1 << this_time) - 1)) + << (BITS_PER_UNIT - this_time - next_bit)); } else - abort (); - byte |= (((value >> shift) - & (((HOST_WIDE_INT) 1 << this_time) - 1)) - << (BITS_PER_UNIT - this_time - next_bit)); -#else - /* On little-endian machines, - take first the least significant bits of the value - and pack them starting at the least significant - bits of the bytes. */ - shift = (next_offset - - TREE_INT_CST_LOW (DECL_FIELD_BITPOS (field))); - /* Don't try to take a bunch of bits that cross - the word boundary in the INTEGER_CST. */ - if (shift < HOST_BITS_PER_WIDE_INT - && shift + this_time > HOST_BITS_PER_WIDE_INT) { - this_time -= (HOST_BITS_PER_WIDE_INT - shift); - shift = HOST_BITS_PER_WIDE_INT; + /* On little-endian machines, + take first the least significant bits of the value + and pack them starting at the least significant + bits of the bytes. */ + shift = (next_offset + - TREE_INT_CST_LOW (DECL_FIELD_BITPOS (field))); + /* Don't try to take a bunch of bits that cross + the word boundary in the INTEGER_CST. */ + if (shift < HOST_BITS_PER_WIDE_INT + && shift + this_time > HOST_BITS_PER_WIDE_INT) + { + this_time -= (HOST_BITS_PER_WIDE_INT - shift); + shift = HOST_BITS_PER_WIDE_INT; + } + + /* Now get the bits from the appropriate constant word. */ + if (shift < HOST_BITS_PER_INT) + value = TREE_INT_CST_LOW (val); + else if (shift < 2 * HOST_BITS_PER_WIDE_INT) + { + value = TREE_INT_CST_HIGH (val); + shift -= HOST_BITS_PER_WIDE_INT; + } + else + abort (); + byte |= (((value >> shift) + & (((HOST_WIDE_INT) 1 << this_time) - 1)) + << next_bit); } - - /* Now get the bits from the appropriate constant word. */ - if (shift < HOST_BITS_PER_INT) - value = TREE_INT_CST_LOW (val); - else if (shift < 2 * HOST_BITS_PER_WIDE_INT) - { - value = TREE_INT_CST_HIGH (val); - shift -= HOST_BITS_PER_WIDE_INT; - } - else - abort (); - byte |= ((value >> shift) - & (((HOST_WIDE_INT) 1 << this_time) - 1)) << next_bit; -#endif next_offset += this_time; byte_buffer_in_use = 1; } |