I extracted Ast from gcc .tu file and will it be useful?

2018-01-12 Thread Zhiyuan Gao
Hi! I am a beginner in compiler and I extracted Ast from the .tu files. It can be viewed in pdf format and I tested it on gcc 7.2 and 4.9.3. This is my source code. https://github.com/alapha23/Ast-Extracter_gcc Will it be useful? Or how can I make my tryout useful to the project? Thank you

Re: Does -fdump-tree-original-raw dumps out the full AST?

2014-07-24 Thread Florian Weimer
On 07/24/2014 05:57 PM, Francois Berenger wrote: Would it be possible to make these dumps complete? Let's say for the C frontend of gcc. The C front end currently does not produce an AST in the usual sense. It would certainly be possible to dump out the trees it produces, but most co

Re: Does -fdump-tree-original-raw dumps out the full AST?

2014-07-24 Thread Diego Novillo
n external program it would be possible to reconstruct the original >>> AST >>> that gcc was working on (and dumped out). >> >> It isn't. These dumps are meant to be debugging aids. It is not >> possible to reconstruct the original program out of them. >

Re: Does -fdump-tree-original-raw dumps out the full AST?

2014-07-24 Thread Francois Berenger
On Thu, Jul 24, 2014 at 4:29 PM, Diego Novillo wrote: > On Thu, Jul 24, 2014 at 7:17 AM, Francois Berenger > wrote: > >> Complete in the sense that, by parsing back this text file >> with an external program it would be possible to reconstruct the original AST >> t

Re: Does -fdump-tree-original-raw dumps out the full AST?

2014-07-24 Thread Diego Novillo
On Thu, Jul 24, 2014 at 7:17 AM, Francois Berenger wrote: > Complete in the sense that, by parsing back this text file > with an external program it would be possible to reconstruct the original AST > that gcc was working on (and dumped out). It isn't. These dumps are meant to be

Does -fdump-tree-original-raw dumps out the full AST?

2014-07-24 Thread Francois Berenger
Hello, If I use the -fdump-tree-original-raw option of gcc, I understand it will dump out the AST in a text file. Is that text file complete? Complete in the sense that, by parsing back this text file with an external program it would be possible to reconstruct the original AST that gcc was

Re: [GSoC] generation of GCC expression trees from isl ast expressions

2014-07-03 Thread Tobias Grosser
On 03/07/2014 19:24, Roman Gareev wrote: However, this form doesn't have loop guards which are generated by >>graphite_create_new_loop_guard in gcc/graphite-isl-ast-to-gimple.c and >>by graphite_create_new_loop_guard in graphite-clast-to-gimple.c. > > >Maybe the gu

Re: [GSoC] generation of GCC expression trees from isl ast expressions

2014-07-03 Thread Roman Gareev
>> However, this form doesn't have loop guards which are generated by >> graphite_create_new_loop_guard in gcc/graphite-isl-ast-to-gimple.c and >> by graphite_create_new_loop_guard in graphite-clast-to-gimple.c. > > > Maybe the guards are directly constant folde

Re: [GSoC] generation of GCC expression trees from isl ast expressions

