aboutsummaryrefslogtreecommitdiff
path: root/backend/lib/CodeGen/TargetDescription.cpp
diff options
context:
space:
mode:
authorRichard-Qin-X <richard.qin.001@gmail.com>2026-08-16 17:28:49 +0800
committerRichard-Qin-X <richard.qin.001@gmail.com>2026-08-16 17:28:49 +0800
commit864a29abbdce86353ec91c3587757711d3a42f10 (patch)
tree772390cad70fe8e47044f5c921174b254bd8297a /backend/lib/CodeGen/TargetDescription.cpp
parentca25d25d4c5131491a50b1a94e63e9b2d3c34ed4 (diff)
downloadrcc-project-864a29abbdce86353ec91c3587757711d3a42f10.tar.gz
rcc-project-864a29abbdce86353ec91c3587757711d3a42f10.tar.xz
[RISCV][GlobalISel] Generate integer comparisons
Diffstat (limited to 'backend/lib/CodeGen/TargetDescription.cpp')
-rw-r--r--backend/lib/CodeGen/TargetDescription.cpp13
1 files changed, 10 insertions, 3 deletions
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 <optional>
#include <ranges>
#include <span>
+#include <string>
#include <utility>
#include <vector>
@@ -342,8 +343,12 @@ Expected<void> 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()) : "<none>";
+ 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 {};
}