[clang] [llvm] [AMDGPU] Convert AMDGPUResourceUsageAnalysis pass from Module to MF pass (PR #102913)

Janek van Oirschot via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 20 05:04:19 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;
----------------
JanekvO wrote:

As in, finding the module level maximum?

https://github.com/llvm/llvm-project/pull/102913


More information about the cfe-commits mailing list