blob: 9a34898797007881ac69894b37132d5ebfd3b1e8 (
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
40
41
42
43
44
45
46
47
|
// SPDX-License-Identifier: GPL-3.0-or-later
#ifndef RCC_CODEGEN_GLOBALISEL_LEGALIZERHELPER_H
#define RCC_CODEGEN_GLOBALISEL_LEGALIZERHELPER_H
#include "rcc/CodeGen/GenericOpcodes.h"
#include "rcc/CodeGen/GlobalISel/LegalizerInfo.h"
#include "rcc/CodeGen/MachineIRBuilder.h"
#include "rcc/Support/Error.h"
namespace rcc {
class MachineFunction;
class MachineInstr;
class GISelChangeObserver;
class LegalizerHelper final {
public:
MachineIRBuilder &MIRBuilder;
GISelChangeObserver &Observer;
LegalizerHelper(MachineFunction &Function, const LegalizerInfo &Info,
GISelChangeObserver &Observer, MachineIRBuilder &MIRBuilder);
[[nodiscard]] Expected<void> legalize(MachineInstr &Instruction,
const LegalizationDecision &Decision);
[[nodiscard]] Expected<void> lower(MachineInstr &Instruction,
const LegalizationDecision &Decision);
[[nodiscard]] Expected<void> lowerVAArg(MachineInstr &Instruction);
[[nodiscard]] Expected<void> widenScalar(MachineInstr &Instruction, std::size_t TypeIndex,
LowLevelType WideType);
[[nodiscard]] Expected<void> widenScalarSrc(MachineInstr &Instruction, LowLevelType WideType,
std::size_t OperandIndex,
GenericOpcode ExtensionOpcode);
[[nodiscard]] Expected<void> widenScalarDst(MachineInstr &Instruction, LowLevelType WideType,
std::size_t OperandIndex = 0,
GenericOpcode TruncOpcode = GenericOpcode::G_TRUNC);
private:
MachineFunction &Function;
MachineRegisterInfo &MRI;
const LegalizerInfo &Info;
};
} // namespace rcc
#endif // RCC_CODEGEN_GLOBALISEL_LEGALIZERHELPER_H
|