This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Questions about modifing AST.
- From: Eric Tang <tytang at cse dot cuhk dot edu dot hk>
- To: fjh at cs dot mu dot oz dot au (Fergus Henderson)
- Cc: gcc at gcc dot gnu dot org
- Date: Mon, 28 Oct 2002 00:20:23 +0800 (HKT)
- Subject: Re: Questions about modifing AST.
>
> On 27-Oct-2002, Eric Tang <tytang@cse.cuhk.edu.hk> wrote:
> > i want to convert floating point to fixed point arithmetics
> > in compiler level.
>
> Why?
>
> Are you talking about changing the language semantics?
> Or are you just talking about a compiler optimization?
Since i want to remove all the floating point operations(like
float type, and other math functions applied on floating point)
They are time-consuming, and sometimes not necessary for
some applications. Fixed-point can be replaced and thus
optimize the program in this way.
So i am wondering how to do this is better.
¡@ First, user write a normal floating point programs(even
handling small fractional parts, C programmer also use
float type). Then i want to anaylse each float type
representation needed, such that the integral and
fractional bits required. Finally, replace the float
type with my fixed-point defined in another C program,
and also replace some maths functions specially defined
for fixed-point too. That's all i want to do.
I know that similar researchs have been done with the
help of SUIF. As gcc is a common tools for programmer and
also has been ported to various platform. So i want to
do it with GCC.
So i really need you all experts to give me advices.
The language is mainly "C" only!
>
> If you want to do this, it's better to write a pass which operates
> directly on GCC's AST representation, rather than trying to read
> in the AST from the dump file (which won't work, IIUC, because the dump
> file is deliberately incomplete).
If i want to operate directly on GCC's AST, i need to modify
the source code of gcc?? since i don't want to modify the
gcc compiler and want to do it seperately. So it is more
portable?!
It is all my idea in my mind. I am a newbie, so pls help! thx.
Regards,
Eric