2014-07-01 Thread Tobias Grosser
] = i; return 0; } gcc/graphite-isl-ast-to-gimple.c loop_0 (header = 0, latch = 1, niter = ) { bb_2 (preds = {bb_0 }, succs = {bb_3 }) { : } bb_5 (preds = {bb_3 }, succs = {bb_1 }) { : # .MEM_10 = PHI <.MEM_3(D)(3)> # VUSE <.MEM_10> return

Re: [GSoC] generation of GCC expression trees from isl ast expressions

2014-07-01 Thread Roman Gareev
return 0; } gcc/graphite-isl-ast-to-gimple.c loop_0 (header = 0, latch = 1, niter = ) { bb_2 (preds = {bb_0 }, succs = {bb_3 }) { : } bb_5 (preds = {bb_3 }, succs = {bb_1 }) { : # .MEM_10 = PHI <.MEM_3(D)(3)> # VUSE <.MEM_10> return 0; } loop_2

Re: [GSoC] generation of GCC expression trees from isl ast expressions

2014-06-26 Thread Tobias Grosser
generated from isl ast expressions. After this the result of the evaluation is being compared with assumed result. I haven't found functions, which evaluate isl ast expressions. That is why it compares results of evaluations with assumed result. Maybe there is a better way to compare the sema

Re: [GSoC] generation of GCC expression trees from isl ast expressions

2014-06-26 Thread Roman Gareev
message. Sorry for being unclear.) > I did not fully understand them. Are you comparing the resulting GIMPLE > trees or are you statically evaluating the isl and gimple trees to check > if the computed value is the same? I'm statically evaluating gimple tree expressions, which are generat

Re: [GSoC] generation of GCC expression trees from isl ast expressions

2014-06-23 Thread Roman Gareev
> I assume so. However, we always want signed types, so the second > argument should be zero, no? Yes, you are right. > How did you verify that the semantics of the GCC and isl expressions are > identical? I haven't tested it on examples yet. I've only matched their semantics from the isl manual

Re: [GSoC] generation of GCC expression trees from isl ast expressions

2014-06-23 Thread Tobias Grosser
On 23/06/2014 08:34, Roman Gareev wrote: Hi Tobias, I'm currently working on generation of GCC expression trees from isl ast expressions . Could you please answer a few questions about it? 1. How is it better to generate tree from isl_ast_expr_int? In the temporary variant I

[GSoC] generation of GCC expression trees from isl ast expressions

2014-06-22 Thread Roman Gareev
Hi Tobias, I'm currently working on generation of GCC expression trees from isl ast expressions . Could you please answer a few questions about it? 1. How is it better to generate tree from isl_ast_expr_int? In the temporary variant I call isl_ast_expr_get_int to get isl_int from isl_ast

Re: [OT] Control Flow Graph(CFG) into Abstract Syntax Tree(AST)

2012-09-14 Thread Mike Dupont
thanks for sharing, will check this out. mike On Fri, Sep 14, 2012 at 9:05 PM, James Courtier-Dutton wrote: > Hi, > > I know most compilers go from AST to CFG. > I am writing a decompiler, so I was wondering if anyone knew of any > documents describing how best to get from CF

[OT] Control Flow Graph(CFG) into Abstract Syntax Tree(AST)

2012-09-14 Thread James Courtier-Dutton
Hi, I know most compilers go from AST to CFG. I am writing a decompiler, so I was wondering if anyone knew of any documents describing how best to get from CFG to AST. The decompiler project is open source. https://github.com/jcdutton/libbeauty The decompiler already contains a disassembler and

Re: The AST tree modification. Edited.

2011-10-15 Thread niXman
Up. 2011/10/12 niXman : > Hello! > > I have figured out the creation of functions and structures, thanks > Andi's and Balaji's. Couldn't understand how to create tree for > template functions, classes, methods. > Can you help me figure that out, please? > > Thanks. >

Re: The AST tree modification. Edited.

2011-10-11 Thread niXman
Hello! I have figured out the creation of functions and structures, thanks Andi's and Balaji's. Couldn't understand how to create tree for template functions, classes, methods. Can you help me figure that out, please? Thanks.

Fwd: The AST tree modification. Edited.

2011-10-06 Thread niXman
NOWN_LOCATION, FIELD_DECL, >> get_identifier("variable"), integer_type_node) >> TREE_CHAIN(struct_field) = struct_frame >> >> You will create the following internal structure >> >> struct { >>    int variable; >> } >> >> I hope this h

Re: The AST tree modification. Edited.

2011-10-06 Thread Andi Hellmund
Balaji V .Iyer. -Original Message- From: niXman [mailto:i.nix...@gmail.com] Sent: Monday, October 03, 2011 6:51 PM To: gcc@gcc.gnu.org Subject: The AST tree modification. Edited. Hi everybody! It is necessary to implement a plug-in for GCC designed to collect the information on types of tr

Re: The AST tree modification. Edited.

2011-10-04 Thread Ian Lance Taylor
niXman writes: > "lang_hooks" - what this? where is declared? Running grep will show you that it is declared in langhooks.h. The lang hooks are frontend hooks called from the middle-end. The hooks are defined in langhooks.h. Ian

Re: The AST tree modification. Edited.

2011-10-04 Thread niXman
following internal structure > > struct { >   int variable; > } > > I hope this helps you get started. > > Thanks, > > Balaji V .Iyer. > > -----Original Message- > From: niXman [mailto:i.nix...@gmail.com] > Sent: Monday, October 03, 2011 6:51 PM >

RE: The AST tree modification. Edited.

2011-10-04 Thread Iyer, Balaji V
Monday, October 03, 2011 6:51 PM To: gcc@gcc.gnu.org Subject: The AST tree modification. Edited. Hi everybody! It is necessary to implement a plug-in for GCC designed to collect the information on types of translation unit, and generate static const array of types rtti_ex _ on its base; ///

The AST tree modification. Edited.

2011-10-03 Thread niXman
t align; const size_t offset; }; // generated from plugin. static const rtti_ex_ rtti_ex_array_[] = { {...}, {...}, {...} }; ///////// There aren't any problems with information collection from AST. There is a complexity with AST modification: 1. How to

