This is an archive of the discontinued LLVM Phabricator instance.

[NFC][RISCV] Make the macro names more uniform
ClosedPublic

Authored by achieveartificialintelligence on Jan 5 2022, 7:07 PM.

Diff Detail

Event Timeline

achieveartificialintelligence requested review of this revision.Jan 5 2022, 7:07 PM
Herald added a project: Restricted Project. · View Herald TranscriptJan 5 2022, 7:07 PM
craig.topper added inline comments.Jan 5 2022, 7:50 PM
llvm/lib/Target/RISCV/MCTargetDesc/RISCVInstPrinter.cpp
27 ↗(On Diff #397772)

Revert this. Most targets uses "asm-printer". This is common functionality on all targets, there doesn't need to be a different way to spell it for RISCV.

llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCCodeEmitter.cpp
33 ↗(On Diff #397772)

Same, "mccodeemitter" is used by the majority of targets.

llvm/lib/Target/RISCV/RISCVAsmPrinter.cpp
34 ↗(On Diff #397772)

This seems to have more inconsistency between targets, but every target has this file so I don't see why we need a different string for RISCV.

jrtc27 added a comment.Jan 5 2022, 8:20 PM

I could've sworn I stumbled upon guidance the other day about using standard names for things that exist for all targets, but can't for the life of me find it today

asb added a comment.Jan 6 2022, 2:59 AM

Thanks for the patch. I wouldn't mark this as NFC, because the DEBUG_TYPE changes will impact backend developers using -debug-only to control debug messages. It would be worth noting this impact in the commit message too.

I've gone through and I think I'm slightly against most of the proposed DEBUG_TYPE changes. It doesn't always make sense to copy what other targets do (after all, one hope with the RISC-V backend was to try to avoid that copy and paste approach), but I think it's probably advantageous that the same format of -debug-only invocations is common across backends, even if the names themselves aren't always the best (or consistent in style).

llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCExpr.cpp
28 ↗(On Diff #397785)

I was mirroring other targets with this one (e.g. Sparc, Mips, Lanai). But I don't think this is used enough that it's necessary to follow these. I'd suggest riscv-mcexpr is a better change though (and also matches HexagonMCExpr).

llvm/lib/Target/RISCV/RISCVISelDAGToDAG.cpp
28 ↗(On Diff #397785)

Basically all other archs use $target-isel for this, so it would be best to keep it the same.

llvm/lib/Target/RISCV/RISCVISelLowering.cpp
43 ↗(On Diff #397785)

This is another one that matches what almost all other targets do (a few call it $target-isel instead), so would be best left unchanged.

llvm/lib/Target/RISCV/RISCVInstructionSelector.cpp
22 ↗(On Diff #397785)

This also matches other targets (AArch64, AMDGPU, Arm, M68k, Mips).

llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp
16 ↗(On Diff #397785)

Again, the current name matches the format used for other backends.

asb added a reviewer: asb.Jan 6 2022, 3:00 AM
achieveartificialintelligence marked 5 inline comments as done.

Address @asb 's comments.

This revision is now accepted and ready to land.Jan 6 2022, 6:09 PM

I could've sworn I stumbled upon guidance the other day about using standard names for things that exist for all targets, but can't for the life of me find it today

For future reference, https://llvm.org/docs/ProgrammersManual.html#fine-grained-debug-info-with-debug-type-and-the-debug-only-option is that documentation