LLVM 20.0.0git
AMDGPUResourceUsageAnalysis.h
Go to the documentation of this file.
1//===- AMDGPUResourceUsageAnalysis.h ---- analysis of resources -*- 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 Analyzes how many registers and other resources are used by
11/// functions.
12///
13//===----------------------------------------------------------------------===//
14
15#ifndef LLVM_LIB_TARGET_AMDGPU_AMDGPURESOURCEUSAGEANALYSIS_H
16#define LLVM_LIB_TARGET_AMDGPU_AMDGPURESOURCEUSAGEANALYSIS_H
17
20
21namespace llvm {
22
23class GCNSubtarget;
24class MachineFunction;
25class TargetMachine;
26
28public:
29 static char ID;
30 // Track resource usage for callee functions.
32 // Track the number of explicitly used VGPRs. Special registers reserved at
33 // the end are tracked separately.
34 int32_t NumVGPR = 0;
35 int32_t NumAGPR = 0;
36 int32_t NumExplicitSGPR = 0;
39 bool UsesVCC = false;
40 bool UsesFlatScratch = false;
42 bool HasRecursion = false;
43 bool HasIndirectCall = false;
45 };
46
48
49 bool runOnMachineFunction(MachineFunction &MF) override;
50
51 const SIFunctionResourceInfo &getResourceInfo() const { return ResourceInfo; }
52
53 void getAnalysisUsage(AnalysisUsage &AU) const override {
54 AU.setPreservesAll();
56 }
57
58private:
59 SIFunctionResourceInfo
60 analyzeResourceUsage(const MachineFunction &MF,
61 uint32_t AssumedStackSizeForDynamicSizeObjects,
62 uint32_t AssumedStackSizeForExternalCall) const;
63 SIFunctionResourceInfo ResourceInfo;
64};
65} // namespace llvm
66#endif // LLVM_LIB_TARGET_AMDGPU_AMDGPURESOURCEUSAGEANALYSIS_H
This file defines the SmallVector class.
Represent the analysis usage information of a pass.
void setPreservesAll()
Set by analyses that do not transform their input at all.
MachineFunctionPass - This class adapts the FunctionPass interface to allow convenient creation of pa...
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - Subclasses that override getAnalysisUsage must call this.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Definition: SmallVector.h:1196
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - Subclasses that override getAnalysisUsage must call this.
bool runOnMachineFunction(MachineFunction &MF) override
runOnMachineFunction - This method must be overloaded to perform the desired machine code transformat...
const SIFunctionResourceInfo & getResourceInfo() const