<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/84397>84397</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [Codegen/NewPM] Add Function -> MachineFunction adaptor
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          aeubanks
      </td>
    </tr>
</table>

<pre>
    The codegen pipeline should work on a function and its corresponding machine function before moving onto the next function. This is only possible with a function -> machine function adaptor, which we don't currently have (see TODO [here](https://github.com/llvm/llvm-project/blob/d93a126090b6e772d3b96f201cdd44ea0d6360ef/llvm/include/llvm/Passes/CodeGenPassBuilder.h#L156))

To get the machine function for a given function in a function pass (the adaptor), we'll need the function analysis manager to handle machine functions, as opposed to a module analysis handling it. That's basically [this discourse discussion](https://discourse.llvm.org/t/machinefunction-ownership-in-the-new-pass-manager/77381)

@paperchalice @arsenm 
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyUVMGS2ygQ_Rp86bILgWRJBx1mxqu9bDY5zA8gaAs2GFQ0Gq__fgtNYieZvaTKZSHofnS_fk-KyM0BcWDNM2tOO7VmG9OgcJ1U-Eq7KZrb8GoRdDQ4Y4DFLehdQCAbV2_gGtNXiAEUnNegsyvLYMBlAh1TQlpiMC7McFHalrx72ITnmBAu8a0cx5AjZIsQ8N98DzrAq3UEjiAGf4MlErnJI1xdtj9euWfyj483KKOWHBMTL3C1Tlu4IpgYmGgz6DUlDNnfwKo3BCY6QoTXz6fPwJpniwlZc2KiszkvxOQTEyMT4-yyXaeDjhcmRu_fvj_2S4r_oM5MjJOPExOj6aWqxJH3fDpi2wojp_54FrzSxtQ1Km6O8sjx_MBxQfvV4GPjiyJCYmJ8iQb_xFDen1fnDaaDZUL-VTVHJvry4yfGn97_XyPMmDcqPxByjgkUzO4Nw2PT_TS8RREVNkr-nb9-oxCZaL2HgGg2-B8GrvyNHMFFBTVjghzBqmD8xxKoICmCuCyRCk4EBZdoVo8PmC23iMLlIgCVmWgJJkVOK-9vZUC5yMI40nFNhNtqJXIx_N_U7nGHwuwhppmJsczqW3Xfi9vHa8BE1i17F_bZ4j7gdV8Y2X_rjImxbWVX_cI5q_miFkzaKu80Aqu5SoThAjszSNPLXu1wqFred43kVbezQyu6upJGKcSad1Jj14mzaVqpecXlud65QXBRc8lbIStedQfdVmdeN6ITU1-bqWc1x4ty_t7UzhGtOHS17NudVxN62mwtRMArbIdMiOLyNGyindaZWM29o0wPlOyy374HL--WZ2L8G69fPrHmBE_GwPiT6T69Uzj-4rndmvzw297ZaiyK33r4LwAA__8gWoo-">