1//==- RegAllocFast.h ----------- fast register allocator ----------*-C++-*-==//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef LLVM_CODEGEN_REGALLOCFAST_H
10#define LLVM_CODEGEN_REGALLOCFAST_H
11
12#include "llvm/CodeGen/MachinePassManager.h"
13#include "llvm/CodeGen/RegAllocCommon.h"
14
15namespace llvm {
16
17class RegAllocFastPass : public RequiredPassInfoMixin<RegAllocFastPass> {
18public:
19 struct Options {
20 RegAllocFilterFunc Filter;
21 StringRef FilterName;
22 bool ClearVRegs;
23 Options(RegAllocFilterFunc F = nullptr, StringRef FN = "all",
24 bool CV = true)
25 : Filter(std::move(F)), FilterName(FN), ClearVRegs(CV) {}
26 };
27
28 RegAllocFastPass(Options Opts = Options()) : Opts(std::move(Opts)) {}
29
30 MachineFunctionProperties getRequiredProperties() const {
31 return MachineFunctionProperties().setNoPHIs();
32 }
33
34 MachineFunctionProperties getSetProperties() const {
35 MachineFunctionProperties P;
36 if (Opts.ClearVRegs)
37 P.setNoVRegs().setTiedOpsRewritten();
38 return P;
39 }
40
41 MachineFunctionProperties getClearedProperties() const {
42 return MachineFunctionProperties().setIsSSA();
43 }
44
45 LLVM_ABI PreservedAnalyses run(MachineFunction &MF,
46 MachineFunctionAnalysisManager &);
47
48 LLVM_ABI void
49 printPipeline(raw_ostream &OS,
50 function_ref<StringRef(StringRef)> MapClassName2PassName);
51
52private:
53 Options Opts;
54};
55
56} // namespace llvm
57
58#endif // LLVM_CODEGEN_REGALLOCFAST_H
59