[clang] [flang] [llvm] [mlir] Make Ownership of MachineModuleInfo in Its Wrapper Pass External (PR #110443)

2024-10-04 Thread Matin Raayai via cfe-commits
matinraayai wrote: I dug up the commit that introduced `LLVMTargetMachine`: https://github.com/llvm/llvm-project/commit/12e97307a10bbac6bf9e6733833b84faf06dee88. It dates back to before when the MC layer was created. It seems the motivation was to allow a hypothetical target to generate code u

[clang] [flang] [llvm] [mlir] Make Ownership of MachineModuleInfo in Its Wrapper Pass External (PR #110443)

2024-10-04 Thread Matin Raayai via cfe-commits
@@ -1162,6 +1165,7 @@ void EmitAssemblyHelper::RunCodegenPipeline( // does not work with the codegen pipeline. // FIXME: make the new PM work with the codegen pipeline. legacy::PassManager CodeGenPasses; + std::unique_ptr MMI; matinraayai wrote: I'll ch

[clang] [flang] [llvm] [mlir] Make Ownership of MachineModuleInfo in Its Wrapper Pass External (PR #110443)

2024-10-02 Thread Matin Raayai via cfe-commits
https://github.com/matinraayai updated https://github.com/llvm/llvm-project/pull/110443 >From 6a78a683f4834049c07f9672c358dcbb44ac14e7 Mon Sep 17 00:00:00 2001 From: matinraayai <30674652+matinraa...@users.noreply.github.com> Date: Sun, 29 Sep 2024 16:54:50 -0400 Subject: [PATCH 01/21] Made MMIW

[clang] [flang] [llvm] [mlir] Make Ownership of MachineModuleInfo in Its Wrapper Pass External (PR #110443)

2024-10-02 Thread Matin Raayai via cfe-commits
https://github.com/matinraayai updated https://github.com/llvm/llvm-project/pull/110443 >From 6a78a683f4834049c07f9672c358dcbb44ac14e7 Mon Sep 17 00:00:00 2001 From: matinraayai <30674652+matinraa...@users.noreply.github.com> Date: Sun, 29 Sep 2024 16:54:50 -0400 Subject: [PATCH 01/20] Made MMIW

[clang] [flang] [llvm] [mlir] Make Ownership of MachineModuleInfo in Its Wrapper Pass External (PR #110443)

2024-10-02 Thread Matin Raayai via cfe-commits
https://github.com/matinraayai updated https://github.com/llvm/llvm-project/pull/110443 >From 6a78a683f4834049c07f9672c358dcbb44ac14e7 Mon Sep 17 00:00:00 2001 From: matinraayai <30674652+matinraa...@users.noreply.github.com> Date: Sun, 29 Sep 2024 16:54:50 -0400 Subject: [PATCH 01/19] Made MMIW

[clang] [flang] [llvm] [mlir] Make Ownership of MachineModuleInfo in Its Wrapper Pass External (PR #110443)

2024-10-02 Thread Matin Raayai via cfe-commits
@@ -0,0 +1,102 @@ +//===-- LLVMTargetMachineC.cpp ===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Ap

[clang] [flang] [llvm] [mlir] Make Ownership of MachineModuleInfo in Its Wrapper Pass External (PR #110443)

2024-10-02 Thread Matin Raayai via cfe-commits
https://github.com/matinraayai updated https://github.com/llvm/llvm-project/pull/110443 >From 6a78a683f4834049c07f9672c358dcbb44ac14e7 Mon Sep 17 00:00:00 2001 From: matinraayai <30674652+matinraa...@users.noreply.github.com> Date: Sun, 29 Sep 2024 16:54:50 -0400 Subject: [PATCH 01/19] Made MMIW

[clang] [flang] [llvm] [mlir] Make Ownership of MachineModuleInfo in Its Wrapper Pass External (PR #110443)

2024-10-01 Thread Matin Raayai via cfe-commits
matinraayai wrote: @MatzeB @arsenm in the latest commit I had to fix the issue you ran into in the following links @arsenm mentioned earlier: https://lists.llvm.org/pipermail/llvm-dev/2017-October/117907.html https://reviews.llvm.org/D38482 https://reviews.llvm.org/D38489 I can live with `Targ

[clang] [flang] [llvm] [mlir] Make Ownership of MachineModuleInfo in Its Wrapper Pass External (PR #110443)

2024-10-01 Thread Matin Raayai via cfe-commits
https://github.com/matinraayai updated https://github.com/llvm/llvm-project/pull/110443 >From 6a78a683f4834049c07f9672c358dcbb44ac14e7 Mon Sep 17 00:00:00 2001 From: matinraayai <30674652+matinraa...@users.noreply.github.com> Date: Sun, 29 Sep 2024 16:54:50 -0400 Subject: [PATCH 01/18] Made MMIW

[clang] [flang] [llvm] [mlir] Make Ownership of MachineModuleInfo in Its Wrapper Pass External (PR #110443)

2024-09-30 Thread Matin Raayai via cfe-commits
matinraayai wrote: > > * Move the MC emission functions in `TargetMachine` to `LLVMTargetMachine`. > > With the changes in this PR, we explicitly assume in both > > `addPassesToEmitFile` and `addPassesToEmitMC` that the `TargetMachine` is > > an `LLVMTargetMachine`; Hence it does not make sens

[clang] [flang] [llvm] [mlir] Make Ownership of MachineModuleInfo in Its Wrapper Pass External (PR #110443)

2024-09-29 Thread Matin Raayai via cfe-commits
https://github.com/matinraayai updated https://github.com/llvm/llvm-project/pull/110443 >From 6a78a683f4834049c07f9672c358dcbb44ac14e7 Mon Sep 17 00:00:00 2001 From: matinraayai <30674652+matinraa...@users.noreply.github.com> Date: Sun, 29 Sep 2024 16:54:50 -0400 Subject: [PATCH 01/17] Made MMIW

[clang] [flang] [llvm] [mlir] Make Ownership of MachineModuleInfo in Its Wrapper Pass External (PR #110443)

2024-09-29 Thread Matin Raayai via cfe-commits
https://github.com/matinraayai updated https://github.com/llvm/llvm-project/pull/110443 >From 6a78a683f4834049c07f9672c358dcbb44ac14e7 Mon Sep 17 00:00:00 2001 From: matinraayai <30674652+matinraa...@users.noreply.github.com> Date: Sun, 29 Sep 2024 16:54:50 -0400 Subject: [PATCH 01/16] Made MMIW

[clang] [flang] [llvm] Make Ownership of MachineModuleInfo in Its Wrapper Pass External (PR #110443)

2024-09-29 Thread Matin Raayai via cfe-commits
https://github.com/matinraayai updated https://github.com/llvm/llvm-project/pull/110443 >From 6a78a683f4834049c07f9672c358dcbb44ac14e7 Mon Sep 17 00:00:00 2001 From: matinraayai <30674652+matinraa...@users.noreply.github.com> Date: Sun, 29 Sep 2024 16:54:50 -0400 Subject: [PATCH 01/15] Made MMIW

[clang] [flang] [llvm] Make Ownership of MachineModuleInfo in Its Wrapper Pass External (PR #110443)

2024-09-29 Thread Matin Raayai via cfe-commits
https://github.com/matinraayai created https://github.com/llvm/llvm-project/pull/110443 Following up on discussions in #105541, this PR is the first part of #105541, which removes ownership of the `llvm::MachineModuleInfoWrapperPass` over its encapsulated `llvm::MachineModuleInfo`, allowing be

[clang] [flang] [llvm] [mlir] Make MMIWP not have ownership over MMI + Make MMI Only Use an External MCContext (PR #105541)

2024-09-23 Thread Matin Raayai via cfe-commits
matinraayai wrote: @aeubanks sure I can split the PR into two parts: 1. Make MMIWP not have ownership over MMI. 2. Make MMI only use an external context. I will make a new PR for each of them and close this one once both are merged. https://github.com/llvm/llvm-project/pull/105541 _

[clang] [flang] [llvm] [mlir] Make MMIWP not have ownership over MMI + Make MMI Only Use an External MCContext (PR #105541)

2024-09-22 Thread Matin Raayai via cfe-commits
matinraayai wrote: > > @aeubanks @arsenm after looking into this in more detail, I realized that > > the `getContext` method of `MMI` is heavily used in the `AsmPrinter` to > > create symbols. Also not having it makes it harder for the `MMI` to create > > machine functions using `getOrCreateMa

[clang] [flang] [llvm] [mlir] Make MMIWP not have ownership over MMI + Make MMI Only Use an External MCContext (PR #105541)

2024-09-21 Thread Matin Raayai via cfe-commits
matinraayai wrote: @aeubanks @arsenm after looking into this in more detail, I realized that the `getContext` method of `MMI` is heavily used in the `AsmPrinter` to create symbols. Also not having it makes it harder for the `MMI` to create machine functions using `getOrCreateMachineFunction`.

[clang] [flang] [llvm] [mlir] Make MMIWP not have ownership over MMI + Make MMI Only Use an External MCContext (PR #105541)

2024-09-20 Thread Matin Raayai via cfe-commits
matinraayai wrote: In that case, I will modify this PR so that: 1. MMI does not take a reference to the MCContext. 2. MMIWP takes a reference for its initialize/finalize methods. I'll report back in case I run into unexpected issues. https://github.com/llvm/llvm-project/pull/105541 ___

[clang] [flang] [llvm] [mlir] Make MMIWP not have ownership over MMI + Make MMI Only Use an External MCContext (PR #105541)

2024-09-19 Thread Matin Raayai via cfe-commits
matinraayai wrote: > sorry for the delay > > after looking at MMI/MCContext, I agree that MMI shouldn't own MCContext, but > do we even need a reference from MMI to MCContext? they are different layers > of codegen IIUC. if it's possible to completely separate them we should do > that (pleas

[clang] [flang] [llvm] [mlir] Make MMIWP not have ownership over MMI + Make MMI Only Use an External MCContext (PR #105541)

2024-09-16 Thread Matin Raayai via cfe-commits
matinraayai wrote: @aeubanks @arsenm any updates on this? https://github.com/llvm/llvm-project/pull/105541 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [flang] [llvm] [mlir] Make MMIWP not have ownership over MMI + Make MMI Only Use an External MCContext (PR #105541)

2024-08-30 Thread Matin Raayai via cfe-commits
matinraayai wrote: @aeubanks should be ready for review again. https://github.com/llvm/llvm-project/pull/105541 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [flang] [llvm] [mlir] Make MMIWP not have ownership over MMI + Make MMI Only Use an External MCContext (PR #105541)

2024-08-29 Thread Matin Raayai via cfe-commits
https://github.com/matinraayai edited https://github.com/llvm/llvm-project/pull/105541 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [flang] [llvm] [mlir] Make MMIWP not have ownership over MMI + Remove Move Constructor of MMI + Make MMI Only Use and Externally-Created MCContext (PR #105541)

2024-08-22 Thread Matin Raayai via cfe-commits
matinraayai wrote: > > The TargetMachine interface functions addPassesToEmitFile and > > addPassesToEmitMC now require a reference to an MMI; This IMO breaks the > > abstraction of the TargetMachine, since an MMI requires a > > LLVMTargetMachine, and if you have a TargetMachine you should do t

[clang] [flang] [llvm] [mlir] Make MMIWP not have ownership over MMI + Remove Move Constructor of MMI + Make MMI Only Use and Externally-Created MCContext (PR #105541)

2024-08-21 Thread Matin Raayai via cfe-commits
https://github.com/matinraayai ready_for_review https://github.com/llvm/llvm-project/pull/105541 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] Make MMIWP not have ownership over MMI + Remove Move Constructor of MMI + Make MMI Only Use and Externally-Created MCContext (PR #105541)

2024-08-21 Thread Matin Raayai via cfe-commits
https://github.com/matinraayai updated https://github.com/llvm/llvm-project/pull/105541 >From 4030c78148a2cb9b584038bd2ce522906b710f7e Mon Sep 17 00:00:00 2001 From: matinraayai <30674652+matinraa...@users.noreply.github.com> Date: Tue, 20 Aug 2024 14:22:11 -0400 Subject: [PATCH 1/3] Made MMI on

[clang] [llvm] Make MMIWP not have ownership over MMI + Remove Move Constructor of MMI + Make MMI Only Use and Externally-Created MCContext (PR #105541)

2024-08-21 Thread Matin Raayai via cfe-commits
https://github.com/matinraayai updated https://github.com/llvm/llvm-project/pull/105541 >From 4030c78148a2cb9b584038bd2ce522906b710f7e Mon Sep 17 00:00:00 2001 From: matinraayai <30674652+matinraa...@users.noreply.github.com> Date: Tue, 20 Aug 2024 14:22:11 -0400 Subject: [PATCH 1/3] Made MMI on

[clang] [llvm] Make MMIWP not have ownership over MMI + Remove Move Constructor of MMI + Make MMI Only Use and Externally-Created MCContext (PR #105541)

2024-08-21 Thread Matin Raayai via cfe-commits
https://github.com/matinraayai edited https://github.com/llvm/llvm-project/pull/105541 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] Make MMIWP not have ownership over MMI + Remove Move Constructor of MMI + Make MMI Only Use and Externally-Created MCContext (PR #105541)

2024-08-21 Thread Matin Raayai via cfe-commits
https://github.com/matinraayai converted_to_draft https://github.com/llvm/llvm-project/pull/105541 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] Make MMIWP not have ownership over MMI + Remove Move Constructor of MMI + Make MMI Only Use and Externally-Created MCContext (PR #105541)

2024-08-21 Thread Matin Raayai via cfe-commits
https://github.com/matinraayai created https://github.com/llvm/llvm-project/pull/105541 This PR makes the following changes, addressing issues raised in #104834 and #98770: 1. MMIWP behaves like the new PM's analysis Pass; It only takes a reference to an externally created MMI. 2. Removed the