[PATCH] D135488: [codegen][WIP] Display stack layouts in console

2022-10-21 Thread Paul Kirth via Phabricator via cfe-commits
paulkirth updated this revision to Diff 469840. paulkirth added a comment. git clang-format Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D135488/new/ https://reviews.llvm.org/D135488 Files: llvm/include/llvm/CodeGen/Passes.h llvm/include/llvm/

[PATCH] D135488: [codegen][WIP] Display stack layouts in console

2022-10-21 Thread Paul Kirth via Phabricator via cfe-commits
paulkirth updated this revision to Diff 469838. paulkirth added a comment. Misc cleanups and additional tests - replace stringstream formatting w/ formatv - misc cleanups to includes - fix some typos - add tests for arm and x86 - add more interesting test cases - try to reduce test size w/ llvm-r

[PATCH] D135488: [codegen][WIP] Display stack layouts in console

2022-10-20 Thread Paul Kirth via Phabricator via cfe-commits
paulkirth updated this revision to Diff 469446. paulkirth added a comment. Code Cleanups and Test Cases - Replace SmallVector with SmallPtrSet - Add some comments/clarification - Add a larger, more flexible test case There's still room for improvement for both testing and documentation. Reposi

[PATCH] D135488: [codegen][WIP] Display stack layouts in console

2022-10-19 Thread Reid Kleckner via Phabricator via cfe-commits
rnk added a comment. I think I was confused in that conversation because I wasn't sure where in the pass pipeline this was going to run. I heard various statements like "lost after ISel" and to me, ISel is like the first step of codegen, it comes before register allocation. What you've done mak

[PATCH] D135488: [codegen][WIP] Display stack layouts in console

2022-10-18 Thread Paul Kirth via Phabricator via cfe-commits
paulkirth added a subscriber: rnk. paulkirth added a comment. @rnk This is the prototype I mentioned the other night at the meetup. I'm pretty sure something like the `LiveDebugValues` pass has a mapping of all the debug information to locations that I'd ever need, but I'm not sure how to poke

[PATCH] D135488: [codegen][WIP] Display stack layouts in console

2022-10-18 Thread Paul Kirth via Phabricator via cfe-commits
paulkirth planned changes to this revision. paulkirth added a comment. I plan to add/update the tests, and give the new pass a few cleanups. The test code can probably be much smaller & have its debug info reduced significantly. There is also a lack of documentation. Repository: rG LLVM Gith

[PATCH] D135488: [codegen][WIP] Display stack layouts in console

2022-10-18 Thread Paul Kirth via Phabricator via cfe-commits
paulkirth updated this revision to Diff 468770. paulkirth added a comment. Herald added a reviewer: jdoerfert. Herald added subscribers: abrachet, sstefan1, pengfei, ormris. Refactor printing into a dedicated pass - add some basic lit tests - change the printing format to be more machine readable

[PATCH] D135488: [codegen][WIP] Display stack layouts in console

2022-10-12 Thread David Blaikie via Phabricator via cfe-commits
dblaikie added a comment. In D135488#3854624 , @nickdesaulniers wrote: > Playing around with `llvm-dwarfdump` today, I think I found an interesting > example: > > Consider the following DWARF DIE: > > 0x00017e5e: DW_TAG_variable >

[PATCH] D135488: [codegen][WIP] Display stack layouts in console

