This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Chill vs. Pascal sets (was: undefined reference to `__setbits')
On Thu, Sep 30, 1999 at 01:12:40PM +0200, Peter Gerwinski wrote:
> Andreas Schwab wrote:
> > |> #define SET_WORD_SIZE (sizeof (char) * sizeof (SET_WORD))
> > |> #define SET_SHORT_SIZE (sizeof (char) * sizeof (SET_SHORT))
> > |> #define SET_CHAR_SIZE sizeof (char)
> >
> > I think this should rather be:
> >
> > #define SET_WORD_SIZE (CHAR_BIT * sizeof (SET_WORD))
> > #define SET_SHORT_SIZE (CHAR_BIT * sizeof (SET_SHORT))
> > #define SET_CHAR_SIZE CHAR_BIT
>
> Yes, of course. However these macros are being used in the
> Chill run time library that is distributed with gcc-2.95.x.
> Does this really work correctly in Chill???
Does anyone do any Chill testing? There's no testsuite, and
last time I tried, I couldn't get the sample program in
chill.brochure to compile. (Not that that means much from
someone who doesn't know Chill, but . . .)
> Instead, I am suggesting the following changes to the backend:
>
> * Sets are a sequence of bits. Chill is bundling them
> to 8-bit bytes. For efficiency reasons, this should
> be generalized to allow for 32/64-bit words instead.
> We could introduce a constant `BITS_PER_SET_UNIT' or
> similar that could be set to `BITS_PER_UNIT' in Chill
> and to `BITS_PER_WORD' in Pascal.
It appears that the code did something like this (disabling
USE_CHARS in libchill in gcc 2.95 will make SET_WORD unsigned
int), but it was ripped out in CVS because it wasn't legal
under the ISO C aliasing rules.
> * Chill sets are not aligned; a `set of 4..7' fills the
> _lower_ half of a byte. In Pascal, the lower bound is
> rounded down to a multiple of `BITS_PER_SET_UNIT', so
> `set of 4..7' fills the _upper_ half of a byte.
> If we introduce a new constant `SET_ALIGNMENT'
> holding zero in Chill and `BITS_PER_WORD' in Pascal,
> `get_set_constructor_bits()' (tree.c) can easily handle
> both cases.
>
> * What's the issue with `BYTES_BIG_ENDIAN'? Why don't we
> consistently use the mask `1 << bitpos' on all machines to
> access the `bitpos'th bit in a word?
>From what Per Bother said recently, I gather that Chill sets were
designed under contract to a company that needed compatibilty with
another Chill compiler that did stuff like this.
> If these problems cannot be solved, there is no point using
> `SET_TYPE' nodes for Pascal sets. In that case, we would have
> to introduce a `LANG_TYPE' and need a hook in `expand_expr()' to
> handle values of that type. I suspect that such a hook exists
> already, but I did not find it yet.
That would be a shame as it would make new languages that needed to
use similar sets (e.g. Modula 3) duplicate the Pascal code.
> Anyway, I would prefer to have
?