[llvm] A MMIWP Constructor Initialized with the move constructor of MMI (PR #98770)

Matin Raayai via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 15 08:37:27 PDT 2024


matinraayai wrote:

> What do you need to set in MMI?
In a nutshell, the mapping between `llvm::Function` and the `llvm::machineFunction`s.
In my code, I either:
1. I have an MMI pre-populated with MFs and MIs, much like llvm-exegesis. I put the Module and the MMI through a minimal codegen pipeline to print the assembly.
2. I have an LLVM IR Module which I put through IR and codegen pipelines right before assembly printing.

In either situations, I want to store the MMI and inspect it before/after code generation outside of a pass manager infrastructure; Hence I need control over the lifetime of the MMI so that it doesn't get destroyed by the pass manager's destructor. 

Right now, I have a data structure that stores a Module as well as its MMIWP. The problem is, after running passes on the MMIWP I can't update it to store the modified MIR, because MMIWP doesn't have an assignment/move constructor.

Having this constructor removes the need to store the entire MMIWP, and allows me to store MMI before and after it is modified by the pass manager.

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


More information about the llvm-commits mailing list