This is the mail archive of the
mailing list for the GCC project.
Type Information for better Optimization
- From: Kevin Atkinson <kevin at atkinson dot dhs dot org>
- To: gcc at gcc dot gnu dot org
- Date: Fri, 3 Oct 2003 13:53:04 -0400 (EDT)
- Subject: Type Information for better Optimization
This doesn't directly relate to Gcc. However, I figured this would be a
good place to ask.
For my Ph D I am strongly considering developing a new system programming
language to which I hope can eventually replace C and C++.
One of the things my language will have is a very strong type system.
This includes pre and post conditions for functions and attributes for
variables. What I would like to know is, what type of information can a
Gcc use to generate better code? Also, when can a type specification be
to specific, to the point where in inhibits optimization?
For example type of information I am sure compilers can use (as gcc
has attributes for them)
if functions have side effects
An area when a type specification can be too specific:
precise rounding specifications
I also plan on providing very precious information on values a variable
can take. For integers I plan on only allowing the value to in a tight
range and/or a multiple of a power of two. I am not sure if gcc can use
this information however. One obvious area where this information could
be useful is string functions such as strcpy, if the size is always
guaranteed to be a multiple of say 4 then gcc can go ahead and copy a 32
bit word at a time. Or say that the value can only be one of 1,2,3 then
gcc can go ahead and specialize for each of those cases.
So, what other type of information could gcc use to optimize better (both
now, and in the theoretical future), and when can a specification for a
type be too specific to the point that it can inhibits optimization.
I look forward to hearing back from gcc developers.