3

I need to dump all Gimple trees (kind of -fdump-tree-whatever). I created a plugin for the purpose, but I am not sure how should I access Gimple trees in pass. Plugin is hooked into GIMPLE_PASS:

static struct opt_pass my_pass = 
 {
    .type = GIMPLE_PASS,
    ...

I tried to iterate over basic blocks using gsi (gimple_stmt_iterator), however, my dump is incomplete.

Can you help me, how should I access the Gimple trees, to get every single tree dumped?

notnull
  • 1,908
  • 3
  • 19
  • 25
  • Not clear what's wrong with -fdump-tree-all – Konstantin Vladimirov Oct 07 '14 at 13:51
  • It's incomplete, ie. global variables... But that doesn't really matter. Gimple manipulation is the question – notnull Oct 07 '14 at 17:04
  • Global variables are not part of function context and can not be dumped pass-wise with any statement iterator, ever. Please specify in question what exact information do you need and how are you trying to access it with gsi. – Konstantin Vladimirov Oct 08 '14 at 11:43
  • I need everything necessary for complete reconstruction - so I could take the export and let it process with the front end. – notnull Oct 08 '14 at 11:54
  • Something like https://gcc.gnu.org/wiki/GimpleFrontEnd ? I think it is not possible in practice (means: too hard). Gimple just not built for it, too much inconsistence, too much inconvenience. – Konstantin Vladimirov Oct 08 '14 at 12:09
  • yes, this is pretty much what I am working on. Do you think, it would be easier using GENERIC? – notnull Oct 08 '14 at 12:12

2 Answers2

3

The most useful option is -fdump-tree-gimple

2

Use -fdump-tree-all to dump all passes for tree.

linuxqwerty
  • 198
  • 16