aboutsummaryrefslogtreecommitdiff
path: root/backend/lib/Target/RISCV/GISel/RISCVLegalizerInfo.h
blob: f6ba00097e3573602452f15584df269c1e697e5e (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
// SPDX-License-Identifier: GPL-3.0-or-later

#ifndef RCC_LIB_TARGET_RISCV_GISEL_RISCVLEGALIZERINFO_H
#define RCC_LIB_TARGET_RISCV_GISEL_RISCVLEGALIZERINFO_H

#include "rcc/CodeGen/GlobalISel/LegalizerInfo.h"

namespace rcc::riscv {

class RISCVSubtarget;

class RISCVLegalizerInfo final : public LegalizerInfo {
public:
  explicit RISCVLegalizerInfo(const RISCVSubtarget &Subtarget) : Subtarget(Subtarget) {}

  [[nodiscard]] Expected<LegalizationAction>
  classify(const MachineInstr &Instruction, const MachineFunction &Function,
           const TargetDescription &Target) const override;
  [[nodiscard]] Expected<void> lower(MachineInstr &Instruction, MachineFunction &Function,
                                     const TargetDescription &Target,
                                     LegalizationAction Action) const override;

private:
  const RISCVSubtarget &Subtarget;
};

} // namespace rcc::riscv

#endif // RCC_LIB_TARGET_RISCV_GISEL_RISCVLEGALIZERINFO_H