================
@@ -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:

Had to look into this a bit as I wasn't aware of the !callees metadata: but 
yes, we currently don't take advantage of this. I was able to create an example 
that emits the !callees metadata for an indirect call but it will always fall 
back on the worst case (i.e., module level worst case values).

https://github.com/llvm/llvm-project/pull/102913
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to