replace BITS_PER_UNIT with __CHAR_BIT__ in target libs

libgcc/ChangeLog:

2015-11-07  Trevor Saunders  <tbsaunde+gcc@tbsaunde.org>

	* config/visium/lib2funcs.c (__set_trampoline_parity): Use
	__CHAR_BIT__ instead of BITS_PER_UNIT.
	* fixed-bit.h: Likewise.
	* fp-bit.h: Likewise.
	* libgcc2.c (__popcountSI2): Likewise.
	(__popcountDI2): Likewise.
	* libgcc2.h: Likewise.
	* libgcov.h: Likewise.

libobjc/ChangeLog:

2015-11-07  Trevor Saunders  <tbsaunde+gcc@tbsaunde.org>

	PR libobjc/24775
	* encoding.c (_darwin_rs6000_special_round_type_align): Use
	__CHAR_BIT__ instead of BITS_PER_UNIT.
	(objc_sizeof_type): Likewise.
	(objc_layout_structure): Likewise.
	(objc_layout_structure_next_member): Likewise.
	(objc_layout_finish_structure): Likewise.
	(objc_layout_structure_get_info): Likewise.

From-SVN: r229936
This commit is contained in:
Trevor Saunders 2015-11-07 19:36:26 +00:00 committed by Trevor Saunders
parent 3dee689d8f
commit a153644f75
9 changed files with 64 additions and 45 deletions

View File

@ -1,3 +1,14 @@
2015-11-07 Trevor Saunders <tbsaunde+gcc@tbsaunde.org>
* config/visium/lib2funcs.c (__set_trampoline_parity): Use
__CHAR_BIT__ instead of BITS_PER_UNIT.
* fixed-bit.h: Likewise.
* fp-bit.h: Likewise.
* libgcc2.c (__popcountSI2): Likewise.
(__popcountDI2): Likewise.
* libgcc2.h: Likewise.
* libgcov.h: Likewise.
2015-11-07 David Edelsohn <dje.gcc@gmail.com>
* config/rs6000/atexit.c: New file.

View File

@ -315,7 +315,7 @@ __set_trampoline_parity (UWtype *addr)
{
int i;
for (i = 0; i < (TRAMPOLINE_SIZE * BITS_PER_UNIT) / W_TYPE_SIZE; i++)
for (i = 0; i < (TRAMPOLINE_SIZE * __CHAR_BIT__) / W_TYPE_SIZE; i++)
addr[i] |= parity_bit (addr[i]);
}
#endif

View File

@ -434,7 +434,7 @@ typedef union
} INTunion;
#endif
#define FIXED_WIDTH (FIXED_SIZE * BITS_PER_UNIT) /* in bits. */
#define FIXED_WIDTH (FIXED_SIZE * __CHAR_BIT__) /* in bits. */
#define FIXED_C_TYPE1(NAME) NAME ## type
#define FIXED_C_TYPE2(NAME) FIXED_C_TYPE1(NAME)
#define FIXED_C_TYPE FIXED_C_TYPE2(MODE_NAME)
@ -1108,17 +1108,17 @@ extern FIXED_C_TYPE FIXED_USASHL (FIXED_C_TYPE, word_type);
#if defined (FROM_MODE_NAME_S) && defined (TO_MODE_NAME_S)
#if FROM_TYPE == 1 /* Signed integer. */
#define FROM_INT_WIDTH (FROM_INT_SIZE * BITS_PER_UNIT)
#define FROM_INT_WIDTH (FROM_INT_SIZE * __CHAR_BIT__)
#endif
#if FROM_TYPE == 2 /* Unsigned integer. */
#define FROM_INT_WIDTH (FROM_INT_SIZE * BITS_PER_UNIT)
#define FROM_INT_WIDTH (FROM_INT_SIZE * __CHAR_BIT__)
#endif
#if FROM_TYPE == 4 /* Fixed-point. */
#define FROM_FIXED_C_TYPE FIXED_C_TYPE2(FROM_MODE_NAME)
#define FROM_FBITS FBITS2(FROM_MODE_NAME)
#define FROM_FIXED_WIDTH (FROM_FIXED_SIZE * BITS_PER_UNIT)
#define FROM_FIXED_WIDTH (FROM_FIXED_SIZE * __CHAR_BIT__)
#define FROM_FBITS FBITS2(FROM_MODE_NAME)
#define FROM_IBITS IBITS2(FROM_MODE_NAME)
#define FROM_I_F_BITS (FROM_FBITS + FROM_IBITS)
@ -1136,7 +1136,7 @@ extern FIXED_C_TYPE FIXED_USASHL (FIXED_C_TYPE, word_type);
#if TO_TYPE == 4 /* Fixed-point. */
#define TO_FIXED_C_TYPE FIXED_C_TYPE2(TO_MODE_NAME)
#define TO_FBITS FBITS2(TO_MODE_NAME)
#define TO_FIXED_WIDTH (TO_FIXED_SIZE * BITS_PER_UNIT)
#define TO_FIXED_WIDTH (TO_FIXED_SIZE * __CHAR_BIT__)
#define TO_FBITS FBITS2(TO_MODE_NAME)
#define TO_IBITS IBITS2(TO_MODE_NAME)
#define TO_I_F_BITS (TO_FBITS + TO_IBITS)

