From fd492f788429a7ad32ad2a19776fcb5a8d8ee263 Mon Sep 17 00:00:00 2001 From: Sam Elliott Date: Thu, 6 Feb 2025 21:26:03 -0800 Subject: [PATCH] [RISCV] Improve RISCVOperand Printing We've gradually added more information to the RISCVOperand structure, but the debug output has never caught up, which is quite confusing. This adds printing for many of additional the fields in the structure, where they are relevant. In addition to this, we now have quite a lot of internal registers which share names with each other - e.g. X0_H, X0_W, X0, X0_Pair all have the same name - so also print the enum value to differentiate these. --- llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp b/llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp index c51c4201ebd18..069c77810c9d6 100644 --- a/llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp +++ b/llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp @@ -1116,18 +1116,21 @@ struct RISCVOperand final : public MCParsedAsmOperand { switch (Kind) { case KindTy::Immediate: - OS << *getImm(); + OS << ""; break; case KindTy::FPImmediate: + OS << ""; break; case KindTy::Register: - OS << ""; + OS << "" : ")>"); break; case KindTy::Token: OS << "'" << getToken() << "'"; break; case KindTy::SystemRegister: - OS << "'; + OS << ""; break; case KindTy::VType: OS << "