aboutsummaryrefslogtreecommitdiff
path: root/backend/utils/TableGen
diff options
context:
space:
mode:
authorRichard-Qin-X <richard.qin.001@gmail.com>2026-08-17 02:56:45 +0800
committerRichard-Qin-X <richard.qin.001@gmail.com>2026-08-17 02:56:45 +0800
commit53145c4020d237d2572b4109e0d425863dc34f9b (patch)
tree8f53b75dc3e3fd64bc6faec420620fcaf12b2233 /backend/utils/TableGen
parent103299abab6922f450671baa76e34ad746ac4312 (diff)
downloadrcc-project-53145c4020d237d2572b4109e0d425863dc34f9b.tar.gz
rcc-project-53145c4020d237d2572b4109e0d425863dc34f9b.tar.xz
[RISCV][GlobalISel] Generate implicit-def selection
Diffstat (limited to 'backend/utils/TableGen')
-rw-r--r--backend/utils/TableGen/Common/CodeGenSelection.cpp15
1 files changed, 10 insertions, 5 deletions
diff --git a/backend/utils/TableGen/Common/CodeGenSelection.cpp b/backend/utils/TableGen/Common/CodeGenSelection.cpp
index d3bc299..95a924f 100644
--- a/backend/utils/TableGen/Common/CodeGenSelection.cpp
+++ b/backend/utils/TableGen/Common/CodeGenSelection.cpp
@@ -416,10 +416,14 @@ bool CodeGenTarget::normalizeSelectionRules(NormalizedTargetModel &Result) {
const auto ResultOpcode = resolveOpcode(Result, Action.ResultOpcodeSymbol);
const NormalizedInstruction *ResultInstruction =
findInstructionBySymbol(Result, Action.ResultOpcodeSymbol);
- if (!ResultOpcode || ResultInstruction == nullptr ||
- isGenericOpcode(Opcode::fromValue(*ResultOpcode)) ||
- std::ranges::contains(ResultInstruction->Flags, "Generic")) {
- fail(Action.Range, "selection instruction opcode must name a declared target instruction");
+ const bool IsCorePseudo =
+ ResultOpcode && isCorePseudoOpcode(Opcode::fromValue(*ResultOpcode));
+ if (!ResultOpcode || (ResultInstruction == nullptr && !IsCorePseudo) ||
+ (ResultInstruction != nullptr &&
+ (isGenericOpcode(Opcode::fromValue(*ResultOpcode)) ||
+ std::ranges::contains(ResultInstruction->Flags, "Generic")))) {
+ fail(Action.Range,
+ "selection instruction opcode must name a declared target instruction or core pseudo");
return false;
}
if (Action.ReplacesRoot == HasRootAction || (Action.ReplacesRoot && ActionIndex != 0)) {
@@ -428,7 +432,8 @@ bool CodeGenTarget::normalizeSelectionRules(NormalizedTargetModel &Result) {
return false;
}
HasRootAction |= Action.ReplacesRoot;
- if (ResultInstruction->Operands.size() != Action.OperandRenderers.size()) {
+ if (ResultInstruction != nullptr &&
+ ResultInstruction->Operands.size() != Action.OperandRenderers.size()) {
fail(Action.Range, "selection instruction has an incompatible operand count");
return false;
}