aboutsummaryrefslogtreecommitdiff
path: root/backend/include/rcc/CodeGen/GlobalISel/InstructionSelect.h
blob: 174a94323d44c96adcc586eb19159d11fc76969d (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
// SPDX-License-Identifier: GPL-3.0-or-later

#ifndef RCC_CODEGEN_GLOBALISEL_INSTRUCTIONSELECT_H
#define RCC_CODEGEN_GLOBALISEL_INSTRUCTIONSELECT_H

#include "rcc/CodeGen/GlobalISel/InstructionSelector.h"
#include "rcc/CodeGen/MachinePassManager.h"

namespace rcc {

class InstructionSelect final : public MachineFunctionPass {
public:
  explicit InstructionSelect(const InstructionSelector *Info) : Info(Info) {}
  explicit InstructionSelect(const InstructionSelector &Info) : Info(&Info) {}

  [[nodiscard]] const MachinePassContract &contract() const noexcept override;
  [[nodiscard]] Expected<MachinePassResult> run(MachineFunction &Function,
                                                const TargetDescription &Target,
                                                MachineFunctionAnalysisManager &Analyses) override;

private:
  [[nodiscard]] Expected<MachinePassResult> runImplementation(MachineFunction &Function,
                                                              const TargetDescription &Target,
                                                              MachineFunctionAnalysisManager
                                                                  &Analyses);

  const InstructionSelector *Info;
};

} // namespace rcc

#endif // RCC_CODEGEN_GLOBALISEL_INSTRUCTIONSELECT_H