diff options
| author | Richard-Qin-X <richard.qin.001@gmail.com> | 2026-08-15 00:38:20 +0800 |
|---|---|---|
| committer | Richard-Qin-X <richard.qin.001@gmail.com> | 2026-08-15 00:38:20 +0800 |
| commit | f6fdfb8d484b4e52cdb24a94a31b0f00d41a5eb7 (patch) | |
| tree | 9362d0230db6174acdbe095288f4bbb1c4a896a9 /backend/include/rcc/CodeGen/GlobalISel/GenericMachineInstrs.h | |
| parent | 7e2660ad5b7ec5b74cafed27f674939691f9e0fc (diff) | |
| download | rcc-project-f6fdfb8d484b4e52cdb24a94a31b0f00d41a5eb7.tar.gz rcc-project-f6fdfb8d484b4e52cdb24a94a31b0f00d41a5eb7.tar.xz | |
[GlobalISel] Match LLVM CSE builder result semantics
Diffstat (limited to 'backend/include/rcc/CodeGen/GlobalISel/GenericMachineInstrs.h')
| -rw-r--r-- | backend/include/rcc/CodeGen/GlobalISel/GenericMachineInstrs.h | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/backend/include/rcc/CodeGen/GlobalISel/GenericMachineInstrs.h b/backend/include/rcc/CodeGen/GlobalISel/GenericMachineInstrs.h index d0a176d..ea3532c 100644 --- a/backend/include/rcc/CodeGen/GlobalISel/GenericMachineInstrs.h +++ b/backend/include/rcc/CodeGen/GlobalISel/GenericMachineInstrs.h @@ -20,7 +20,9 @@ public: [[nodiscard]] Register getReg(std::size_t Index) const { const MachineOperand *Operand = operandAt(Index); assert(Operand != nullptr && Operand->isRegister()); - return *Operand->registerValue(); + const Register *Reg = Operand->getIf<Register>(); + assert(Reg != nullptr); + return *Reg; } [[nodiscard]] static bool classof(const MachineInstr *Instruction) noexcept { @@ -99,8 +101,7 @@ template <typename InstructionT> } template <typename InstructionT> -[[nodiscard]] const InstructionT & -castGenericMachineInstr(const MachineInstr &Instruction) { +[[nodiscard]] const InstructionT &castGenericMachineInstr(const MachineInstr &Instruction) { assert(InstructionT::classof(&Instruction)); return static_cast<const InstructionT &>(Instruction); } |
