This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: a "hello world" frontend


Em Sun 12 Jun 2005 23:58, James A. Morrison escreveu:
>  Was there anything in particular that you found hard to understand in the
> treelang frontend.  It is supposed to be the example/tutorial front-end.
One thing is that the parser is very big and mixed with C code. I find it 
easier to read a parser without side effects that just builds a abstract 
syntax tree ("Modern compiler implementation in ML" influence...). Just 
moving some of the C code to auxiliary functions in parse-aux.c would be very 
helpfull (are you interested in this patch(s)?).

>  I suppose I should update this howto for gcc4.
That would be wonderfull!!!

>  Mapped locations are a better(tm) way of tracking source locations
> throughout the compilation.
Thanks.

>  Perhaps, but the implementation may be the same because of how the
> callbacks used to be implemented.  With the langhooks it should be easy for
> any frontend to use the default implementation of a calback.
Convert is called directly and not through langhooks. Why?
Some call backs don't have a default: LANG_HOOKS_BUILTIN_FUNCTION for example.

>  Where?  I build NOP_EXPRs around the use of variables, in the treelang
> frontend so I can get accurate source locations for where variables are
> used.
at build_string_literal in hello1.c (copied from builtins.c). This looks like 
a lot of work to build a string. I tried to use something similar to 
gfc_build_string_const (fortran/trans-const.c) but failed.

>  function_end_locus is part of the function struct, which in treelang there
> is only cfun at any given time.
>

>  The answer is in tree.h:833,
>    In a FUNCTION_DECL, nonzero if function has been defined.
but in tree.h:2092
/* In a VAR_DECL or FUNCTION_DECL,
   nonzero means external reference:
   do not allocate storage, and refer to a definition elsewhere.  */

So a function can be defined and have a "definition elsewhere" at the same 
time? Isn't it true that
DECL_EXTERNAL(n) != TREE_STATIC(n) for all n?

>  That's good.  Perhaps with some help we can clean up the interfaces some
> more.
I will try to help as I try to undertend the current one :)

Thank you very much for yours comments.

Rafael Ávila de Espíndola

Attachment: pgp00000.pgp
Description: PGP signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]