[llvm] [NewPM][CodeGen] Add `FunctionToMachineFunctionAnalysis` (PR #88610)

Arthur Eubanks via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 16 15:35:37 PDT 2024


================
@@ -120,6 +120,12 @@ void LLVMContext::removeModule(Module *M) {
   pImpl->OwnedModules.erase(M);
 }
 
+unsigned LLVMContext::generateMachineFunctionNum(Function &F) {
+  Module *M = F.getParent();
+  assert(pImpl->OwnedModules.contains(M) && "Unexpected module!");
+  return pImpl->MachineFunctionNums[M]++;
----------------
aeubanks wrote:

do these need to start at 0 per module? otherwise could we just keep counting up ignoring the module?

otherwise we'll have to erase these entries in `removeModule()` or risk stale entries getting reused

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


More information about the llvm-commits mailing list