The AST tree modification.

2011-10-03 Thread niXman
t align;    const size_t offset; }; // generated from plugin. static const rtti_ex_ rtti_ex_array_[] = {    {...},    {...},    {...} }; ///////// There aren't any problems with information collection from AST. There is a complexity with AST modification: 1. How to

Re: [pph] Adapting LTO streaming for front end AST saving

2011-03-23 Thread Diego Novillo
1-03-23 13:08:11) honza: dnovillo: for LTO it makes a lot sense when the way you stream function bodies is well defined VM (well, like LLVM). We can't reach this when we will just keep saving our trees without any more strict specification (2011-03-23 13:08:38) honza: for AST in FE you have di

Re: [pph] Adapting LTO streaming for front end AST saving

2011-03-23 Thread Diego Novillo
On Wed, Mar 23, 2011 at 12:38, Jan Hubicka wrote: >> think it would be much easier if you worked with a copy (ugh, >> streaming trees again). > > I also think using same machinery for FE/gimple is a mistake.  Trees are > making > life hard since they are interface in between FE<->gimplifier,

Re: [pph] Adapting LTO streaming for front end AST saving

2011-03-23 Thread Jan Hubicka
> On Wed, 23 Mar 2011, Diego Novillo wrote: > > > Over at the PPH branch we are starting to re-use the LTO streaming > > routines to save front end trees. Clearly, there are things that need > > to be extended and/or replaced since LTO streaming assumes that we are > > in GIMPLE. However, there

Re: [pph] Adapting LTO streaming for front end AST saving

2011-03-23 Thread Diego Novillo
On Wed, Mar 23, 2011 at 10:53, Richard Guenther wrote: > Yes, Micha has a load of patches cleaning up streaming and removing > unecessary abstraction.  So, why'd you need to share any of it? Removing unnecessary abstraction is fine. But there is a bunch of code that will be common, in particula

Re: [pph] Adapting LTO streaming for front end AST saving

2011-03-23 Thread Richard Guenther
On Wed, 23 Mar 2011, Diego Novillo wrote: > Over at the PPH branch we are starting to re-use the LTO streaming > routines to save front end trees. Clearly, there are things that need > to be extended and/or replaced since LTO streaming assumes that we are > in GIMPLE. However, there is a large i

[pph] Adapting LTO streaming for front end AST saving

2011-03-23 Thread Diego Novillo
Over at the PPH branch we are starting to re-use the LTO streaming routines to save front end trees. Clearly, there are things that need to be extended and/or replaced since LTO streaming assumes that we are in GIMPLE. However, there is a large intersection that I think can be commoned out. - AS

Gcc Plugin and AST/variable question

2011-01-27 Thread Kyle Girard
I have two files: foo.h: extern int x; extern int y; foo.c: #include "foo.h" int x; int y; I have written a gcc plugin that traverses the gcc AST ... However in the situation where I compile the above file I cannot seem to access the int x and int y decls. If I place a dummy funct

Re: How to get attual method in GCC AST

2010-08-05 Thread Tom Tromey
> "Kien" == Kien Nguyen Trung writes: Kien> obj_type_ref Kien> indirect_ref (test.cpp:21-17) Kien> The problem is method read() of class B is get from a virtual method Kien> of based class A. And i cannot get the real name of this method. Kien> Do you have any idea

How to get attual method in GCC AST

2010-08-02 Thread Kien Nguyen Trung
I am work on a project related with GCC AST. In my project, i write a plugin for GCC. This plugin read a AST from a source code, a covert this source code to another language. Currently i have a problem with GCC AST. In particular, i cannot retrieve all information about CALL_EXPR. I read GCC

Re: C/C++ AST

2010-05-11 Thread Basile Starynkevitch
On 05/11/2010 11:34 AM, wolfgang8...@gmx.de wrote: Hello All, I want to know if it is possible to modify AST of the C/C++-Language. You can modify a middle end representation of source program. I am not sure if it always should be called an AST. What I would like to do is to add some

C/C++ AST

2010-05-11 Thread wolfgang8080
Hello All, I want to know if it is possible to modify AST of the C/C++-Language. What I would like to do is to add some arguments to some function calls or add statements somewhere in the tree. Now I am looking for the root node to modify it. Which is the best pass for that? Is there anywhere

Re: How to get AST for C source in plugin?

2010-02-12 Thread Ilya Caramishev
On 12/02/10 19:51, Joern Rennecke wrote: Quoting Ilya Caramishev : I've tried registering my plugin for PLUGIN_FINISH_UNIT event. That event occurs way too late. Alternatively I've tried Kenji Koyanagi's patch (http://gcc.gnu.org/ml/gcc/2009-03/msg00136.html) and it worked just fine, but I d

