1 | //===- MachineUniformityAnalysis.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 | // |
9 | /// \file |
10 | /// \brief Machine IR instance of the generic uniformity analysis |
11 | // |
12 | //===----------------------------------------------------------------------===// |
13 | |
14 | #ifndef LLVM_CODEGEN_MACHINEUNIFORMITYANALYSIS_H |
15 | #define LLVM_CODEGEN_MACHINEUNIFORMITYANALYSIS_H |
16 | |
17 | #include "llvm/ADT/GenericUniformityInfo.h" |
18 | #include "llvm/CodeGen/MachineCycleAnalysis.h" |
19 | #include "llvm/CodeGen/MachineDominators.h" |
20 | #include "llvm/CodeGen/MachineSSAContext.h" |
21 | |
22 | namespace llvm { |
23 | |
24 | extern template class GenericUniformityInfo<MachineSSAContext>; |
25 | using MachineUniformityInfo = GenericUniformityInfo<MachineSSAContext>; |
26 | |
27 | /// \brief Compute uniformity information for a Machine IR function. |
28 | /// |
29 | /// If \p HasBranchDivergence is false, produces a dummy result which assumes |
30 | /// everything is uniform. |
31 | MachineUniformityInfo computeMachineUniformityInfo( |
32 | MachineFunction &F, const MachineCycleInfo &cycleInfo, |
33 | const MachineDomTree &domTree, bool HasBranchDivergence); |
34 | |
35 | /// Legacy analysis pass which computes a \ref MachineUniformityInfo. |
36 | class MachineUniformityAnalysisPass : public MachineFunctionPass { |
37 | MachineUniformityInfo UI; |
38 | |
39 | public: |
40 | static char ID; |
41 | |
42 | MachineUniformityAnalysisPass(); |
43 | |
44 | MachineUniformityInfo &getUniformityInfo() { return UI; } |
45 | const MachineUniformityInfo &getUniformityInfo() const { return UI; } |
46 | |
47 | bool runOnMachineFunction(MachineFunction &F) override; |
48 | void getAnalysisUsage(AnalysisUsage &AU) const override; |
49 | void print(raw_ostream &OS, const Module *M = nullptr) const override; |
50 | |
51 | // TODO: verify analysis |
52 | }; |
53 | |
54 | } // namespace llvm |
55 | |
56 | #endif // LLVM_CODEGEN_MACHINEUNIFORMITYANALYSIS_H |
57 |