[PowerPC] Materialize more constants with CR-field set in late peephole
[llvm-core.git] / lib / Target / AMDGPU / AMDGPUPerfHintAnalysis.h
blobbe7f37cb6815264a37f6060068c575553ccca48f
1 //===- AMDGPUPerfHintAnalysis.h - analysis of functions memory traffic ----===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 /// \file
11 /// \brief Analyzes if a function potentially memory bound and if a kernel
12 /// kernel may benefit from limiting number of waves to reduce cache thrashing.
13 ///
14 //===----------------------------------------------------------------------===//
16 #ifndef LLVM_LIB_TARGET_AMDGPU_MDGPUPERFHINTANALYSIS_H
17 #define LLVM_LIB_TARGET_AMDGPU_MDGPUPERFHINTANALYSIS_H
18 #include "llvm/IR/ValueMap.h"
19 #include "llvm/Pass.h"
21 namespace llvm {
23 struct AMDGPUPerfHintAnalysis : public FunctionPass {
24 static char ID;
26 public:
27 AMDGPUPerfHintAnalysis() : FunctionPass(ID) {}
29 bool runOnFunction(Function &F) override;
31 void getAnalysisUsage(AnalysisUsage &AU) const override {
32 AU.setPreservesAll();
35 bool isMemoryBound(const Function *F) const;
37 bool needsWaveLimiter(const Function *F) const;
39 struct FuncInfo {
40 unsigned MemInstCount;
41 unsigned InstCount;
42 unsigned IAMInstCount; // Indirect access memory instruction count
43 unsigned LSMInstCount; // Large stride memory instruction count
44 FuncInfo() : MemInstCount(0), InstCount(0), IAMInstCount(0),
45 LSMInstCount(0) {}
48 typedef ValueMap<const Function*, FuncInfo> FuncInfoMap;
50 private:
52 FuncInfoMap FIM;
54 } // namespace llvm
55 #endif // LLVM_LIB_TARGET_AMDGPU_MDGPUPERFHINTANALYSIS_H