* [GCC front end] add new TREE CODE @ 2011-02-14 17:44 charfi asma 2011-02-14 17:48 ` Ian Lance Taylor 2011-02-14 23:59 ` Andi Hellmund 0 siblings, 2 replies; 5+ messages in thread From: charfi asma @ 2011-02-14 17:44 UTC (permalink / raw) To: gcc-help Hello, I am developping my own gcc front end. My source language contains concepts that are not represented directly in C code. to compile those elements, I think that I should add a new tree codes to my front end as C++ does for templates... I think that I should also implement how to translate this new tree code in Gimple. my question is : should I also care about how to translate those tree code al over the compiler chain: gimple --> ssa --> unssa --> rtl --> ass ... did you suggest to follow an example of an existing front end that adds some tree code cause the C++ one seems to be mature and complete. thank you very much Asma ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [GCC front end] add new TREE CODE 2011-02-14 17:44 [GCC front end] add new TREE CODE charfi asma @ 2011-02-14 17:48 ` Ian Lance Taylor 2011-02-14 23:59 ` Andi Hellmund 1 sibling, 0 replies; 5+ messages in thread From: Ian Lance Taylor @ 2011-02-14 17:48 UTC (permalink / raw) To: charfi asma; +Cc: gcc-help charfi asma <charfiasma@yahoo.fr> writes: > I am developping my own gcc front end. My source language contains concepts that > are not represented directly in C code. > to compile those elements, I think that I should add a new tree codes to my > front end as C++ does for templates... > I think that I should also implement how to translate this new tree code in > Gimple. > my question is : should I also care about how to translate those tree code al > over the compiler chain: gimple --> ssa --> unssa --> rtl --> ass ... > did you suggest to follow an example of an existing front end that adds some > tree code cause the C++ one seems to be mature and complete. First let me say that if your language is very different from C you probably shouldn't be using trees at all. But if your language is mostly like C then using trees is reasonable. Even the C frontend itself has language-specific tree codes; see c-family/c-common.def. Or look at Objective C, at objc/objc-tree.def. Ian ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [GCC front end] add new TREE CODE 2011-02-14 17:44 [GCC front end] add new TREE CODE charfi asma 2011-02-14 17:48 ` Ian Lance Taylor @ 2011-02-14 23:59 ` Andi Hellmund 2011-02-21 11:26 ` Re : " charfi asma 1 sibling, 1 reply; 5+ messages in thread From: Andi Hellmund @ 2011-02-14 23:59 UTC (permalink / raw) To: charfi asma; +Cc: gcc-help Hey Asma, > my question is : should I also care about how to translate those tree code al > over the compiler chain: gimple --> ssa --> unssa --> rtl --> ass ... > The idea of GCC's modularization is that a front-end should maximally care about GIMPLE. All the other transformations are done by the middle-end. > did you suggest to follow an example of an existing front end that adds some > tree code cause the C++ one seems to be mature and complete. > Yes, the C++ front-end uses quite a lot of own TREE codes, but I would then start with a very simple one and check how it "translates" the TREE codes into a GIMPLE sequence, e.g. by looking at the 'gimplify_expr' language hook which is 'cp_gimplify_expr' for C++. I hope that helps. If you have any further question about the specific transformation from TREE codes to GIMPLE, just let us know ... Andi ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re : [GCC front end] add new TREE CODE 2011-02-14 23:59 ` Andi Hellmund @ 2011-02-21 11:26 ` charfi asma 2011-02-21 14:27 ` Andi Hellmund 0 siblings, 1 reply; 5+ messages in thread From: charfi asma @ 2011-02-21 11:26 UTC (permalink / raw) To: Andi Hellmund; +Cc: gcc-help ----- Message d'origine ---- De : Andi Hellmund <mail@andihellmund.com> À : charfi asma <charfiasma@yahoo.fr> Cc : gcc-help@gcc.gnu.org Envoyé le : Lun 14 février 2011, 18h 48min 26s Objet : Re: [GCC front end] add new TREE CODE Hey Asma, > my question is : should I also care about how to translate those tree code al > over the compiler chain: gimple --> ssa --> unssa --> rtl --> ass ... > The idea of GCC's modularization is that a front-end should maximally care about GIMPLE. All the other transformations are done by the middle-end. > did you suggest to follow an example of an existing front end that adds some > tree code cause the C++ one seems to be mature and complete. > Yes, the C++ front-end uses quite a lot of own TREE codes, but I would then start with a very simple one and check how it "translates" the TREE codes into a GIMPLE sequence, e.g. by looking at the 'gimplify_expr' language hook which is 'cp_gimplify_expr' for C++. I hope that helps. If you have any further question about the specific transformation from TREE codes to GIMPLE, just let us know ... Andi Hello, thank you Andi and Ian for your help ;) In fact, my language is moslty like C (var, function, call exp, if else, ...) but there is some difference, for example, I have State and transitions concepts which I can translate in C (set of states presented as enumerations and transitions as array of a defined type Transition which is a struct with source state, target state, guard, ...) what I want to try, is to add a new tree codes to directly translate State, transtion, event, ... and do not use Array, enumeration of C language. Ian said in his response that if my language is very different than C I should not use trees. Have you any idea of what I can use instead ? I look at the ghdl front end and I did not find vhdl-tree.def to see if they defined a new tree code for this fe. I asked the question in their mailing list but I did not get an answer :( I will probably (as you suggested before) look at the cp front end and may be the java one also. thank you again for your help Asma ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Re : [GCC front end] add new TREE CODE 2011-02-21 11:26 ` Re : " charfi asma @ 2011-02-21 14:27 ` Andi Hellmund 0 siblings, 0 replies; 5+ messages in thread From: Andi Hellmund @ 2011-02-21 14:27 UTC (permalink / raw) To: charfi asma; +Cc: gcc-help > > Ian said in his response that if my language is very different than C I should > not use trees. Have you any idea of what I can use instead ? > > Hey Asma, I'm not sure what Ian meant in detail, but I think that he wanted to say that you then shouldn't possibly use the TREE codes and tree-representation of GCC, but to use whatever intermediate representation is appropriate for your needs. If you would look up the literature, you would find tree-based structures as dominant intermediate structure, but most of these books then refer to C-syntax-like languages. Though, it is generally hard to predict which structure perfectly matches your needs. As said, you could use whatever you want. All you need to make sure is to finally translate to GIMPLE at some point. > I look at the ghdl front end and I did not find vhdl-tree.def to see if they > defined a new tree code for this fe. > This file is not mandatory, I think. So, if they don't use one, they might not use additional tree codes. Well, if they use GENERC/tree-based IR at all! Best regards, Andi ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2011-02-21 14:03 UTC | newest] Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2011-02-14 17:44 [GCC front end] add new TREE CODE charfi asma 2011-02-14 17:48 ` Ian Lance Taylor 2011-02-14 23:59 ` Andi Hellmund 2011-02-21 11:26 ` Re : " charfi asma 2011-02-21 14:27 ` Andi Hellmund
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).