This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: GCC lexer
> I have modified the back end of gcc version 3.2.2 by rewriting the target
> files to recognise my specific target architecture. I have done this and I
> now want to modify the front end to an extent. I dont want GCC to pass
> floating point numbers or doubles. In order to do this, I presume I need to
> modify the lexer and maybe the parser.
Do you want the compiler to not parse them or not handle them. I can
really think of any reason for wanting the first - but I could be wrong
on that. I'm guessing the hardware you're porting to doesn't have an FP
unit.
> I am aware that the lexer is contained in the file c-lex.c. I am looking to
> find out has anybody modified this file to give an error anytime a float /
> double is entered? What do I need to modify? Do I need to modify the parser
> too? (My thinking on it is that the lexer should not create a token, hence I
> should not have to touch the parser)
I feel that it might be easier, more portable and easier to maintain to
add a check after parsing that will generate a warning for any floating
point data types or operations used. As GCC moves more towards using
GENERIC/GIMPLE/Tree-SSA this would seem to be a sensible approach.
Out of interest why not use libgcc to implement software emulation for
floating point as is done on the current architectures without FP units.
Cheers,
- Martin
--
<< .sig file removed for cleaning >>