diff options
| author | Richard-Qin-X <richard.qin.001@gmail.com> | 2026-08-12 21:56:37 +0800 |
|---|---|---|
| committer | Richard-Qin-X <richard.qin.001@gmail.com> | 2026-08-12 21:56:37 +0800 |
| commit | 0bb35fa2306a66f1f0baf118619b5c1640ed9c01 (patch) | |
| tree | 4333e77e9555295668b819c96890046d072eed5a /backend/include/rcc/CodeGen/RegisterBankInfo.h | |
| parent | f8daf08aba1f09c3024a70d3426891112d1662a2 (diff) | |
| download | rcc-project-0bb35fa2306a66f1f0baf118619b5c1640ed9c01.tar.gz rcc-project-0bb35fa2306a66f1f0baf118619b5c1640ed9c01.tar.xz | |
[GlobalISel] Split the generic pipeline components
Diffstat (limited to 'backend/include/rcc/CodeGen/RegisterBankInfo.h')
| -rw-r--r-- | backend/include/rcc/CodeGen/RegisterBankInfo.h | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/backend/include/rcc/CodeGen/RegisterBankInfo.h b/backend/include/rcc/CodeGen/RegisterBankInfo.h new file mode 100644 index 0000000..70b7340 --- /dev/null +++ b/backend/include/rcc/CodeGen/RegisterBankInfo.h @@ -0,0 +1,39 @@ +// SPDX-License-Identifier: GPL-3.0-or-later + +#ifndef RCC_CODEGEN_REGISTERBANKINFO_H +#define RCC_CODEGEN_REGISTERBANKINFO_H + +#include "rcc/CodeGen/MachineIRTypes.h" +#include "rcc/CodeGen/Register.h" +#include "rcc/Support/Error.h" + +namespace rcc { + +class MachineFunction; +class MachineInstr; +class TargetDescription; +struct VirtualRegisterInfo; + +class RegisterBankInfo { +public: + virtual ~RegisterBankInfo() = default; + + [[nodiscard]] virtual Expected<RegisterBankID> + selectBank(const MachineFunction &Function, Register Reg, const VirtualRegisterInfo &Info, + const MachineInstr *Context, const TargetDescription &Target) const = 0; + + [[nodiscard]] virtual Expected<void> + constrainInstruction(MachineInstr &Instruction, MachineFunction &Function, + const TargetDescription &Target) const = 0; + + // This hook rejects invalid mappings before bank or register-class state is published. + [[nodiscard]] virtual Expected<void> validateInstruction(const MachineInstr &, + const MachineFunction &, + const TargetDescription &) const { + return {}; + } +}; + +} // namespace rcc + +#endif // RCC_CODEGEN_REGISTERBANKINFO_H |
