The idea of MachineModulePass is simple:
Where ModulePass is a pass over whole modules of LLVM-IR (IR) functions,
MachineModulePass would be a pass over whole modules of Machine-IR (MIR) functions.
Back in 2013, when the T-CREST project needed to implement passes over MIR, LLVM didn't have a good way of doing so.
Therefore, MachineModulePass was added to the T-CREST LLVM port to facilitate the needed functionality.1
I'm guessing the hope was that LLVM would eventually provide a version of MachineModulePass that
could be used by T-CREST. However, this never happened.
In January 2016, Quentin Colombet started an email chain on the LLVM developer's mailing list about adding a MachineModulePass
and what interest others had.2
Our own Florian Brandner answered, stating how the T-CREST project needed the functionality and had an implementation working.3
However, even though there was some back and forth, the email chain ended without a conclusion.
From Florian's last email, a discussion might have happened elsewhere. 4
In March, the topic was opened again by Vivek Pandya, who wanted some input on how to move forward with an implementation.5 Even though it seemed like a serious effort. The email chain ended without a conclusion6 and the effort doesn't seem to have born any fruit.
At this point, by using The Wayback Machine, we can see that "Add a MachineModulePass" was added to the LLVM Open Projects webpage.7 To this day, the page still has the section header in its index.8 However, the section itself was removed in November or December 2016, which suggest some kind of conclusion was reached.
The topic was brought up again in July 2016.
James Molloy did some experimentation on what would happen if MachineModulePass was added.9
The problem was that so far, the MIR production happened one function at a time,
deleting the previous function's MIR before continuing onto the next.
Adding MachineModulePass would require keeping all MIR functions in memory,
which would increase memory use by 17-33%.
Some respondends found this unacceptable.10
Matthias Braun presented an idea for how to get the functionality of MachineModulePass without needing
an explicit class.11
Instead, he added a mapping from Function to MachineFunction in MachineModuleInfo.
This would then allow ModulePasses to acces MachineFunctions using this API.
In august, Matthias returned with a patch that implemented his ideas.12
He also provided a Proof of Concept on how machine module passes could then be
implemented using Module Pass.13
Later, Matthias' patch was commited.14
It seems that was the end of the discussion around MachineModulePass.
The conclusion was that a dedicated class was not needed, instead ModulePass was
updated to be able to provide the needed functionality.