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


Rafael Ávila de Espíndola <rafael.espindola@gmail.com> writes:

> Two colleagues (Rafael Dantas de Castro and Gustavo Sverzut Barbieri) and I 
> decided to try to make a scheme frontend for gcc. Since the task is proving 
> quite difficult we decided to write a very small frontend that could be used 
> as a tutorial. We call this small frontend "hello world" because it generates 
> a hello world program no matter what it is given as input :)

 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.
 
> The frontend is at http://ltc08.ic.unicamp.br/svn/scheme/branches/hello-world
> 
> It has some ideas (and comments) from the gcc frontend howto but is designed 
> to work with gcc4.

 I suppose I should update this howto for gcc4.
 
> Unfortunately there isn't a lot of documentation and we are not sure if we did 
> the wright think in some points. We would be very glad if someone could 
> elucidate some of ours doubts:
> 
> what is USE_MAPPED_LOCATION for? We have seen some discussion but we are not 
> sure about its purpose or if we are using it correctly.

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

> The callbacks: with gcc using GENERIC why it is necessary to call the frontend 
> to edit the tree? For example, it seems that getdecls is redundant with the 
> information maintained by the call graph module. Why is builtin_function 
> necessary? Can't the middle end add the definitions on its on?
> 
> We also noticed that many callbacks are the same in treelang, c and fortran. 
> Maybe there should be a default implementation.

 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.

> Are we building string literals correctly? Why is a NOP_EXPR expression 
> necessary?

 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.
 
> Why it is necessary to set function_end_locus? Can this be done without using 
> the cfun global variable?

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

> In a FUNCTION_DECL, what is the difference between DECL_EXTERNAL and (not 
> TREE_STATIC)?

 The answer is in tree.h:833,
   In a FUNCTION_DECL, nonzero if function has been defined.

> But we must also note the current interface looks simpler than the ones 
> described in the old documents :)

 That's good.  Perhaps with some help we can clean up the interfaces some
more.

> Thanks for any comment.
> 
> Rafael Ávila de Espíndola
> 


-- 
Thanks,
Jim

http://www.csclub.uwaterloo.ca/~ja2morri/
http://phython.blogspot.com
http://open.nit.ca/wiki/?page=jim


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