Thread overview
Proposal: New Switch -vcg-ast to output the lowered AST
Feb 23, 2017
Stefan Koch
Feb 24, 2017
Martin Nowak
May 07, 2017
Ali Cehreli
February 23, 2017
Hello fellow compiler hackers,

In order to debug the inliner I have implemented a switch that prints out the AST after all semantic processing is done.
Using the infra-structure that is already provided by hdrgen.
This has already let me to make a few improvements to the hdrgen.
For example if-else chains will no longer infinitely indent to the left.
Or Literals of EnumType will be printed by name rather then as cast(MyEnum)38943U.

I do think this is very worthwhile to have.

And would be happy to hear some opinions from you.

PS. I am aware that the printout of enum definitions is now broken; I know howto fix it and will do so shotly.

Lastly I should like the PR:
https://github.com/dlang/dmd/pull/6556

Cheers,
Stefan
February 24, 2017
On Thursday, 23 February 2017 at 01:37:15 UTC, Stefan Koch wrote:
> In order to debug the inliner I have implemented a switch that prints out the AST after all semantic processing is done.
> Using the infra-structure that is already provided by hdrgen.
> This has already let me to make a few improvements to the hdrgen.
> For example if-else chains will no longer infinitely indent to the left.
> Or Literals of EnumType will be printed by name rather then as cast(MyEnum)38943U.

It might be helpful for dmd, but actually inlining doesn't belong into the frontend, so this is a very specific tool. Also haven't seen many inline bugs lately.
May 07, 2017
On Thursday, 23 February 2017 at 01:37:15 UTC, Stefan Koch wrote:
> Hello fellow compiler hackers,
>
> In order to debug the inliner I have implemented a switch that prints out the AST after all semantic processing is done.
> Using the infra-structure that is already provided by hdrgen.
> This has already let me to make a few improvements to the hdrgen.
> For example if-else chains will no longer infinitely indent to the left.
> Or Literals of EnumType will be printed by name rather then as cast(MyEnum)38943U.
>
> I do think this is very worthwhile to have.
>
> And would be happy to hear some opinions from you.
>
> PS. I am aware that the printout of enum definitions is now broken; I know howto fix it and will do so shotly.
>
> Lastly I should like the PR:
> https://github.com/dlang/dmd/pull/6556
>
> Cheers,
> Stefan

I've just learned about this switch, which I'm told is currently in master. From what Stefan has shown to me, this can be handy in many situations because it outputs the instantiations of templates. (One limitation is that it currently works only with eponymous templates.)

I think this command or a sister of it could be improved to dump what is being mixed-in.

Ali