This is an archive of the discontinued LLVM Phabricator instance.

[Visualizers] Add natvis visualizers for various internal llvm classes
ClosedPublic

Authored by Trass3r on Oct 11 2022, 9:00 AM.

Details

Summary

Also improve DisplayStrings for array and string types.

Diff Detail

Event Timeline

Trass3r created this revision.Oct 11 2022, 9:00 AM
Herald added a project: Restricted Project. · View Herald TranscriptOct 11 2022, 9:00 AM
Trass3r published this revision for review.Oct 11 2022, 9:07 AM

@curdeius I built these up over time and would like to upstream them.
Some of them may be out of date now and some things were tricky like the Uses/User stuff so I could use some feedback in general to polish it.

Herald added a project: Restricted Project. · View Herald TranscriptOct 11 2022, 9:07 AM
RKSimon added inline comments.Oct 19 2022, 12:38 AM
llvm/utils/LLVMVisualizers/llvm.natvis
32

Any chance that we can have ArrayRef and SmallVectorImpl show a more similar representation?

Trass3r added inline comments.Oct 19 2022, 2:51 PM
llvm/utils/LLVMVisualizers/llvm.natvis
32

You mean simplifying SmallVector?
Or changing this one?

RKSimon added inline comments.Oct 20 2022, 7:39 AM
llvm/utils/LLVMVisualizers/llvm.natvis
32

Whichever is easier would be fine

FWIW, the changes look reasonable to me. I don't do a whole lot of debugging in LLVM though, so I don't have a good feel for how well the visualizers work in practice.

RKSimon added inline comments.Oct 26 2022, 3:24 AM
llvm/utils/LLVMVisualizers/llvm.natvis
374

Don't we already have a APInt entry near the top?

Trass3r added inline comments.Oct 26 2022, 10:36 AM
llvm/utils/LLVMVisualizers/llvm.natvis
374

Good catch. Back then it didn't exist.

Trass3r updated this revision to Diff 473511.Nov 6 2022, 2:40 PM

remove duplicate APInt
update SmallVector

Trass3r marked 3 inline comments as done.Nov 6 2022, 2:41 PM
RKSimon accepted this revision.Nov 7 2022, 5:41 AM

Cheers - LGTM with a couple of minors - setting "Tools->Options->Debugging->Ouput Window.NatvisDiagnosticMessages" to verbose seems to be (mostly) happy.

I'm wondering whether this needs to be sorted better (alphanumerically or by context) to make it easier to keep track of all the classes, but its not really that important.

llvm/utils/LLVMVisualizers/llvm.natvis
32

I'm seeing a NatVis verbose warning from this:

Natvis: E:\llvm\llvm-project\llvm\utils\LLVMVisualizers\llvm.natvis(30,4): Warning: Unable to load a visualized preview for type 'llvm::ArrayRef<int>' because the conditions of all <DisplayString> elements were false.
305

Does this work? It always seems to display "{llvm::SDNode ???}" for me

This revision is now accepted and ready to land.Nov 7 2022, 5:41 AM
Trass3r added inline comments.Nov 7 2022, 7:14 AM
llvm/utils/LLVMVisualizers/llvm.natvis
32

Hmm the conditions do cover all values.
Do we perhaps need a <DisplayString>Uninitialized</DisplayString> like above?

305

The method still exists, maybe something goes wrong when it tries to call it?

RKSimon added inline comments.Nov 7 2022, 8:02 AM
llvm/utils/LLVMVisualizers/llvm.natvis
305

Does it work for you? I'm using VS2022 here.

Otherwise maybe we just cast to (llvm::ISD::NodeType) if < BUILTIN_OP_END ? We can keep the getOperationName call as the fallback

Trass3r updated this revision to Diff 473694.Nov 7 2022, 8:44 AM

change SDNode DisplayString

Trass3r updated this revision to Diff 473697.Nov 7 2022, 8:47 AM
Trass3r marked 2 inline comments as done.

add this-> to make it clear

Trass3r added inline comments.Nov 7 2022, 8:49 AM
llvm/utils/LLVMVisualizers/llvm.natvis
305

It may have been an unfinished experiment. I replaced it with the NodeType to keep it simple.

Trass3r updated this revision to Diff 473698.Nov 7 2022, 8:50 AM

add fallback DisplayString for ArrayRef

Trass3r marked an inline comment as done.Nov 7 2022, 8:50 AM
RKSimon accepted this revision.Nov 7 2022, 8:54 AM

cheers

Thanks, could you also commit it? I don't have the rights.