diff options
Diffstat (limited to 'backend/include/rcc/CodeGen/MachineCopyPropagation.h')
| -rw-r--r-- | backend/include/rcc/CodeGen/MachineCopyPropagation.h | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/backend/include/rcc/CodeGen/MachineCopyPropagation.h b/backend/include/rcc/CodeGen/MachineCopyPropagation.h new file mode 100644 index 0000000..61b562e --- /dev/null +++ b/backend/include/rcc/CodeGen/MachineCopyPropagation.h @@ -0,0 +1,41 @@ +// SPDX-License-Identifier: GPL-3.0-or-later + +#ifndef RCC_CODEGEN_MACHINECOPYPROPAGATION_H +#define RCC_CODEGEN_MACHINECOPYPROPAGATION_H + +#include "rcc/CodeGen/MachinePassManager.h" + +#include <cstddef> + +namespace rcc { + +class TargetInstrInfo; + +struct MachineCopyPropagationOptions final { + std::size_t MaximumPropagatedCopies = 10'000; + bool UseTargetCopyInstructions = false; +}; + +class MachineCopyPropagationPass final : public MachineFunctionPass { +public: + explicit MachineCopyPropagationPass(const TargetInstrInfo &Info, + MachineCopyPropagationOptions 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: + [[nodiscard]] Expected<MachinePassResult> + runImplementation(MachineFunction &Function, const TargetDescription &Target, + MachineFunctionAnalysisManager &Analyses) const; + + const TargetInstrInfo *Info; + MachineCopyPropagationOptions Options; +}; + +} // namespace rcc + +#endif // RCC_CODEGEN_MACHINECOPYPROPAGATION_H |