Re: How to get AST for C source in plugin?

2010-02-12 Thread Joern Rennecke
Quoting Ilya Caramishev : I've tried registering my plugin for PLUGIN_FINISH_UNIT event. That event occurs way too late. Alternatively I've tried Kenji Koyanagi's patch (http://gcc.gnu.org/ml/gcc/2009-03/msg00136.html) and it worked just fine, but I don't know whether this patch is going to b

How to get AST for C source in plugin?

2010-02-12 Thread Ilya Caramishev
plugin gets called, but I couldn't find a way to access AST - nothing is passed to my plugin as parameter. Maybe there is some GCC's global variable that contains AST I can use? Alternatively I've tried Kenji Koyanagi's patch (http://gcc.gnu.org/ml/gcc/2009-03/msg00136.htm

[plugins] [patch] allows to see AST in C

2009-03-06 Thread kenji koyanagi
only supported in C++ This patch (for the plugins branch) allows to see AST in C. Thanks, Kenji Koyanagi Index: c-decl.c === --- c-decl.c(revision 144675) +++ c-decl.c(working copy) @@ -63,6 +63,7 @@ #include "l

Re: AST-tree in GCC

2007-09-24 Thread Thomas A.M. Bernard
Perhaps you could also try -fdump-tree-gimple or -fdump-tree-gimple-raw In both cases you dump out the GIMPLE form, AST based. Best, T. > Hi I want to extract the complete AST-tree from GCC (using 4.1.2). > I´ve tried to use -fdump-translation-unit but it seems like its dosent >

Re: AST-tree in GCC

2007-09-24 Thread Diego Novillo
On 9/24/07, Johan Bohlin <[EMAIL PROTECTED]> wrote: > My question is... Anyone knows a way > to get all information ? Maybe changing a flag in the source code or > something. Debugging dumps are always incomplete. Mostly by design, but in general because we just dump what seems useful for debugg

AST-tree in GCC

2007-09-24 Thread Johan Bohlin
Hi I want to extract the complete AST-tree from GCC (using 4.1.2). I´ve tried to use -fdump-translation-unit but it seems like its dosent include information in ex. for and if statements. If i use -fdump-tree-orignal-raw i get each function but not the external variables if they are not used in

AST dump

2006-03-09 Thread Darthrader
@27 integer_cst type: @13 high: -1 low : -2147483648 Darth -- View this message in context: http://www.nabble.com/AST-dump-t1252187.html#a3318259 Sent from the gcc - Dev forum at Nabble.com.

Help in AST dump

2006-03-09 Thread Darthrader
@27 integer_cst type: @13 high: -1 low : -2147483648 Darth -- View this message in context: http://www.nabble.com/Help-in-AST-dump-t1252187.html#a3318259 Sent from the gcc - Dev forum at Nabble.com.

AST

2006-02-02 Thread Darthrader (sent by Nabble.com)
Can someone give a good link to any information about the Abstract Syntax Tree. Any help will be appreciated. TIA, Darthrader -- View this message in context: http://www.nabble.com/AST-t1047504.html#a2722321 Sent from the gcc - Dev forum at Nabble.com.

Re: Root Node of AST

2005-03-15 Thread James E Wilson
Rajesh Babu wrote: I am working with gcc-3.3.3, and I want to insert my module after construction of AST and before RTL generation. gcc-3.3 is not interesting for work like this. This stuff has already been obsoleted in current gcc sources. But if you insist on using out dated sources, look

Re: Root Node of AST

2005-03-12 Thread Rajesh Babu
I am working with gcc-3.3.3, and I want to insert my module after construction of AST and before RTL generation. Rajesh On Sat, 12 Mar 2005, Diego Novillo wrote: On 03/12/05 08:14, Rajesh Babu wrote: I want the root node of the AST built by gcc, so that I can do the manipulations I want to

Re: Root Node of AST

2005-03-12 Thread Diego Novillo
On 03/12/05 08:14, Rajesh Babu wrote: I want the root node of the AST built by gcc, so that I can do the manipulations I want to do on the intermediate nodes of AST. Can someone tell me where I can find the root node of AST and the place where the construction of AST finishes in GCC source

Root Node of AST

2005-03-12 Thread Rajesh Babu
Hi, I want the root node of the AST built by gcc, so that I can do the manipulations I want to do on the intermediate nodes of AST. Can someone tell me where I can find the root node of AST and the place where the construction of AST finishes in GCC source. Thanks in Advance Rajesh Babu