aboutsummaryrefslogtreecommitdiff
path: root/backend/lib/Target/RISCV/RISCVRegisterAllocation.cpp
diff options
context:
space:
mode:
authorRichard-Qin-X <richard.qin.001@gmail.com>2026-08-12 02:35:25 +0800
committerRichard-Qin-X <richard.qin.001@gmail.com>2026-08-12 02:35:25 +0800
commit705ebca5d37ee30e9cd517fed5f09dbf12113e6b (patch)
tree9e7c12f4bb169f6d6608435b5fd3117fd400eca0 /backend/lib/Target/RISCV/RISCVRegisterAllocation.cpp
parent0e73b1821cacb453c307cc1b9f35e989321b8e42 (diff)
downloadrcc-project-705ebca5d37ee30e9cd517fed5f09dbf12113e6b.tar.gz
rcc-project-705ebca5d37ee30e9cd517fed5f09dbf12113e6b.tar.xz
[RISCV] Make target memory operands optional
Diffstat (limited to 'backend/lib/Target/RISCV/RISCVRegisterAllocation.cpp')
-rw-r--r--backend/lib/Target/RISCV/RISCVRegisterAllocation.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/backend/lib/Target/RISCV/RISCVRegisterAllocation.cpp b/backend/lib/Target/RISCV/RISCVRegisterAllocation.cpp
index 055b67b..d14e802 100644
--- a/backend/lib/Target/RISCV/RISCVRegisterAllocation.cpp
+++ b/backend/lib/Target/RISCV/RISCVRegisterAllocation.cpp
@@ -178,9 +178,11 @@ public:
for (const InstructionOpcode OpcodeValue : {Form->Load, Form->Store}) {
const InstructionDescriptor *Instruction =
Target.instructionDescriptor(targetOpcode(OpcodeValue));
+ const InstructionFlag MemoryFlag =
+ OpcodeValue == Form->Load ? InstructionFlag::MayLoad : InstructionFlag::MayStore;
if (Instruction == nullptr || Instruction->Operands.size() != 3 ||
!Instruction->Operands[1].Kinds.contains(MachineOperand::Kind::FrameIndex) ||
- !Instruction->RequiresMemoryOperands) {
+ !Instruction->Flags.has(MemoryFlag)) {
return makeUnexpected(ErrorCode::InternalError,
"RV64GC spill instruction descriptor is incomplete");
}