[PATCH] D69124: [clang][driver] Print compilation phases with indentation.

Michael Liao via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 18 07:51:04 PDT 2019


hliao added a comment.

In D69124#1713427 <https://reviews.llvm.org/D69124#1713427>, @tra wrote:

> This is... rather oddly-structured output. My brain refuses to accept that the most-indented phase is the input.
>  Perhaps we should do `llvm::errs().indent(MaxIdent-Ident)`. This should give us something like this (withMaxIdent=9), which is somewhat easier to grok, IMO:
>
>       0: input, "/home/michliao/dummy.cpp", cuda, (host-cuda)
>        1: preprocessor, {0}, cuda-cpp-output, (host-cuda)
>         2: compiler, {1}, ir, (host-cuda)
>   3: input, "/home/michliao/dummy.cpp", cuda, (device-cuda, sm_30)
>    4: preprocessor, {3}, cuda-cpp-output, (device-cuda, sm_30)
>     5: compiler, {4}, ir, (device-cuda, sm_30)
>      6: backend, {5}, assembler, (device-cuda, sm_30)
>       7: assembler, {6}, object, (device-cuda, sm_30)
>        8: offload, "device-cuda (nvptx64-nvidia-cuda:sm_30)" {7}, object
>        9: offload, "device-cuda (nvptx64-nvidia-cuda:sm_30)" {6}, assembler
>   10: input, "/home/michliao/dummy.cpp", cuda, (device-cuda, sm_60)
>    11: preprocessor, {10}, cuda-cpp-output, (device-cuda, sm_60)
>     12: compiler, {11}, ir, (device-cuda, sm_60)
>      13: backend, {12}, assembler, (device-cuda, sm_60)
>       14: assembler, {13}, object, (device-cuda, sm_60)
>        15: offload, "device-cuda (nvptx64-nvidia-cuda:sm_60)" {14}, object
>        16: offload, "device-cuda (nvptx64-nvidia-cuda:sm_60)" {13}, assembler
>         17: linker, {8, 9, 15, 16}, cuda-fatbin, (device-cuda)
>          18: offload, "host-cuda (x86_64-unknown-linux-gnu)" {2}, "device-cuda (nvptx64-nvidia-cuda)" {17}, ir
>           19: backend, {18}, assembler, (host-cuda)
>            20: assembler, {19}, object, (host-cuda)
>


As the top-level actions are the last actions to be performed, they should have no indentation

In D69124#1713427 <https://reviews.llvm.org/D69124#1713427>, @tra wrote:

> This is... rather oddly-structured output. My brain refuses to accept that the most-indented phase is the input.
>  Perhaps we should do `llvm::errs().indent(MaxIdent-Ident)`. This should give us something like this (withMaxIdent=9), which is somewhat easier to grok, IMO:
>
>       0: input, "/home/michliao/dummy.cpp", cuda, (host-cuda)
>        1: preprocessor, {0}, cuda-cpp-output, (host-cuda)
>         2: compiler, {1}, ir, (host-cuda)
>   3: input, "/home/michliao/dummy.cpp", cuda, (device-cuda, sm_30)
>    4: preprocessor, {3}, cuda-cpp-output, (device-cuda, sm_30)
>     5: compiler, {4}, ir, (device-cuda, sm_30)
>      6: backend, {5}, assembler, (device-cuda, sm_30)
>       7: assembler, {6}, object, (device-cuda, sm_30)
>        8: offload, "device-cuda (nvptx64-nvidia-cuda:sm_30)" {7}, object
>        9: offload, "device-cuda (nvptx64-nvidia-cuda:sm_30)" {6}, assembler
>   10: input, "/home/michliao/dummy.cpp", cuda, (device-cuda, sm_60)
>    11: preprocessor, {10}, cuda-cpp-output, (device-cuda, sm_60)
>     12: compiler, {11}, ir, (device-cuda, sm_60)
>      13: backend, {12}, assembler, (device-cuda, sm_60)
>       14: assembler, {13}, object, (device-cuda, sm_60)
>        15: offload, "device-cuda (nvptx64-nvidia-cuda:sm_60)" {14}, object
>        16: offload, "device-cuda (nvptx64-nvidia-cuda:sm_60)" {13}, assembler
>         17: linker, {8, 9, 15, 16}, cuda-fatbin, (device-cuda)
>          18: offload, "host-cuda (x86_64-unknown-linux-gnu)" {2}, "device-cuda (nvptx64-nvidia-cuda)" {17}, ir
>           19: backend, {18}, assembler, (host-cuda)
>            20: assembler, {19}, object, (host-cuda)
>


it's difficult to choose a proper `MaxIdent` though to avoid unnecessary leading whitespaces or misalign the output. How about we draw the tree edges in the original output? It looks much easier for me to identify sibling actions.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69124/new/

https://reviews.llvm.org/D69124





More information about the cfe-commits mailing list