-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
191 additions
and
151 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,19 @@ | ||
From 4ce2573dcb2e9e74a1ed0d61a5b82e7b2fb86539 Mon Sep 17 00:00:00 2001 | ||
From: oltolm <[email protected]> | ||
Date: Mon, 30 Sep 2024 00:01:58 +0200 | ||
Subject: [PATCH] do not define pid_t on mingw | ||
|
||
--- | ||
include/flang/Optimizer/Builder/Runtime/RTBuilder.h | 2 +- | ||
include/flang/Runtime/command.h | 2 +- | ||
runtime/command.cpp | 2 +- | ||
3 files changed, 3 insertions(+), 3 deletions(-) | ||
|
||
diff --git a/include/flang/Optimizer/Builder/Runtime/RTBuilder.h b/include/flang/Optimizer/Builder/Runtime/RTBuilder.h | ||
index 845ba38..a09a506 100644 | ||
--- a/include/flang/Optimizer/Builder/Runtime/RTBuilder.h | ||
+++ b/include/flang/Optimizer/Builder/Runtime/RTBuilder.h | ||
@@ -28,7 +28,7 @@ | ||
@@ -29,7 +29,7 @@ | ||
#include <cstdint> | ||
#include <functional> | ||
|
||
|
@@ -9,6 +22,8 @@ | |
// On Windows* OS GetCurrentProcessId returns DWORD aka uint32_t | ||
typedef std::uint32_t pid_t; | ||
#endif | ||
diff --git a/include/flang/Runtime/command.h b/include/flang/Runtime/command.h | ||
index 7ab3f64..3add66d 100644 | ||
--- a/include/flang/Runtime/command.h | ||
+++ b/include/flang/Runtime/command.h | ||
@@ -12,7 +12,7 @@ | ||
|
@@ -20,6 +35,8 @@ | |
// On Windows* OS GetCurrentProcessId returns DWORD aka uint32_t | ||
typedef std::uint32_t pid_t; | ||
#else | ||
diff --git a/runtime/command.cpp b/runtime/command.cpp | ||
index a555e26..bed4d95 100644 | ||
--- a/runtime/command.cpp | ||
+++ b/runtime/command.cpp | ||
@@ -15,7 +15,7 @@ | ||
|
@@ -28,6 +45,9 @@ | |
|
||
-#ifdef _WIN32 | ||
+#ifdef _MSC_VER | ||
#define WIN32_LEAN_AND_MEAN | ||
#define NOMINMAX | ||
#include <windows.h> | ||
#include "flang/Common/windows-include.h" | ||
#include <direct.h> | ||
#define getcwd _getcwd | ||
-- | ||
2.46.0.windows.1 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,22 @@ | ||
Index: flang/lib/Frontend/CompilerInvocation.cpp | ||
=================================================================== | ||
--- flang/lib/Frontend/CompilerInvocation.cpp | ||
+++ flang/lib/Frontend/CompilerInvocation.cpp | ||
@@ -64,8 +64,8 @@ | ||
From 46eee1636a609c513d9e2d09a51125a9895dd3c9 Mon Sep 17 00:00:00 2001 | ||
From: oltolm <[email protected]> | ||
Date: Mon, 30 Sep 2024 00:05:50 +0200 | ||
Subject: [PATCH] Rename flang-new -flang-experimental-exec to flang | ||
|
||
--- | ||
lib/Frontend/CompilerInvocation.cpp | 6 +++--- | ||
lib/Frontend/FrontendActions.cpp | 2 +- | ||
lib/FrontendTool/ExecuteCompilerInvocation.cpp | 3 +-- | ||
tools/f18/CMakeLists.txt | 10 +++++----- | ||
tools/flang-driver/CMakeLists.txt | 12 ++++++------ | ||
tools/flang-driver/driver.cpp | 7 ++++--- | ||
6 files changed, 20 insertions(+), 20 deletions(-) | ||
|
||
diff --git a/lib/Frontend/CompilerInvocation.cpp b/lib/Frontend/CompilerInvocation.cpp | ||
index 8c892d9..693df9c 100644 | ||
--- a/lib/Frontend/CompilerInvocation.cpp | ||
+++ b/lib/Frontend/CompilerInvocation.cpp | ||
@@ -65,8 +65,8 @@ CompilerInvocationBase::~CompilerInvocationBase() = default; | ||
static bool parseShowColorsArgs(const llvm::opt::ArgList &args, | ||
bool defaultColor = true) { | ||
// Color diagnostics default to auto ("on" if terminal supports) in the | ||
|
@@ -13,7 +27,7 @@ Index: flang/lib/Frontend/CompilerInvocation.cpp | |
// Support both clang's -f[no-]color-diagnostics and gcc's | ||
// -f[no-]diagnostics-colors[=never|always|auto]. | ||
enum { | ||
@@ -833,7 +833,7 @@ | ||
@@ -880,7 +880,7 @@ static bool parseDiagArgs(CompilerInvocation &res, llvm::opt::ArgList &args, | ||
} | ||
} | ||
|
||
|
@@ -22,11 +36,11 @@ Index: flang/lib/Frontend/CompilerInvocation.cpp | |
res.getFrontendOpts().showColors = | ||
parseShowColorsArgs(args, /*defaultDiagColor=*/false); | ||
|
||
Index: flang/lib/Frontend/FrontendActions.cpp | ||
=================================================================== | ||
--- flang/lib/Frontend/FrontendActions.cpp | ||
+++ flang/lib/Frontend/FrontendActions.cpp | ||
@@ -225,7 +225,7 @@ | ||
diff --git a/lib/Frontend/FrontendActions.cpp b/lib/Frontend/FrontendActions.cpp | ||
index 5c86bd9..aa0c4fd 100644 | ||
--- a/lib/Frontend/FrontendActions.cpp | ||
+++ b/lib/Frontend/FrontendActions.cpp | ||
@@ -230,7 +230,7 @@ bool CodeGenAction::beginSourceFileAction() { | ||
llvm::SMDiagnostic err; | ||
llvmModule = llvm::parseIRFile(getCurrentInput().getFile(), err, *llvmCtx); | ||
if (!llvmModule || llvm::verifyModule(*llvmModule, &llvm::errs())) { | ||
|
@@ -35,11 +49,11 @@ Index: flang/lib/Frontend/FrontendActions.cpp | |
unsigned diagID = ci.getDiagnostics().getCustomDiagID( | ||
clang::DiagnosticsEngine::Error, "Could not parse IR"); | ||
ci.getDiagnostics().Report(diagID); | ||
Index: flang/lib/FrontendTool/ExecuteCompilerInvocation.cpp | ||
=================================================================== | ||
--- flang/lib/FrontendTool/ExecuteCompilerInvocation.cpp | ||
+++ flang/lib/FrontendTool/ExecuteCompilerInvocation.cpp | ||
@@ -152,8 +152,7 @@ | ||
diff --git a/lib/FrontendTool/ExecuteCompilerInvocation.cpp b/lib/FrontendTool/ExecuteCompilerInvocation.cpp | ||
index e2cbd51..09ac129 100644 | ||
--- a/lib/FrontendTool/ExecuteCompilerInvocation.cpp | ||
+++ b/lib/FrontendTool/ExecuteCompilerInvocation.cpp | ||
@@ -154,8 +154,7 @@ bool executeCompilerInvocation(CompilerInstance *flang) { | ||
// Honor -help. | ||
if (flang->getFrontendOpts().showHelp) { | ||
clang::driver::getDriverOptTable().printHelp( | ||
|
@@ -49,110 +63,55 @@ Index: flang/lib/FrontendTool/ExecuteCompilerInvocation.cpp | |
/*ShowHidden=*/false, /*ShowAllAliases=*/false, | ||
llvm::opt::Visibility(clang::driver::options::FC1Option)); | ||
return true; | ||
--- flang/tools/f18/CMakeLists.txt | ||
+++ flang/tools/f18/CMakeLists.txt | ||
@@ -23,7 +23,7 @@ | ||
) | ||
diff --git a/tools/f18/CMakeLists.txt b/tools/f18/CMakeLists.txt | ||
index cec4e2d..cbe083f 100644 | ||
--- a/tools/f18/CMakeLists.txt | ||
+++ b/tools/f18/CMakeLists.txt | ||
@@ -36,7 +36,7 @@ set(MODULES ${MODULES_WITH_IMPLEMENTATION} ${MODULES_WITHOUT_IMPLEMENTATION}) | ||
set(module_objects "") | ||
|
||
# Create module files directly from the top-level module source directory. | ||
-# If CMAKE_CROSSCOMPILING, then the newly built flang-new executable was | ||
+# If CMAKE_CROSSCOMPILING, then the newly built flang executable was | ||
# cross compiled, and thus can't be executed on the build system and thus | ||
# can't be used for generating module files. | ||
if (NOT CMAKE_CROSSCOMPILING) | ||
@@ -61,9 +61,9 @@ | ||
|
||
add_custom_command(OUTPUT ${base}.mod | ||
@@ -92,9 +92,9 @@ if (NOT CMAKE_CROSSCOMPILING) | ||
# TODO: We may need to flag this with conditional, in case Flang is built w/o OpenMP support | ||
add_custom_command(OUTPUT ${base}.mod ${object_output} | ||
COMMAND ${CMAKE_COMMAND} -E make_directory ${FLANG_INTRINSIC_MODULES_DIR} | ||
- COMMAND flang-new ${opts} -cpp ${compile_with} -module-dir ${FLANG_INTRINSIC_MODULES_DIR} | ||
+ COMMAND flang ${opts} -cpp ${compile_with} -module-dir ${FLANG_INTRINSIC_MODULES_DIR} | ||
${FLANG_SOURCE_DIR}/module/${filename}.f90 | ||
- DEPENDS flang-new ${FLANG_SOURCE_DIR}/module/${filename}.f90 ${FLANG_SOURCE_DIR}/module/__fortran_builtins.f90 ${depends} | ||
+ DEPENDS flang ${FLANG_SOURCE_DIR}/module/${filename}.f90 ${FLANG_SOURCE_DIR}/module/__fortran_builtins.f90 ${depends} | ||
) | ||
list(APPEND MODULE_FILES ${base}.mod) | ||
install(FILES ${base}.mod DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/flang") | ||
@@ -119,9 +119,9 @@ if (NOT CMAKE_CROSSCOMPILING) | ||
set(base ${FLANG_INTRINSIC_MODULES_DIR}/omp_lib) | ||
add_custom_command(OUTPUT ${base}.mod ${base}_kinds.mod | ||
COMMAND ${CMAKE_COMMAND} -E make_directory ${FLANG_INTRINSIC_MODULES_DIR} | ||
- COMMAND flang-new -cpp -fsyntax-only ${opts} -module-dir ${FLANG_INTRINSIC_MODULES_DIR} | ||
+ COMMAND flang -cpp -fsyntax-only ${opts} -module-dir ${FLANG_INTRINSIC_MODULES_DIR} | ||
${FLANG_SOURCE_DIR}/module/${filename}.f90 | ||
- DEPENDS flang-new ${FLANG_SOURCE_DIR}/module/${filename}.f90 ${depends} | ||
+ DEPENDS flang ${FLANG_SOURCE_DIR}/module/${filename}.f90 ${depends} | ||
${CMAKE_BINARY_DIR}/projects/openmp/runtime/src/omp_lib.F90 | ||
- DEPENDS flang-new ${FLANG_INTRINSIC_MODULES_DIR}/iso_c_binding.mod ${CMAKE_BINARY_DIR}/projects/openmp/runtime/src/omp_lib.F90 ${depends} | ||
+ DEPENDS flang ${FLANG_INTRINSIC_MODULES_DIR}/iso_c_binding.mod ${CMAKE_BINARY_DIR}/projects/openmp/runtime/src/omp_lib.F90 ${depends} | ||
) | ||
add_custom_command(OUTPUT ${base}.f18.mod | ||
DEPENDS ${base}.mod | ||
Index: flang/tools/f18/flang-to-external-fc.in | ||
=================================================================== | ||
--- flang/tools/f18/flang-to-external-fc.in | ||
+++ flang/tools/f18/flang-to-external-fc.in | ||
@@ -209,7 +209,7 @@ | ||
|
||
if | ||
# The options claimed by Flang. This list needs to be compatible with | ||
- # what's supported by Flang's compiler driver (i.e. `flang-new`). | ||
+ # what's supported by Flang's compiler driver (i.e. `flang`). | ||
[[ $opt == "-cpp" ]] || | ||
[[ $opt =~ ^-D.* ]] || | ||
[[ $opt == "-E" ]] || | ||
@@ -236,7 +236,7 @@ | ||
[[ $opt == "-Werror" ]]; then | ||
flang_opts+=($opt) | ||
elif | ||
- # We translate the following into equivalents understood by `flang-new` | ||
+ # We translate the following into equivalents understood by `flang` | ||
[[ $opt == "-Mfixed" ]] || [[ $opt == "-Mfree" ]]; then | ||
case $opt in | ||
-Mfixed) | ||
@@ -248,7 +248,7 @@ | ||
;; | ||
|
||
*) | ||
- echo "ERROR: $opt has no equivalent in 'flang-new'" | ||
+ echo "ERROR: $opt has no equivalent in 'flang'" | ||
exit 1 | ||
;; | ||
esac | ||
@@ -309,9 +309,9 @@ | ||
|
||
# Preprocess fortran sources using Flang | ||
for idx in "${!fortran_srcs[@]}"; do | ||
- if ! "$wd/bin/flang-new" -E "${opts[@]}" "${fortran_srcs[$idx]}" ${output_definition:+$output_definition} | ||
+ if ! "$wd/bin/flang" -E "${opts[@]}" "${fortran_srcs[$idx]}" ${output_definition:+$output_definition} | ||
then status=$? | ||
- echo flang: in "$PWD", flang-new failed with exit status $status: "$wd/bin/flang-new" "${opts[@]}" "$@" >&2 | ||
+ echo flang: in "$PWD", flang failed with exit status $status: "$wd/bin/flang" "${opts[@]}" "$@" >&2 | ||
exit $status | ||
fi | ||
done | ||
@@ -320,7 +320,7 @@ | ||
for idx in "${!other_srcs[@]}"; do | ||
if ! $ext_fc -E "${opts[@]}" "${other_srcs[$idx]}" ${output_definition:+$output_definition} | ||
then status=$? | ||
- echo flang: in "$PWD", flang-new failed with exit status $status: "$wd/bin/flang-new" "${opts[@]}" "$@" >&2 | ||
+ echo flang: in "$PWD", flang failed with exit status $status: "$wd/bin/flang" "${opts[@]}" "$@" >&2 | ||
exit $status | ||
fi | ||
done | ||
@@ -412,11 +412,11 @@ | ||
[[ ! -z ${INTRINSICS_MOD_DIR} ]] && flang_options+=("-intrinsics-module-directory ${INTRINSICS_MOD_DIR}") | ||
for idx in "${!fortran_source_files[@]}"; do | ||
set +e | ||
- "$wd/bin/flang-new" "${flang_options[@]}" "${fortran_source_files[$idx]}" -o "${unparsed_file_base}_${idx}.f90" | ||
+ "$wd/bin/flang" "${flang_options[@]}" "${fortran_source_files[$idx]}" -o "${unparsed_file_base}_${idx}.f90" | ||
ret_status=$? | ||
set -e | ||
if [[ $ret_status != 0 ]]; then | ||
- echo flang: in "$PWD", flang-new failed with exit status "$ret_status": "$wd/bin/flang-new" "${flang_options[@]}" "$@" >&2 | ||
+ echo flang: in "$PWD", flang failed with exit status "$ret_status": "$wd/bin/flang" "${flang_options[@]}" "$@" >&2 | ||
exit "$ret_status" | ||
fi | ||
done | ||
Index: flang/tools/flang-driver/CMakeLists.txt | ||
=================================================================== | ||
--- flang/tools/flang-driver/CMakeLists.txt | ||
+++ flang/tools/flang-driver/CMakeLists.txt | ||
@@ -11,7 +11,7 @@ | ||
diff --git a/tools/flang-driver/CMakeLists.txt b/tools/flang-driver/CMakeLists.txt | ||
index 9f33cdf..615c673 100644 | ||
--- a/tools/flang-driver/CMakeLists.txt | ||
+++ b/tools/flang-driver/CMakeLists.txt | ||
@@ -11,18 +11,18 @@ set( LLVM_LINK_COMPONENTS | ||
TargetParser | ||
) | ||
|
||
-add_flang_tool(flang-new | ||
+add_flang_tool(flang | ||
driver.cpp | ||
fc1_main.cpp | ||
|
||
@@ -24,13 +24,13 @@ | ||
Fortran_main | ||
) | ||
|
||
-target_link_libraries(flang-new | ||
|
@@ -167,7 +126,7 @@ Index: flang/tools/flang-driver/CMakeLists.txt | |
PRIVATE | ||
clangDriver | ||
clangBasic | ||
@@ -38,9 +38,9 @@ | ||
@@ -30,9 +30,9 @@ clang_target_link_libraries(flang-new | ||
|
||
option(FLANG_PLUGIN_SUPPORT "Build Flang with plugin support." ON) | ||
|
||
|
@@ -180,11 +139,11 @@ Index: flang/tools/flang-driver/CMakeLists.txt | |
|
||
-install(TARGETS flang-new DESTINATION "${CMAKE_INSTALL_BINDIR}") | ||
+install(TARGETS flang DESTINATION "${CMAKE_INSTALL_BINDIR}") | ||
Index: flang/tools/flang-driver/driver.cpp | ||
=================================================================== | ||
--- flang/tools/flang-driver/driver.cpp | ||
+++ flang/tools/flang-driver/driver.cpp | ||
@@ -88,14 +88,15 @@ | ||
diff --git a/tools/flang-driver/driver.cpp b/tools/flang-driver/driver.cpp | ||
index 52136df..39198d2 100644 | ||
--- a/tools/flang-driver/driver.cpp | ||
+++ b/tools/flang-driver/driver.cpp | ||
@@ -88,14 +88,15 @@ int main(int argc, const char **argv) { | ||
llvm::InitLLVM x(argc, argv); | ||
llvm::SmallVector<const char *, 256> args(argv, argv + argc); | ||
|
||
|
@@ -202,7 +161,7 @@ Index: flang/tools/flang-driver/driver.cpp | |
auto firstArg = std::find_if(args.begin() + 1, args.end(), | ||
[](const char *a) { return a != nullptr; }); | ||
if (firstArg != args.end()) { | ||
@@ -104,7 +104,7 @@ | ||
@@ -104,7 +105,7 @@ int main(int argc, const char **argv) { | ||
<< "Valid tools include '-fc1'.\n"; | ||
return 1; | ||
} | ||
|
@@ -211,3 +170,6 @@ Index: flang/tools/flang-driver/driver.cpp | |
if (llvm::StringRef(args[1]).starts_with("-fc1")) { | ||
return executeFC1Tool(args); | ||
} | ||
-- | ||
2.46.0.windows.1 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.