From 8be4d04455f70892a94d1e0798e266c948b4750a Mon Sep 17 00:00:00 2001 From: Richard-Qin-X Date: Fri, 14 Aug 2026 04:33:41 +0800 Subject: [CodeGen] Match LLVM Legalizer ownership --- backend/include/rcc/CodeGen/MachineIRBuilder.h | 34 ++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'backend/include/rcc/CodeGen/MachineIRBuilder.h') diff --git a/backend/include/rcc/CodeGen/MachineIRBuilder.h b/backend/include/rcc/CodeGen/MachineIRBuilder.h index b8ff248..01cd648 100644 --- a/backend/include/rcc/CodeGen/MachineIRBuilder.h +++ b/backend/include/rcc/CodeGen/MachineIRBuilder.h @@ -178,8 +178,42 @@ public: } [[nodiscard]] Expected buildInstr(Opcode InstructionOpcode) const; + [[nodiscard]] Expected buildTrunc(Register Destination, Register Source) const; + [[nodiscard]] Expected buildCopy(Register Destination, Register Source) const; + [[nodiscard]] Expected buildImplicitDef(Register Destination) const; + [[nodiscard]] Expected buildAnyExt(Register Destination, + Register Source) const; + [[nodiscard]] Expected buildZExt(Register Destination, Register Source) const; + [[nodiscard]] Expected buildSExt(Register Destination, Register Source) const; + [[nodiscard]] Expected buildAnyExtOrTrunc(Register Destination, + Register Source) const; + [[nodiscard]] Expected buildSExtOrTrunc(Register Destination, + Register Source) const; + [[nodiscard]] Expected buildConstant(Register Destination, APInt Value) const; + [[nodiscard]] Expected buildConstant(Register Destination, + std::int64_t Value) const; + [[nodiscard]] Expected buildSExtInReg(Register Destination, Register Source, + std::uint32_t Width) const; + [[nodiscard]] Expected buildAnd(Register Destination, Register Left, + Register Right) const; + [[nodiscard]] Expected buildMergeValues( + Register Destination, const std::vector &Sources) const; + [[nodiscard]] Expected buildUnmergeValues( + const std::vector &Destinations, Register Source) const; + [[nodiscard]] Expected buildExtract(Register Destination, Register Source, + std::uint64_t Offset) const; private: + [[nodiscard]] Expected buildUnary(Opcode InstructionOpcode, + Register Destination, + Register Source) const; + [[nodiscard]] Expected buildBinary(Opcode InstructionOpcode, + Register Destination, Register Left, + Register Right) const; + [[nodiscard]] Expected buildExtOrTrunc(Opcode ExtensionOpcode, + Register Destination, + Register Source) const; + [[nodiscard]] Expected registerType(Register Reg) const; [[nodiscard]] Expected validateBlock(const MachineBasicBlock &Block) const; [[nodiscard]] Expected validateInstruction(const MachineInstr &Instruction) const; -- cgit v1.2.3