From 0bb35fa2306a66f1f0baf118619b5c1640ed9c01 Mon Sep 17 00:00:00 2001 From: Richard-Qin-X Date: Wed, 12 Aug 2026 21:56:37 +0800 Subject: [GlobalISel] Split the generic pipeline components --- backend/include/rcc/CodeGen/TargetCodeGen.h | 95 ----------------------------- 1 file changed, 95 deletions(-) delete mode 100644 backend/include/rcc/CodeGen/TargetCodeGen.h (limited to 'backend/include/rcc/CodeGen/TargetCodeGen.h') diff --git a/backend/include/rcc/CodeGen/TargetCodeGen.h b/backend/include/rcc/CodeGen/TargetCodeGen.h deleted file mode 100644 index 65f65a4..0000000 --- a/backend/include/rcc/CodeGen/TargetCodeGen.h +++ /dev/null @@ -1,95 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0-or-later - -#ifndef RCC_CODEGEN_TARGETCODEGEN_H -#define RCC_CODEGEN_TARGETCODEGEN_H - -#include "rcc/Support/Error.h" - -#include - -namespace rcc { - -class MachineFunction; -class MachineInstr; -class TargetDescription; -struct VirtualRegisterInfo; - -enum class LegalizationAction : std::uint8_t { - Legal, - Unsupported, - Custom, - Lower, - Libcall, - WidenScalar, - NarrowScalar, - MoreElements, - FewerElements, - Bitcast, - ChangeElementType, - ChangeAddressSpace, -}; - -class TargetLegalizerInfo { -public: - virtual ~TargetLegalizerInfo() = default; - - [[nodiscard]] virtual Expected - classify(const MachineInstr &Instruction, const MachineFunction &Function, - const TargetDescription &Target) const = 0; - - [[nodiscard]] virtual Expected lower(MachineInstr &Instruction, MachineFunction &Function, - const TargetDescription &Target, - LegalizationAction Action) const = 0; - - // This hook performs read-only target checks before a lowering mutation is committed. - [[nodiscard]] virtual Expected validateLowering(const MachineInstr &, - const MachineFunction &, - const TargetDescription &, - LegalizationAction) const { - return {}; - } -}; - -class TargetRegisterBankInfo { -public: - virtual ~TargetRegisterBankInfo() = default; - - [[nodiscard]] virtual Expected - selectBank(const MachineFunction &Function, Register Reg, const VirtualRegisterInfo &Info, - const MachineInstr *Context, const TargetDescription &Target) const = 0; - - [[nodiscard]] virtual Expected - constrainInstruction(MachineInstr &Instruction, MachineFunction &Function, - const TargetDescription &Target) const = 0; - - // This hook must not mutate MachineIR. It allows the pass to reject a bad mapping - // before publishing any bank or class assignment. - [[nodiscard]] virtual Expected validateInstruction(const MachineInstr &, - const MachineFunction &, - const TargetDescription &) const { - return {}; - } -}; - -class TargetInstructionSelector { -public: - virtual ~TargetInstructionSelector() = default; - - [[nodiscard]] virtual Expected select(MachineInstr &Instruction, MachineFunction &Function, - const TargetDescription &Target) const = 0; - - // Selection matching is read-only and must complete before select() mutates MachineIR. - [[nodiscard]] virtual Expected canSelect(const MachineInstr &, const MachineFunction &, - const TargetDescription &) const { - return {}; - } - - [[nodiscard]] virtual Expected - constrainSelectedInstruction(MachineInstr &, MachineFunction &, const TargetDescription &) const { - return {}; - } -}; - -} // namespace rcc - -#endif // RCC_CODEGEN_TARGETCODEGEN_H -- cgit v1.2.3