aboutsummaryrefslogtreecommitdiff
path: root/backend/lib/CodeGen/RegAllocBasic.h
blob: f88c977b912a189d8f08a07a3a2a5e902c621c53 (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
// SPDX-License-Identifier: GPL-3.0-or-later

// The private header has no stable include-root-relative guard name.
// NOLINTNEXTLINE(llvm-header-guard)
#ifndef RCC_LIB_CODEGEN_REGALLOCBASIC_H
#define RCC_LIB_CODEGEN_REGALLOCBASIC_H

#include "rcc/CodeGen/RegAllocCommon.h"
#include "rcc/CodeGen/TargetRegisterAllocationInfo.h"

namespace rcc {

class BasicAllocatorPass final : public MachineFunctionPass {
public:
  explicit BasicAllocatorPass(const TargetRegisterAllocationInfo &Info,
                              RegisterAllocationOptions Options = {}) noexcept
      : Info(&Info), Options(Options) {}

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

private:
  const TargetRegisterAllocationInfo *Info;
  RegisterAllocationOptions Options;
};

} // namespace rcc

#endif // RCC_LIB_CODEGEN_REGALLOCBASIC_H