View File

@ -117,11 +117,11 @@ typedef unsigned int UTItype __attribute__ ((mode (TI)));
#define MAX_USI_INT (~(USItype)0)
#define MAX_SI_INT ((SItype) (MAX_USI_INT >> 1))
#define BITS_PER_SI (4 * BITS_PER_UNIT)
#define BITS_PER_SI (4 * __CHAR_BIT__)
#ifdef TMODES
#define MAX_UDI_INT (~(UDItype)0)
#define MAX_DI_INT ((DItype) (MAX_UDI_INT >> 1))
#define BITS_PER_DI (8 * BITS_PER_UNIT)
#define BITS_PER_DI (8 * __CHAR_BIT__)
#endif
#ifdef FLOAT_ONLY

View File

@ -160,7 +160,7 @@ __mulvSI3 (Wtype a, Wtype b)
}
#ifdef COMPAT_SIMODE_TRAPPING_ARITHMETIC
#undef WORD_SIZE
#define WORD_SIZE (sizeof (SItype) * BITS_PER_UNIT)
#define WORD_SIZE (sizeof (SItype) * __CHAR_BIT__)
SItype
__mulvsi3 (SItype a, SItype b)
{
@ -820,16 +820,16 @@ const UQItype __popcount_tab[256] =
#endif
#if defined(L_popcountsi2) || defined(L_popcountdi2)
#define POPCOUNTCST2(x) (((UWtype) x << BITS_PER_UNIT) | x)
#define POPCOUNTCST4(x) (((UWtype) x << (2 * BITS_PER_UNIT)) | x)
#define POPCOUNTCST8(x) (((UWtype) x << (4 * BITS_PER_UNIT)) | x)
#if W_TYPE_SIZE == BITS_PER_UNIT
#define POPCOUNTCST2(x) (((UWtype) x << __CHAR_BIT__) | x)
#define POPCOUNTCST4(x) (((UWtype) x << (2 * __CHAR_BIT__)) | x)
#define POPCOUNTCST8(x) (((UWtype) x << (4 * __CHAR_BIT__)) | x)
#if W_TYPE_SIZE == __CHAR_BIT__
#define POPCOUNTCST(x) x
#elif W_TYPE_SIZE == 2 * BITS_PER_UNIT
#elif W_TYPE_SIZE == 2 * __CHAR_BIT__
#define POPCOUNTCST(x) POPCOUNTCST2 (x)
#elif W_TYPE_SIZE == 4 * BITS_PER_UNIT
#elif W_TYPE_SIZE == 4 * __CHAR_BIT__
#define POPCOUNTCST(x) POPCOUNTCST4 (POPCOUNTCST2 (x))
#elif W_TYPE_SIZE == 8 * BITS_PER_UNIT
#elif W_TYPE_SIZE == 8 * __CHAR_BIT__
#define POPCOUNTCST(x) POPCOUNTCST8 (POPCOUNTCST4 (POPCOUNTCST2 (x)))
#endif
#endif
@ -842,11 +842,11 @@ __popcountSI2 (UWtype x)
/* Force table lookup on targets like AVR and RL78 which only
pretend they have LIBGCC2_UNITS_PER_WORD 4, but actually
have 1, and other small word targets. */
#if __SIZEOF_INT__ > 2 && defined (POPCOUNTCST) && BITS_PER_UNIT == 8
#if __SIZEOF_INT__ > 2 && defined (POPCOUNTCST) && __CHAR_BIT__ == 8
x = x - ((x >> 1) & POPCOUNTCST (0x55));
x = (x & POPCOUNTCST (0x33)) + ((x >> 2) & POPCOUNTCST (0x33));
x = (x + (x >> 4)) & POPCOUNTCST (0x0F);
return (x * POPCOUNTCST (0x01)) >> (W_TYPE_SIZE - BITS_PER_UNIT);
return (x * POPCOUNTCST (0x01)) >> (W_TYPE_SIZE - __CHAR_BIT__);
#else
int i, ret = 0;
@ -866,7 +866,7 @@ __popcountDI2 (UDWtype x)
/* Force table lookup on targets like AVR and RL78 which only
pretend they have LIBGCC2_UNITS_PER_WORD 4, but actually
have 1, and other small word targets. */
#if __SIZEOF_INT__ > 2 && defined (POPCOUNTCST) && BITS_PER_UNIT == 8
#if __SIZEOF_INT__ > 2 && defined (POPCOUNTCST) && __CHAR_BIT__ == 8
const DWunion uu = {.ll = x};
UWtype x1 = uu.s.low, x2 = uu.s.high;
x1 = x1 - ((x1 >> 1) & POPCOUNTCST (0x55));
@ -876,7 +876,7 @@ __popcountDI2 (UDWtype x)
x1 = (x1 + (x1 >> 4)) & POPCOUNTCST (0x0F);
x2 = (x2 + (x2 >> 4)) & POPCOUNTCST (0x0F);
x1 += x2;
return (x1 * POPCOUNTCST (0x01)) >> (W_TYPE_SIZE - BITS_PER_UNIT);
return (x1 * POPCOUNTCST (0x01)) >> (W_TYPE_SIZE - __CHAR_BIT__);
#else
int i, ret = 0;

View File

@ -178,7 +178,7 @@ typedef int shift_count_type __attribute__((mode (__libgcc_shift_count__)));
if it existed. */
#if LIBGCC2_UNITS_PER_WORD == 8
#define W_TYPE_SIZE (8 * BITS_PER_UNIT)
#define W_TYPE_SIZE (8 * __CHAR_BIT__)
#define Wtype DItype
#define UWtype UDItype
#define HWtype DItype
@ -194,7 +194,7 @@ typedef int shift_count_type __attribute__((mode (__libgcc_shift_count__)));
#endif
#define COMPAT_SIMODE_TRAPPING_ARITHMETIC
#elif LIBGCC2_UNITS_PER_WORD == 4
#define W_TYPE_SIZE (4 * BITS_PER_UNIT)
#define W_TYPE_SIZE (4 * __CHAR_BIT__)
#define Wtype SItype
#define UWtype USItype
#define HWtype SItype
@ -209,7 +209,7 @@ typedef int shift_count_type __attribute__((mode (__libgcc_shift_count__)));
#define __NDW(a,b) __ ## a ## di ## b
#endif
#elif LIBGCC2_UNITS_PER_WORD == 2
#define W_TYPE_SIZE (2 * BITS_PER_UNIT)
#define W_TYPE_SIZE (2 * __CHAR_BIT__)
#define Wtype HItype
#define UWtype UHItype
#define HWtype HItype
@ -224,7 +224,7 @@ typedef int shift_count_type __attribute__((mode (__libgcc_shift_count__)));
#define __NDW(a,b) __ ## a ## si ## b
#endif
#else
#define W_TYPE_SIZE BITS_PER_UNIT
#define W_TYPE_SIZE __CHAR_BIT__
#define Wtype QItype
#define UWtype UQItype
#define HWtype QItype

View File

@ -43,7 +43,7 @@
#include "tm.h"
#include "libgcc_tm.h"
#if BITS_PER_UNIT == 8
#if __CHAR_BIT__ == 8
typedef unsigned gcov_unsigned_t __attribute__ ((mode (SI)));
typedef unsigned gcov_position_t __attribute__ ((mode (SI)));
#if LONG_LONG_TYPE_SIZE > 32
@ -54,7 +54,7 @@ typedef signed gcov_type __attribute__ ((mode (SI)));
typedef unsigned gcov_type_unsigned __attribute__ ((mode (SI)));
#endif
#else
#if BITS_PER_UNIT == 16
#if __CHAR_BIT__ == 16
typedef unsigned gcov_unsigned_t __attribute__ ((mode (HI)));
typedef unsigned gcov_position_t __attribute__ ((mode (HI)));
#if LONG_LONG_TYPE_SIZE > 32

View File

@ -1,3 +1,14 @@
2015-11-07 Trevor Saunders <tbsaunde+gcc@tbsaunde.org>
PR libobjc/24775
* encoding.c (_darwin_rs6000_special_round_type_align): Use
__CHAR_BIT__ instead of BITS_PER_UNIT.
(objc_sizeof_type): Likewise.
(objc_layout_structure): Likewise.
(objc_layout_structure_next_member): Likewise.
(objc_layout_finish_structure): Likewise.
(objc_layout_structure_get_info): Likewise.
2015-11-03 Trevor Saunders <tbsaunde+gcc@tbsaunde.org>
PR libobjc/24775

View File

@ -94,11 +94,8 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
/* Some ports (eg ARM) allow the structure size boundary to be
selected at compile-time. We override the normal definition with
one that has a constant value for this compilation. */
#ifndef BITS_PER_UNIT
#define BITS_PER_UNIT 8
#endif
#undef STRUCTURE_SIZE_BOUNDARY
#define STRUCTURE_SIZE_BOUNDARY (BITS_PER_UNIT * sizeof (struct{char a;}))
#define STRUCTURE_SIZE_BOUNDARY (__CHAR_BIT__ * sizeof (struct{char a;}))
/* Some ROUND_TYPE_ALIGN macros use TARGET_foo, and consequently
target_flags. Define a dummy entry here to so we don't die.
@ -163,7 +160,7 @@ _darwin_rs6000_special_round_type_align (const char *struc, int comp, int spec)
{
case RECORD_TYPE:
case UNION_TYPE:
return MAX (MAX (comp, spec), objc_alignof_type (_stp) * BITS_PER_UNIT);
return MAX (MAX (comp, spec), objc_alignof_type (_stp) * __CHAR_BIT__);
break;
case DFmode:
case _C_LNG_LNG:
@ -335,8 +332,8 @@ objc_sizeof_type (const char *type)
;
size = atoi (type + 1);
startByte = position / BITS_PER_UNIT;
endByte = (position + size) / BITS_PER_UNIT;
startByte = position / __CHAR_BIT__;
endByte = (position + size) / __CHAR_BIT__;
return endByte - startByte;
}
@ -1093,7 +1090,7 @@ objc_layout_structure (const char *type,
layout->type = type;
layout->prev_type = NULL;
layout->record_size = 0;
layout->record_align = BITS_PER_UNIT;
layout->record_align = __CHAR_BIT__;
layout->record_align = MAX (layout->record_align, STRUCTURE_SIZE_BOUNDARY);
}
@ -1117,10 +1114,10 @@ objc_layout_structure_next_member (struct objc_struct_layout *layout)
type = objc_skip_type_qualifiers (layout->prev_type);
if (unionp)
layout->record_size = MAX (layout->record_size,
objc_sizeof_type (type) * BITS_PER_UNIT);
objc_sizeof_type (type) * __CHAR_BIT__);
else if (*type != _C_BFLD)
layout->record_size += objc_sizeof_type (type) * BITS_PER_UNIT;
layout->record_size += objc_sizeof_type (type) * __CHAR_BIT__;
else {
/* Get the bitfield's type */
for (bfld_type = type + 1;
@ -1128,7 +1125,7 @@ objc_layout_structure_next_member (struct objc_struct_layout *layout)
bfld_type++)
/* do nothing */;
bfld_type_align = objc_alignof_type (bfld_type) * BITS_PER_UNIT;
bfld_type_align = objc_alignof_type (bfld_type) * __CHAR_BIT__;
bfld_field_size = atoi (objc_skip_typespec (bfld_type));
layout->record_size += bfld_field_size;
}
@ -1143,7 +1140,7 @@ objc_layout_structure_next_member (struct objc_struct_layout *layout)
type = objc_skip_type_qualifiers (layout->type);
if (*type != _C_BFLD)
desired_align = objc_alignof_type (type) * BITS_PER_UNIT;
desired_align = objc_alignof_type (type) * __CHAR_BIT__;
else
{
desired_align = 1;
@ -1153,7 +1150,7 @@ objc_layout_structure_next_member (struct objc_struct_layout *layout)
bfld_type++)
/* do nothing */;
bfld_type_align = objc_alignof_type (bfld_type) * BITS_PER_UNIT;
bfld_type_align = objc_alignof_type (bfld_type) * __CHAR_BIT__;
bfld_field_size = atoi (objc_skip_typespec (bfld_type));
}
@ -1180,7 +1177,7 @@ objc_layout_structure_next_member (struct objc_struct_layout *layout)
if (bfld_field_size)
layout->record_align = MAX (layout->record_align, desired_align);
else
desired_align = objc_alignof_type (bfld_type) * BITS_PER_UNIT;
desired_align = objc_alignof_type (bfld_type) * __CHAR_BIT__;
/* A named bit field of declared type `int'
forces the entire structure to have `int' alignment.
@ -1194,7 +1191,7 @@ objc_layout_structure_next_member (struct objc_struct_layout *layout)
if (maximum_field_alignment != 0)
type_align = MIN (type_align, maximum_field_alignment);
else if (DECL_PACKED (field))
type_align = MIN (type_align, BITS_PER_UNIT);
type_align = MIN (type_align, __CHAR_BIT__);
#endif
layout->record_align = MAX (layout->record_align, type_align);
@ -1251,9 +1248,9 @@ void objc_layout_finish_structure (struct objc_struct_layout *layout,
layout->type = NULL;
}
if (size)
*size = layout->record_size / BITS_PER_UNIT;
*size = layout->record_size / __CHAR_BIT__;
if (align)
*align = layout->record_align / BITS_PER_UNIT;
*align = layout->record_align / __CHAR_BIT__;
}
void objc_layout_structure_get_info (struct objc_struct_layout *layout,
@ -1262,9 +1259,9 @@ void objc_layout_structure_get_info (struct objc_struct_layout *layout,
const char **type)
{
if (offset)
*offset = layout->record_size / BITS_PER_UNIT;
*offset = layout->record_size / __CHAR_BIT__;
if (align)
*align = layout->record_align / BITS_PER_UNIT;
*align = layout->record_align / __CHAR_BIT__;
if (type)
*type = layout->prev_type;
}