[flang-commits] [flang] [flang] Do not create .f18.mod files for each compiled module (PR #85249)

Michael Klemm via flang-commits flang-commits at lists.llvm.org
Mon Mar 25 00:45:36 PDT 2024


https://github.com/mjklemm updated https://github.com/llvm/llvm-project/pull/85249

>From af50425ded3456a2c11541dfc2c4db41d75e565c Mon Sep 17 00:00:00 2001
From: Michael Klemm <michael.klemm at amd.com>
Date: Thu, 14 Mar 2024 16:34:18 +0100
Subject: [PATCH 1/3] Do not create .f18.mod files for each compiled module

---
 flang/docs/ModFiles.md         | 4 +++-
 flang/tools/f18/CMakeLists.txt | 9 +++------
 2 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/flang/docs/ModFiles.md b/flang/docs/ModFiles.md
index e55d72fa3a705b..50bb92d1c6d815 100644
--- a/flang/docs/ModFiles.md
+++ b/flang/docs/ModFiles.md
@@ -27,7 +27,9 @@ often use `rm *.mod` to clean up.
 The disadvantage of using the same name as other compilers is that it is not
 clear which compiler created a `.mod` file and files from multiple compilers
 cannot be in the same directory. This could be solved by adding something
-between the module name and extension, e.g. `<modulename>-f18.mod`.
+between the module name and extension, e.g. `<modulename>-f18.mod`.  If this
+needed, Flang's fc1 accepts the option `-module-suffix` to alter the suffix
+used for the module file on disk.
 
 ## Format
 
diff --git a/flang/tools/f18/CMakeLists.txt b/flang/tools/f18/CMakeLists.txt
index ba6c6642c0b62e..6720ae7d86a549 100644
--- a/flang/tools/f18/CMakeLists.txt
+++ b/flang/tools/f18/CMakeLists.txt
@@ -47,7 +47,7 @@ if (NOT CMAKE_CROSSCOMPILING)
       endif()
     endif()
 
-    # The module contains PPC vector types that needs the PPC target.
+    # The module contains PPC vector types that needs th1e PPC target.
     set(opts "")
       if(${filename} STREQUAL "__ppc_intrinsics" OR
          ${filename} STREQUAL "mma")
@@ -65,11 +65,8 @@ if (NOT CMAKE_CROSSCOMPILING)
         ${FLANG_SOURCE_DIR}/module/${filename}.f90
       DEPENDS flang-new ${FLANG_SOURCE_DIR}/module/${filename}.f90 ${depends}
     )
-    add_custom_command(OUTPUT ${base}.f18.mod
-      DEPENDS ${base}.mod
-      COMMAND ${CMAKE_COMMAND} -E copy ${base}.mod ${base}.f18.mod)
-    list(APPEND MODULE_FILES ${base}.mod ${base}.f18.mod)
-    install(FILES ${base}.mod ${base}.f18.mod DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/flang")
+    list(APPEND MODULE_FILES ${base}.mod)
+    install(FILES ${base}.mod DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/flang")
   endforeach()
 endif()
 

>From 823116dd1e31e02cad0d3fd187d62322f919b0c5 Mon Sep 17 00:00:00 2001
From: Michael Klemm <michael.klemm at amd.com>
Date: Sun, 17 Mar 2024 09:07:18 +0100
Subject: [PATCH 2/3] Fix-up comments by Kelvin

---
 flang/docs/ModFiles.md         | 2 +-
 flang/tools/f18/CMakeLists.txt | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/flang/docs/ModFiles.md b/flang/docs/ModFiles.md
index 50bb92d1c6d815..59d5e5ad812149 100644
--- a/flang/docs/ModFiles.md
+++ b/flang/docs/ModFiles.md
@@ -29,7 +29,7 @@ clear which compiler created a `.mod` file and files from multiple compilers
 cannot be in the same directory. This could be solved by adding something
 between the module name and extension, e.g. `<modulename>-f18.mod`.  If this
 needed, Flang's fc1 accepts the option `-module-suffix` to alter the suffix
-used for the module file on disk.
+used for the module file.
 
 ## Format
 
diff --git a/flang/tools/f18/CMakeLists.txt b/flang/tools/f18/CMakeLists.txt
index 6720ae7d86a549..ea82c2042e3d7b 100644
--- a/flang/tools/f18/CMakeLists.txt
+++ b/flang/tools/f18/CMakeLists.txt
@@ -47,7 +47,7 @@ if (NOT CMAKE_CROSSCOMPILING)
       endif()
     endif()
 
-    # The module contains PPC vector types that needs th1e PPC target.
+    # The module contains PPC vector types that needs the PPC target.
     set(opts "")
       if(${filename} STREQUAL "__ppc_intrinsics" OR
          ${filename} STREQUAL "mma")

>From 79065ed645a8e4ec47b5e42f1d3eba59e5e4b09d Mon Sep 17 00:00:00 2001
From: Michael Klemm <michael.klemm at amd.com>
Date: Mon, 25 Mar 2024 08:45:30 +0100
Subject: [PATCH 3/3] Update flang/docs/ModFiles.md

Co-authored-by: Kiran Chandramohan <kiranchandramohan at gmail.com>
---
 flang/docs/ModFiles.md | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/flang/docs/ModFiles.md b/flang/docs/ModFiles.md
index 59d5e5ad812149..7463454c8563a2 100644
--- a/flang/docs/ModFiles.md
+++ b/flang/docs/ModFiles.md
@@ -28,7 +28,7 @@ The disadvantage of using the same name as other compilers is that it is not
 clear which compiler created a `.mod` file and files from multiple compilers
 cannot be in the same directory. This could be solved by adding something
 between the module name and extension, e.g. `<modulename>-f18.mod`.  If this
-needed, Flang's fc1 accepts the option `-module-suffix` to alter the suffix
+is needed, Flang's fc1 accepts the option `-module-suffix` to alter the suffix
 used for the module file.
 
 ## Format



More information about the flang-commits mailing list