2022-10-12 Thread Nick Desaulniers via Phabricator via cfe-commits
nickdesaulniers added a comment. Playing around with `llvm-dwarfdump` today, I think I found an interesting example: Consider the following DWARF DIE: 0x00017e5e: DW_TAG_variable DW_AT_location (0x2144: [0x07c4,

[PATCH] D135488: [codegen][WIP] Display stack layouts in console

2022-10-11 Thread Petr Hosek via Phabricator via cfe-commits
phosek added a comment. This is just a nit, but I'd avoid extra formatting such as using `|` for separators and instead use just spaces and alignment akin to https://github.com/ClangBuiltLinux/frame-larger-than (or `llvm-readelf`) since that output tends to be easier to parse with tools like `c

[PATCH] D135488: [codegen][WIP] Display stack layouts in console

2022-10-11 Thread Nick Desaulniers via Phabricator via cfe-commits
nickdesaulniers added a comment. Nice! Diff 466919 fixes up my confusion regarding Slot vs SlotID. Though I do like how the Slots are sorted, since it keeps the Offsets in order FWICT. Maybe we could drop the SlotID column, then print out Slot for the variables, rather than the SlotID? I mean,

[PATCH] D135488: [codegen][WIP] Display stack layouts in console

2022-10-11 Thread Paul Kirth via Phabricator via cfe-commits
paulkirth updated this revision to Diff 466919. paulkirth added a comment. Add SlotID to output Improve some initialization Still need to do significant code cleanup and testing Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D135488/new/ https://re

[PATCH] D135488: [codegen][WIP] Display stack layouts in console

2022-10-11 Thread Paul Kirth via Phabricator via cfe-commits
paulkirth added inline comments. Comment at: clang/test/Frontend/frame-diags.c:1 +// TODO: This is not really a functional test yet, and needs to be rewritten. +// currently its just a copy of backend-diagnostics.c, and all of the run/test probinson wrote: > I

[PATCH] D135488: [codegen][WIP] Display stack layouts in console

2022-10-11 Thread Paul Robinson via Phabricator via cfe-commits
probinson added inline comments. Comment at: clang/test/Frontend/frame-diags.c:1 +// TODO: This is not really a functional test yet, and needs to be rewritten. +// currently its just a copy of backend-diagnostics.c, and all of the run/test I know this is a draf

[PATCH] D135488: [codegen][WIP] Display stack layouts in console

2022-10-07 Thread Paul Kirth via Phabricator via cfe-commits
paulkirth added a comment. In D135488#3844117 , @nickdesaulniers wrote: > Thanks for the patch, here's the output I observe from the LKML thread > : > https://paste.debian.net/

[PATCH] D135488: [codegen][WIP] Display stack layouts in console

2022-10-07 Thread Nick Desaulniers via Phabricator via cfe-commits
nickdesaulniers added a comment. (I totally think we should ship this, perhaps a Note: diagnostic that says to "rebuild with debug info and -fmy-new-flag-for-more-info") Probably not much precedence for those kind of warnings, but idk. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST

[PATCH] D135488: [codegen][WIP] Display stack layouts in console

2022-10-07 Thread Nick Desaulniers via Phabricator via cfe-commits
nickdesaulniers added a comment. Thanks for the patch, here's the output I observe from the LKML thread : https://paste.debian.net/1256338/. I think the stack slot numbers printed at the end aren't correct; the two large

[PATCH] D135488: [codegen][WIP] Display stack layouts in console

2022-10-07 Thread Nick Desaulniers via Phabricator via cfe-commits
nickdesaulniers added a comment. In D135488#3843992 , @paulkirth wrote: > Roland mentioned there's probably a clever way to do this using only DWARF, > but that it's probably simpler to do in the compiler backend. That's essentially what I do in: https

[PATCH] D135488: [codegen][WIP] Display stack layouts in console

2022-10-07 Thread Paul Kirth via Phabricator via cfe-commits
paulkirth added subscribers: nickdesaulniers, phosek. paulkirth added a comment. @nickdesaulniers @phosek You may be interested in this super hacky prototype. There's a bunch of things to improve(tests, output, code structure, plumbing...), but when we emit the diagnostic for `-Wframe-larger-tha

[PATCH] D135488: [codegen][WIP] Display stack layouts in console

2022-10-07 Thread Paul Kirth via Phabricator via cfe-commits
paulkirth created this revision. Herald added subscribers: mgrang, hiraditya. Herald added a project: All. paulkirth requested review of this revision. Herald added projects: clang, LLVM. Herald added subscribers: llvm-commits, cfe-commits. Issue #58168 describes the difficulty diagnosing stack si