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

#ifndef RCC_CODEGEN_MACHINESCHEDULER_H
#define RCC_CODEGEN_MACHINESCHEDULER_H

#include "rcc/CodeGen/MachinePassManager.h"

#include <cstddef>

namespace rcc {

class TargetSchedulingModel;

struct MachineSchedulerOptions final {
  std::size_t MaximumRegionSize = 512;
  bool EnableBidirectionalScheduling = true;
  bool EmitDebugOutput = false;
};

class MachineSchedulerPass final : public MachineFunctionPass {
public:
  explicit MachineSchedulerPass(const TargetSchedulingModel &Model,
                                MachineSchedulerOptions Options = {}) noexcept
      : Model(&Model), Options(Options) {}

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

private:
  const TargetSchedulingModel *Model;
  MachineSchedulerOptions Options;
};

} // namespace rcc

#endif // RCC_CODEGEN_MACHINESCHEDULER_H