[clang] [lanai] Add back the ability to set the memory model with --mcmodel. (PR #150575)

via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 24 22:26:59 PDT 2025


https://github.com/petergrind3 created https://github.com/llvm/llvm-project/pull/150575

Sometimes between April 2023 and today the option disappeared. I wasn't able to trace when it went away through the different refactoring.


>From 20745528ddd459d2f77b677e3f22118d810e8741 Mon Sep 17 00:00:00 2001
From: petergrind3 <petergrind3 at gmail.com>
Date: Fri, 25 Jul 2025 04:56:25 +0000
Subject: [PATCH] [lanai] Add back the ability to set the memory model with
 --mcmodel.

Sometimes between April 2023 and today the option disappeared. I wasn't able to trace when it went away through the different refactoring.
---
 clang/lib/Driver/ToolChains/CommonArgs.cpp | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/clang/lib/Driver/ToolChains/CommonArgs.cpp b/clang/lib/Driver/ToolChains/CommonArgs.cpp
index 826e2ea7eb06d..9cac8b1517ea1 100644
--- a/clang/lib/Driver/ToolChains/CommonArgs.cpp
+++ b/clang/lib/Driver/ToolChains/CommonArgs.cpp
@@ -3055,6 +3055,8 @@ void tools::addMCModel(const Driver &D, const llvm::opt::ArgList &Args,
       else if (CM == "medany")
         CM = "large";
       Ok = CM == "small" || CM == "medium" || CM == "large";
+    } else if (Triple.getArch() == llvm::Triple::lanai) {
+      Ok = llvm::is_contained({"small", "medium", "large"}, CM);
     }
     if (Ok) {
       CmdArgs.push_back(Args.MakeArgString("-mcmodel=" + CM));



More information about the cfe-commits mailing list