blob: 70b73408cbb5a6840f1a53632b0576bc3f90f98e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
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
|