diff options
Diffstat (limited to 'backend/include/rcc/CodeGen/MachineBranchRelaxation.h')
| -rw-r--r-- | backend/include/rcc/CodeGen/MachineBranchRelaxation.h | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/backend/include/rcc/CodeGen/MachineBranchRelaxation.h b/backend/include/rcc/CodeGen/MachineBranchRelaxation.h new file mode 100644 index 0000000..1793a54 --- /dev/null +++ b/backend/include/rcc/CodeGen/MachineBranchRelaxation.h @@ -0,0 +1,39 @@ +// SPDX-License-Identifier: GPL-3.0-or-later + +#ifndef RCC_CODEGEN_MACHINEBRANCHRELAXATION_H +#define RCC_CODEGEN_MACHINEBRANCHRELAXATION_H + +#include "rcc/CodeGen/MachinePass.h" + +#include <cstddef> + +namespace rcc { + +class TargetBranchInfo; + +struct MachineBranchRelaxationOptions final { + std::size_t ConvergenceWatchdog = 1000000; +}; + +class MachineBranchRelaxationPass final : public MachineFunctionPass { +public: + explicit MachineBranchRelaxationPass(const TargetBranchInfo &Info, + MachineBranchRelaxationOptions Options = {}) noexcept + : Info(&Info), Options(Options) {} + + [[nodiscard]] const MachinePassContract &contract() const noexcept override; + [[nodiscard]] Expected<MachinePassResult> run(MachineFunction &Function, + const TargetDescription &Target, + MachineAnalysisManager &Analyses) override; + +private: + [[nodiscard]] Expected<MachinePassResult> + runImplementation(MachineFunction &Function, const TargetDescription &Target) const; + + const TargetBranchInfo *Info; + MachineBranchRelaxationOptions Options; +}; + +} // namespace rcc + +#endif // RCC_CODEGEN_MACHINEBRANCHRELAXATION_H |
