Hello, I tried to use git but it was not installed, I installed it with urpmi git ans urpmi git-core but when I type : # git clone git://crules.org:gcc-dev.git I get this error: Initialized empty Git repository in /export/home/charfi/gcc-dev/.git/ fatal: Unable to look up (port 9418) (Name or service not known) any idea ? thanks Asma ----- Message d'origine ---- De : Philip Herron <redbrain@xxxxxxxxxxx> À : charfi asma <charfiasma@xxxxxxxx> Cc : Andi Hellmund <mail@xxxxxxxxxxxxxxxx>; gcc-help@xxxxxxxxxxx Envoyé le : Sam 17 juillet 2010, 2h 27min 34s Objet : Re: Re : Re : Re : Re : Re : Re : [GCC front end] trying to install sample_fe but fail in make On 16 July 2010 15:08, charfi asma <charfiasma@xxxxxxxx> wrote: > I run the sfe_example and it works perfectly. > when I call gsfe -s file1.sfe, I get the file1.s which is nearly the same > assembly generated when compiling the same c code with gcc. > > But now, I want to understand How it works ;) > > I look at the code of sfe_example.c and sfe1.c. > I understand that sfe1 define a tree for each variable /type /c function in >the Most front-ends will Generate GENERIC which is the tree type you will see alot of. My frontend requires a more highlevel IR which i bring down to GENERIC much like GCCGO. > c code, for example for the global_var, we have the function : > create_decl_global_var() of type tree, etc > > in the sfe1.c, those functions are called in the getdecls(void) but this > function tree getdecls(void) is never called > > so my questions are: > > 1. who calls all sfe1.c functions ( sfe_parse_file, getdecls, ...) ? look at do_compile at gcc/toplev.c line 2319 i think, its responsible for calling all the necessary langhooks. > 2. when we call the sfe1.c, is the result equal to the generic form of the c > code ? In which file this form is stocked ? Are you asking is the IR generated the same as the C-front-end? Answer anything that uses the GENERIC IR is the same IR the C front-end uses. > > although I think that the body of each funcion of sfe1_example.c is writen in > generic but I am not sure (generic is a list of tree code just like gimple) > when I compile the same c code using gcc and dump the gimple form, I expected > that the generic form is close to the gimple one, am I write ? You may want to clone this git repo: $ git clone git://crules.org:gcc-dev.git # i think the git daemon should be running else let me know $ git checkout -t -b documentation origin/documentation And look at gcc/gcalc a front-end Andi put together its a basic front-end showing how you can use GCC as a backend to a calculator its nearly complete and its very well written it should show you everthing you need to know for a stock front-end. > 3. I do not really understand this code in the sfe1.h > > struct lang_identifier GTY(()) > { > struct tree_identifier common; > }; > > union lang_tree_node GTY((desc ("TREE_CODE (&%h.generic) == IDENTIFIER_NODE"))) > { > union tree_node GTY ((tag ("0"), desc ("tree_node_structure (&%h)"))) > generic; > struct lang_identifier GTY ((tag ("1"))) identifier; > }; These GTY markers are for the gentype which generates code for the garbage collector within gcc so it understands structures and so you can use them within some vectors in GCC or other data structures. These functions are simply boiler plate functions the compiler driver requires to be able to call the compiler proper i think and are the same in most front-ends most people should have no need to play with them. Hope this helps! --Phil