[llvm] [PassManager] Support MachineFunctionProperties (PR #83668)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 21 04:13:14 PDT 2024


================
@@ -64,6 +64,8 @@ extern llvm::cl::opt<bool> UseNewDbgInfoFormat;
 
 namespace llvm {
 
+class MachineFunction;
----------------
arsenm wrote:

> FooPass::run(MachineFunction&MF, ...) {
>   verifyMachineFunctionProperties(MF, MachineFunctionProperties().set(
>         MachineFunctionProperties::Property::NoVRegs));
> }
> ```

This guarantees future bugs from either forgetting to add this, or being clever with putting code before this.


> `MachineFunctionProperties::set()` is like a builder, so constructing an arbitrary `MachineFunctionProperties` can be expressed in one statement

A builder here is obnoxious. These constraints are expressible as a constant bitfield, the API shouldn't be built around mutation of an object 

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


More information about the llvm-commits mailing list