This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: type conversion....
- To: Jan Hubicka <hubicka at atrey dot karlin dot mff dot cuni dot cz>
- Subject: Re: type conversion....
- From: Jeffrey A Law <law at cygnus dot com>
- Date: Wed, 03 Jun 1998 00:49:19 -0600
- cc: egcs at cygnus dot com
- Reply-To: law at cygnus dot com
In message <19980602115723.58044@atrey.karlin.mff.cuni.cz>you write:
> I think it should be nice to add an interval information into each rtl,
> and calculate the minimal and maximal values of each rtl and register.
> This should let gcc to be much smarter about types, and propagate more
> constants... For example when value is always in the interval 0-100, it should
> convert it into unsigned char, wich should help at some platforms. At intel it
> should convert char value to integer (in case overflow in the calculation can
> not happend) and such. Also can convert signed to unsigned quite often IMO
> ...
>
> Calculating of intervals inside basic block should be easy, but not very
> effective. I think it should be global, but calculating intervals in the
> loops should be hard work. Only idea I have is following:
> first calculate loop with original intervals in registers, then again, with
> output intervals (this step should be repeated) and then intervals that still
> changes change to +inf/-inf and repeat... this should quite quicky converge
> IMO...
This is known as value range propagation. It's not particularly common in
productions compilers yet. You should be able to find some papers on the
topic on the web if you look around for a while.
jeff