This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: UNITS vs. BYTES
- From: Paolo Bonzini <paolo dot bonzini at lu dot unisi dot ch>
- To: GCC Development <gcc at gcc dot gnu dot org>, e0025274 at stud3 dot tuwien dot ac dot at
- Date: Fri, 11 Nov 2005 10:11:19 +0100
- Subject: Re: UNITS vs. BYTES
- References: <20051111095322.y2155jiias0wgc8s@webmail.tuwien.ac.at>
Adrian Prantl wrote:
Hello everybody,
I am currently working on creating a new gcc backend for a word-addressable
machine with 24-Bit general purpose registers.
While doing so I came across a few inconsistencies regarding the usage of the
BITS_PER_UNIT Macro. (and UNITS_PER_WORD, in a related story)
Apparently a lot of places in the gcc sources use the concept of a UNIT
where they actually mean an 8-Bit Byte and vice versa. (often in the form
of bytelen*BITS_PER_UNITS in order to calculate some size in BITS)
Old alphas are word-addressable, but still they had BITS_PER_UNIT == 8.
Or you may want to look at the c4x back-end, which has
/* Note the ANSI C standard requires sizeof(char) = 1. On the C[34]x
all integral and floating point data types are stored in memory as
32-bits (floating point types can be stored as 40-bits in the
extended precision registers), so sizeof(char) = sizeof(short) =
sizeof(int) = sizeof(long) = sizeof(float) = sizeof(double) = 1. */
#define BITS_PER_UNIT 32
#define UNITS_PER_WORD 1
Paolo