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

Paul Kirth via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 7 14:39:49 PDT 2022


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-than` we have enough information to print all stack slots, their size, and position relative to SP. If we have debug info, we can print all the variables, and which slots they map to. It doesn't give you live ranges, but they shouldn't map to multiple slots anyway. For spill slots, I don't think it's worth doing much other than to show they exist. 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.

I'm probably going to be tied up w/ other work for a bit, so I don't expect to finish the prototype very soon, but it's at least POC.

`clang -Wframe-larger-than=0 frame-diags.c -c -o /dev/null -g -O2` is the command I've been using locally. Whenever that warning fires, we print the stack layout.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D135488



More information about the cfe-commits mailing list