From 864a29abbdce86353ec91c3587757711d3a42f10 Mon Sep 17 00:00:00 2001 From: Richard-Qin-X Date: Sun, 16 Aug 2026 17:28:49 +0800 Subject: [RISCV][GlobalISel] Generate integer comparisons --- backend/lib/CodeGen/TargetDescription.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'backend/lib/CodeGen/TargetDescription.cpp') diff --git a/backend/lib/CodeGen/TargetDescription.cpp b/backend/lib/CodeGen/TargetDescription.cpp index a867a5b..ab77965 100644 --- a/backend/lib/CodeGen/TargetDescription.cpp +++ b/backend/lib/CodeGen/TargetDescription.cpp @@ -17,6 +17,7 @@ #include #include #include +#include #include #include @@ -342,8 +343,12 @@ Expected TargetDescription::validateTargetOperand(const OperandDescriptor if (Descriptor != nullptr && Descriptor->RegClass) { const auto EffectiveClass = effectiveRegisterClass(Operand, RegInfo); if (!EffectiveClass || !Registers.isSubclass(*EffectiveClass, *Descriptor->RegClass)) { - return makeUnexpected(ErrorCode::VerificationError, - "virtual register class does not satisfy the operand descriptor"); + const std::string ActualClass = + EffectiveClass ? std::to_string(EffectiveClass->value()) : ""; + return makeUnexpected( + ErrorCode::VerificationError, + "virtual register class " + ActualClass + " does not satisfy required class " + + std::to_string(Descriptor->RegClass->value())); } } return {}; @@ -464,7 +469,9 @@ TargetDescription::validateExplicitOperands(Opcode InstructionOpcode, auto TargetValidation = validateTargetOperand(&descriptorForOperand(*Descriptor, Index), Operands[Index], RegInfo); if (!TargetValidation) - return std::unexpected(TargetValidation.error()); + return std::unexpected(withErrorContext( + TargetValidation.error(), "operand " + std::to_string(Index) + " of '" + + Descriptor->Name + "': ")); } return {}; } -- cgit v1.2.3