[clang] [llvm] [AMDGPU] Convert AMDGPUResourceUsageAnalysis pass from Module to MF pass (PR #102913)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 20 05:07:55 PDT 2024
================
@@ -68,82 +71,84 @@ void MCResourceInfo::assignMaxRegs() {
assignMaxRegSym(MaxSGPRSym, MaxSGPR);
}
-void MCResourceInfo::finalize() {
- assert(!finalized && "Cannot finalize ResourceInfo again.");
- finalized = true;
- assignMaxRegs();
+void MCResourceInfo::finalize(MCContext &OutContext) {
+ assert(!Finalized && "Cannot finalize ResourceInfo again.");
+ Finalized = true;
+ assignMaxRegs(OutContext);
}
-MCSymbol *MCResourceInfo::getMaxVGPRSymbol() {
+MCSymbol *MCResourceInfo::getMaxVGPRSymbol(MCContext &OutContext) {
return OutContext.getOrCreateSymbol("max_num_vgpr");
}
-MCSymbol *MCResourceInfo::getMaxAGPRSymbol() {
+MCSymbol *MCResourceInfo::getMaxAGPRSymbol(MCContext &OutContext) {
return OutContext.getOrCreateSymbol("max_num_agpr");
}
-MCSymbol *MCResourceInfo::getMaxSGPRSymbol() {
+MCSymbol *MCResourceInfo::getMaxSGPRSymbol(MCContext &OutContext) {
return OutContext.getOrCreateSymbol("max_num_sgpr");
}
void MCResourceInfo::assignResourceInfoExpr(
- int64_t localValue, ResourceInfoKind RIK, AMDGPUMCExpr::VariantKind Kind,
- const MachineFunction &MF,
- const SmallVectorImpl<const Function *> &Callees) {
- const MCConstantExpr *localConstExpr =
- MCConstantExpr::create(localValue, OutContext);
- const MCExpr *SymVal = localConstExpr;
+ int64_t LocalValue, ResourceInfoKind RIK, AMDGPUMCExpr::VariantKind Kind,
+ const MachineFunction &MF, const SmallVectorImpl<const Function *> &Callees,
+ MCContext &OutContext) {
+ const MCConstantExpr *LocalConstExpr =
+ MCConstantExpr::create(LocalValue, OutContext);
+ const MCExpr *SymVal = LocalConstExpr;
----------------
arsenm wrote:
No, we can know when an indirect call has a known possible range of callees. Whether from !callees metadata or from seeing the possible values of the call target
https://github.com/llvm/llvm-project/pull/102913
More information about the llvm-commits
mailing list