diff options
| author | Richard-Qin-X <richard.qin.001@gmail.com> | 2026-08-25 03:11:23 +0800 |
|---|---|---|
| committer | Richard-Qin-X <richard.qin.001@gmail.com> | 2026-08-25 03:11:23 +0800 |
| commit | f5d9ddc085055d28d6f9fb3730c3566097f43fb2 (patch) | |
| tree | d1ca89a409a0d1a167e79e3d1693c22bcfd823a9 /backend/lib/CodeGen/RegAllocGreedy.h | |
| parent | c3932f55208e3fe2019d26a0e5af421c0b644872 (diff) | |
| download | rcc-project-f5d9ddc085055d28d6f9fb3730c3566097f43fb2.tar.gz rcc-project-f5d9ddc085055d28d6f9fb3730c3566097f43fb2.tar.xz | |
[CodeGen] Implement the greedy register allocator pipeline
Diffstat (limited to 'backend/lib/CodeGen/RegAllocGreedy.h')
| -rw-r--r-- | backend/lib/CodeGen/RegAllocGreedy.h | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/backend/lib/CodeGen/RegAllocGreedy.h b/backend/lib/CodeGen/RegAllocGreedy.h new file mode 100644 index 0000000..1f25a5c --- /dev/null +++ b/backend/lib/CodeGen/RegAllocGreedy.h @@ -0,0 +1,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_REGALLOCGREEDY_H +#define RCC_LIB_CODEGEN_REGALLOCGREEDY_H + +#include "rcc/CodeGen/RegAllocCommon.h" +#include "rcc/CodeGen/TargetRegisterAllocationInfo.h" + +namespace rcc { + +class GreedyAllocatorPass final : public MachineFunctionPass { +public: + explicit GreedyAllocatorPass(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_REGALLOCGREEDY_H |
