This is an archive of the discontinued LLVM Phabricator instance.

[CodeGen] Add standard print/debug utilities to MVT
ClosedPublic

Authored by reames on Feb 7 2023, 9:10 AM.

Details

Summary

Doing so makes it easier to do printf style debugging in idiomatic manner. I followed the code structure of Value with only the definition of dump being #ifdef out in non-debug builds. Not sure if this is the "right" option; we don't seem to have any single consistent scheme on how dump is handled.

Note: This is a follow up to D143454 which did the same for EVT.

Diff Detail

Event Timeline

reames created this revision.Feb 7 2023, 9:10 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 7 2023, 9:10 AM
reames requested review of this revision.Feb 7 2023, 9:10 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 7 2023, 9:10 AM
craig.topper added inline comments.Feb 7 2023, 10:24 AM
llvm/lib/CodeGen/ValueTypes.cpp
620

Is this a library layering issue?

reames added inline comments.Feb 7 2023, 10:35 AM
llvm/lib/CodeGen/ValueTypes.cpp
620

Yes, but not a new one. MVT::getVT is defined a couple lines above, so if that links, so should this.

craig.topper accepted this revision.Feb 7 2023, 10:38 AM

LGTM

llvm/lib/CodeGen/ValueTypes.cpp
620

I suppose it means that dump wouldn't work from gdb for tblgen, but would for other tools?

This revision is now accepted and ready to land.Feb 7 2023, 10:38 AM
This revision was landed with ongoing or failed builds.Feb 7 2023, 10:50 AM
This revision was automatically updated to reflect the committed changes.

What about the use of this in TableGen?

It doesn't link to CodeGen (which has the EVT::getEVTString implementation) due to layering constraints, as far as I know, anyway.

reames added a comment.Feb 8 2023, 7:28 AM

What about the use of this in TableGen?

It doesn't link to CodeGen (which has the EVT::getEVTString implementation) due to layering constraints, as far as I know, anyway.

First, let me confirm. You are *not* seeing a build failure right? I've gotten no builbot failures here which look plausibly connected, but just checking.

Second, what usage in tablegen? Do you mean in source? If so, I can't find any such. If you mean from GDB, then no, it wouldn't work. If you have a suggestion on a better place for this, please let me know. It needs to be somewhere I can move the existing MVT:: definitions as well. I followed the existing precedent for MVT definitions here.