LLVM 20.0.0git
HardwareLoops.h
Go to the documentation of this file.
1//===- HardwareLoops.h ------------------------------------------*- 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/// \file
9///
10/// Defines an IR pass for the creation of hardware loops.
11///
12//===----------------------------------------------------------------------===//
13
14#ifndef LLVM_CODEGEN_HARDWARELOOPS_H
15#define LLVM_CODEGEN_HARDWARELOOPS_H
16
17#include "llvm/IR/PassManager.h"
18
19namespace llvm {
20
22 std::optional<unsigned> Decrement;
23 std::optional<unsigned> Bitwidth;
24 std::optional<bool> Force;
25 std::optional<bool> ForcePhi;
26 std::optional<bool> ForceNested;
27 std::optional<bool> ForceGuard;
28
30 Decrement = Count;
31 return *this;
32 }
34 Bitwidth = Width;
35 return *this;
36 }
38 this->Force = Force;
39 return *this;
40 }
43 return *this;
44 }
47 return *this;
48 }
51 return *this;
52 }
53 bool getForcePhi() const {
54 return ForcePhi.has_value() && ForcePhi.value();
55 }
56 bool getForceNested() const {
57 return ForceNested.has_value() && ForceNested.value();
58 }
59 bool getForceGuard() const {
60 return ForceGuard.has_value() && ForceGuard.value();
61 }
62};
63
64class HardwareLoopsPass : public PassInfoMixin<HardwareLoopsPass> {
66
67public:
69 : Opts(Opts) { }
70
71 PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
72};
73
74} // end namespace llvm
75
76#endif // LLVM_CODEGEN_HARDWARELOOPS_H
#define F(x, y, z)
Definition: MD5.cpp:55
This header defines various interfaces for pass management in LLVM.
HardwareLoopsPass(HardwareLoopOptions Opts={})
Definition: HardwareLoops.h:68
PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM)
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
AnalysisManager< Function > FunctionAnalysisManager
Convenience typedef for the Function analysis manager.
Definition: PassManager.h:542
std::optional< bool > Force
Definition: HardwareLoops.h:24
HardwareLoopOptions & setForceNested(bool Force)
Definition: HardwareLoops.h:45
std::optional< bool > ForceGuard
Definition: HardwareLoops.h:27
std::optional< unsigned > Decrement
Definition: HardwareLoops.h:22
HardwareLoopOptions & setDecrement(unsigned Count)
Definition: HardwareLoops.h:29
HardwareLoopOptions & setForceGuard(bool Force)
Definition: HardwareLoops.h:49
HardwareLoopOptions & setForce(bool Force)
Definition: HardwareLoops.h:37
HardwareLoopOptions & setCounterBitwidth(unsigned Width)
Definition: HardwareLoops.h:33
std::optional< unsigned > Bitwidth
Definition: HardwareLoops.h:23
HardwareLoopOptions & setForcePhi(bool Force)
Definition: HardwareLoops.h:41
std::optional< bool > ForcePhi
Definition: HardwareLoops.h:25
std::optional< bool > ForceNested
Definition: HardwareLoops.h:26
A CRTP mix-in to automatically provide informational APIs needed for passes.
Definition: PassManager.h:69