https://github.com/Meinersbur updated https://github.com/llvm/llvm-project/pull/121997
>From a08aa48fb4955f9d16c6172580505c100076b5d4 Mon Sep 17 00:00:00 2001 From: Michael Kruse <llvm-proj...@meinersbur.de> Date: Tue, 7 Jan 2025 17:05:39 +0100 Subject: [PATCH 1/3] Join FortranDecimal into FortranCommon --- clang/lib/Driver/ToolChains/CommonArgs.cpp | 3 +- clang/lib/Driver/ToolChains/Flang.cpp | 4 - flang/docs/FlangDriver.md | 5 +- .../binary-floating-point.h | 8 +- .../flang/{Decimal => Common}/decimal.h | 11 ++- flang/lib/CMakeLists.txt | 1 - flang/lib/Common/CMakeLists.txt | 2 + .../big-radix-floating-point.h | 12 +-- .../{Decimal => Common}/binary-to-decimal.cpp | 4 +- .../{Decimal => Common}/decimal-to-binary.cpp | 6 +- flang/lib/Decimal/CMakeLists.txt | 86 ------------------- flang/lib/Evaluate/CMakeLists.txt | 1 - flang/lib/Evaluate/real.cpp | 2 +- flang/runtime/CMakeLists.txt | 14 +-- flang/runtime/edit-input.h | 2 +- flang/runtime/edit-output.h | 2 +- flang/runtime/environment.h | 2 +- flang/runtime/format-implementation.h | 2 +- flang/runtime/format.h | 2 +- flang/test/CMakeLists.txt | 1 - flang/test/Driver/linker-flags.f90 | 6 +- .../test/Driver/msvc-dependent-lib-flags.f90 | 4 - flang/test/Driver/nostdlib.f90 | 1 - flang/test/Runtime/no-cpp-dep.c | 2 +- flang/test/lit.cfg.py | 3 - flang/unittests/Decimal/CMakeLists.txt | 4 +- flang/unittests/Decimal/quick-sanity-test.cpp | 2 +- flang/unittests/Decimal/thorough-test.cpp | 2 +- flang/unittests/Evaluate/CMakeLists.txt | 2 - lld/COFF/MinGW.cpp | 1 - 30 files changed, 40 insertions(+), 157 deletions(-) rename flang/include/flang/{Decimal => Common}/binary-floating-point.h (96%) rename flang/include/flang/{Decimal => Common}/decimal.h (95%) rename flang/lib/{Decimal => Common}/big-radix-floating-point.h (97%) rename flang/lib/{Decimal => Common}/binary-to-decimal.cpp (99%) rename flang/lib/{Decimal => Common}/decimal-to-binary.cpp (99%) delete mode 100644 flang/lib/Decimal/CMakeLists.txt diff --git a/clang/lib/Driver/ToolChains/CommonArgs.cpp b/clang/lib/Driver/ToolChains/CommonArgs.cpp index 60214c4d59cee5..9e9872975de9c2 100644 --- a/clang/lib/Driver/ToolChains/CommonArgs.cpp +++ b/clang/lib/Driver/ToolChains/CommonArgs.cpp @@ -1317,7 +1317,7 @@ void tools::addOpenMPHostOffloadingArgs(const Compilation &C, /// Add Fortran runtime libs void tools::addFortranRuntimeLibs(const ToolChain &TC, const ArgList &Args, llvm::opt::ArgStringList &CmdArgs) { - // Link FortranRuntime and FortranDecimal + // Link FortranRuntime // These are handled earlier on Windows by telling the frontend driver to // add the correct libraries to link against as dependents in the object // file. @@ -1334,7 +1334,6 @@ void tools::addFortranRuntimeLibs(const ToolChain &TC, const ArgList &Args, addAsNeededOption(TC, Args, CmdArgs, /*as_needed=*/false); } CmdArgs.push_back("-lFortranRuntime"); - CmdArgs.push_back("-lFortranDecimal"); addArchSpecificRPath(TC, Args, CmdArgs); } diff --git a/clang/lib/Driver/ToolChains/Flang.cpp b/clang/lib/Driver/ToolChains/Flang.cpp index 7034e5b475c1d3..749af4ada9a696 100644 --- a/clang/lib/Driver/ToolChains/Flang.cpp +++ b/clang/lib/Driver/ToolChains/Flang.cpp @@ -357,21 +357,18 @@ static void processVSRuntimeLibrary(const ToolChain &TC, const ArgList &Args, CmdArgs.push_back("-D_MT"); CmdArgs.push_back("--dependent-lib=libcmt"); CmdArgs.push_back("--dependent-lib=FortranRuntime.static.lib"); - CmdArgs.push_back("--dependent-lib=FortranDecimal.static.lib"); break; case options::OPT__SLASH_MTd: CmdArgs.push_back("-D_MT"); CmdArgs.push_back("-D_DEBUG"); CmdArgs.push_back("--dependent-lib=libcmtd"); CmdArgs.push_back("--dependent-lib=FortranRuntime.static_dbg.lib"); - CmdArgs.push_back("--dependent-lib=FortranDecimal.static_dbg.lib"); break; case options::OPT__SLASH_MD: CmdArgs.push_back("-D_MT"); CmdArgs.push_back("-D_DLL"); CmdArgs.push_back("--dependent-lib=msvcrt"); CmdArgs.push_back("--dependent-lib=FortranRuntime.dynamic.lib"); - CmdArgs.push_back("--dependent-lib=FortranDecimal.dynamic.lib"); break; case options::OPT__SLASH_MDd: CmdArgs.push_back("-D_MT"); @@ -379,7 +376,6 @@ static void processVSRuntimeLibrary(const ToolChain &TC, const ArgList &Args, CmdArgs.push_back("-D_DLL"); CmdArgs.push_back("--dependent-lib=msvcrtd"); CmdArgs.push_back("--dependent-lib=FortranRuntime.dynamic_dbg.lib"); - CmdArgs.push_back("--dependent-lib=FortranDecimal.dynamic_dbg.lib"); break; } } diff --git a/flang/docs/FlangDriver.md b/flang/docs/FlangDriver.md index 23cbab30ee903e..8131e6ffd514dc 100644 --- a/flang/docs/FlangDriver.md +++ b/flang/docs/FlangDriver.md @@ -175,19 +175,18 @@ like this: ``` $ flang -v -o example example.o -"/usr/bin/ld" [...] example.o [...] "-lFortranRuntime" "-lFortranDecimal" [...] +"/usr/bin/ld" [...] example.o [...] "-lFortranRuntime" [...] ``` The automatically added libraries are: * `FortranRuntime`: Provides most of the Flang runtime library. -* `FortranDecimal`: Provides operations for decimal numbers. If the code is C/C++ based and invokes Fortran routines, one can either use Clang or Flang as the linker driver. If Clang is used, it will automatically all required runtime libraries needed by C++ (e.g., for STL) to the linker invocation. In this case, one has to explicitly provide the Fortran runtime libraries -`FortranRuntime` and/or `FortranDecimal`. An alternative is to use Flang to link. +`FortranRuntime`. An alternative is to use Flang to link. In this case, it may be required to explicitly supply C++ runtime libraries. On Darwin, the logical root where the system libraries are located (sysroot) diff --git a/flang/include/flang/Decimal/binary-floating-point.h b/flang/include/flang/Common/binary-floating-point.h similarity index 96% rename from flang/include/flang/Decimal/binary-floating-point.h rename to flang/include/flang/Common/binary-floating-point.h index 1e0cde97d98e61..705acc31bdfb21 100644 --- a/flang/include/flang/Decimal/binary-floating-point.h +++ b/flang/include/flang/Common/binary-floating-point.h @@ -1,4 +1,4 @@ -//===-- include/flang/Decimal/binary-floating-point.h -----------*- C++ -*-===// +//===-- include/flang/Common/binary-floating-point.h ------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -6,8 +6,8 @@ // //===----------------------------------------------------------------------===// -#ifndef FORTRAN_DECIMAL_BINARY_FLOATING_POINT_H_ -#define FORTRAN_DECIMAL_BINARY_FLOATING_POINT_H_ +#ifndef FORTRAN_COMMON_BINARY_FLOATING_POINT_H_ +#define FORTRAN_COMMON_BINARY_FLOATING_POINT_H_ // Access and manipulate the fields of an IEEE-754 binary // floating-point value via a generalized template. @@ -208,4 +208,4 @@ template <int BINARY_PRECISION> class BinaryFloatingPointNumber { RawType raw_{0}; }; } // namespace Fortran::decimal -#endif +#endif /* FORTRAN_COMMON_BINARY_FLOATING_POINT_H_ */ diff --git a/flang/include/flang/Decimal/decimal.h b/flang/include/flang/Common/decimal.h similarity index 95% rename from flang/include/flang/Decimal/decimal.h rename to flang/include/flang/Common/decimal.h index 443163d058e28b..c086f97129f6a5 100644 --- a/flang/include/flang/Decimal/decimal.h +++ b/flang/include/flang/Common/decimal.h @@ -1,16 +1,15 @@ -/*===-- include/flang/Decimal/decimal.h ---------------------------*- C++ -*-=== +/*===-- include/flang/Common/decimal.h ------------------------------*- C -*-=== * * 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: Apache-2.0 WITH LLVM-exception * - * ===-----------------------------------------------------------------------=== - */ + *===----------------------------------------------------------------------===*/ /* C and C++ API for binary-to/from-decimal conversion package. */ -#ifndef FORTRAN_DECIMAL_DECIMAL_H_ -#define FORTRAN_DECIMAL_DECIMAL_H_ +#ifndef FORTRAN_COMMON_DECIMAL_H_ +#define FORTRAN_COMMON_DECIMAL_H_ #include "flang/Common/api-attrs.h" #include <stddef.h> @@ -137,4 +136,4 @@ RT_API_ATTRS enum NS(ConversionResultFlags) ConvertDecimalToLongDouble( #ifdef __cplusplus } // extern "C" #endif -#endif +#endif /* FORTRAN_COMMON_DECIMAL_H_ */ diff --git a/flang/lib/CMakeLists.txt b/flang/lib/CMakeLists.txt index f41d4df1f07e3c..e5a5e504ec1a4e 100644 --- a/flang/lib/CMakeLists.txt +++ b/flang/lib/CMakeLists.txt @@ -1,6 +1,5 @@ add_subdirectory(Common) add_subdirectory(Evaluate) -add_subdirectory(Decimal) add_subdirectory(Lower) add_subdirectory(Parser) add_subdirectory(Semantics) diff --git a/flang/lib/Common/CMakeLists.txt b/flang/lib/Common/CMakeLists.txt index de6bea396f3cbe..3e5f0b13af8881 100644 --- a/flang/lib/Common/CMakeLists.txt +++ b/flang/lib/Common/CMakeLists.txt @@ -35,6 +35,8 @@ if(FLANG_VENDOR) endif() add_flang_library(FortranCommon + binary-to-decimal.cpp + decimal-to-binary.cpp Fortran.cpp Fortran-features.cpp default-kinds.cpp diff --git a/flang/lib/Decimal/big-radix-floating-point.h b/flang/lib/Common/big-radix-floating-point.h similarity index 97% rename from flang/lib/Decimal/big-radix-floating-point.h rename to flang/lib/Common/big-radix-floating-point.h index f9afebf5b3d703..6d247f3796eea5 100644 --- a/flang/lib/Decimal/big-radix-floating-point.h +++ b/flang/lib/Common/big-radix-floating-point.h @@ -1,4 +1,4 @@ -//===-- lib/Decimal/big-radix-floating-point.h ------------------*- C++ -*-===// +//===-- lib/Common/big-radix-floating-point.h -------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -6,8 +6,8 @@ // //===----------------------------------------------------------------------===// -#ifndef FORTRAN_DECIMAL_BIG_RADIX_FLOATING_POINT_H_ -#define FORTRAN_DECIMAL_BIG_RADIX_FLOATING_POINT_H_ +#ifndef FORTRAN_COMMON_BIG_RADIX_FLOATING_POINT_H_ +#define FORTRAN_COMMON_BIG_RADIX_FLOATING_POINT_H_ // This is a helper class for use in floating-point conversions between // binary and decimal representations. It holds a multiple-precision @@ -21,11 +21,11 @@ // for conversions between binary and decimal representations; it is not // a general-purpose facility. +#include "flang/Common/binary-floating-point.h" #include "flang/Common/bit-population-count.h" +#include "flang/Common/decimal.h" #include "flang/Common/leading-zero-bit-count.h" #include "flang/Common/uint128.h" -#include "flang/Decimal/binary-floating-point.h" -#include "flang/Decimal/decimal.h" #include <cinttypes> #include <limits> #include <type_traits> @@ -393,4 +393,4 @@ template <int PREC, int LOG10RADIX = 16> class BigRadixFloatingPointNumber { enum FortranRounding rounding_ { RoundNearest }; }; } // namespace Fortran::decimal -#endif +#endif /* FORTRAN_COMMON_BIG_RADIX_FLOATING_POINT_H_ */ diff --git a/flang/lib/Decimal/binary-to-decimal.cpp b/flang/lib/Common/binary-to-decimal.cpp similarity index 99% rename from flang/lib/Decimal/binary-to-decimal.cpp rename to flang/lib/Common/binary-to-decimal.cpp index b64865e95df24d..fb2caefdae8fa1 100644 --- a/flang/lib/Decimal/binary-to-decimal.cpp +++ b/flang/lib/Common/binary-to-decimal.cpp @@ -1,4 +1,4 @@ -//===-- lib/Decimal/binary-to-decimal.cpp ---------------------------------===// +//===-- lib/Common/binary-to-decimal.cpp ------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -7,7 +7,7 @@ //===----------------------------------------------------------------------===// #include "big-radix-floating-point.h" -#include "flang/Decimal/decimal.h" +#include "flang/Common/decimal.h" #include <cassert> #include <cfloat> #include <string> diff --git a/flang/lib/Decimal/decimal-to-binary.cpp b/flang/lib/Common/decimal-to-binary.cpp similarity index 99% rename from flang/lib/Decimal/decimal-to-binary.cpp rename to flang/lib/Common/decimal-to-binary.cpp index 94c51774237399..cbf1664e9c240d 100644 --- a/flang/lib/Decimal/decimal-to-binary.cpp +++ b/flang/lib/Common/decimal-to-binary.cpp @@ -1,4 +1,4 @@ -//===-- lib/Decimal/decimal-to-binary.cpp ---------------------------------===// +//===-- lib/Common/decimal-to-binary.cpp ------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -7,10 +7,10 @@ //===----------------------------------------------------------------------===// #include "big-radix-floating-point.h" +#include "flang/Common/binary-floating-point.h" #include "flang/Common/bit-population-count.h" +#include "flang/Common/decimal.h" #include "flang/Common/leading-zero-bit-count.h" -#include "flang/Decimal/binary-floating-point.h" -#include "flang/Decimal/decimal.h" #include "flang/Runtime/freestanding-tools.h" #include <cinttypes> #include <cstring> diff --git a/flang/lib/Decimal/CMakeLists.txt b/flang/lib/Decimal/CMakeLists.txt deleted file mode 100644 index 880b190f1c5815..00000000000000 --- a/flang/lib/Decimal/CMakeLists.txt +++ /dev/null @@ -1,86 +0,0 @@ -if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR) - cmake_minimum_required(VERSION 3.20.0) - - project(FortranDecimal C CXX) - - set(CMAKE_CXX_STANDARD 17) - set(CMAKE_CXX_STANDARD_REQUIRED TRUE) - set(CMAKE_CXX_EXTENSIONS OFF) - - set(FLANG_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../..") - - set(LLVM_COMMON_CMAKE_UTILS "${FLANG_SOURCE_DIR}/../cmake") - set(LLVM_CMAKE_UTILS "${FLANG_SOURCE_DIR}/../llvm/cmake") - set(CLANG_CMAKE_UTILS "${FLANG_SOURCE_DIR}/../clang/cmake") - - # Add path for custom modules - list(INSERT CMAKE_MODULE_PATH 0 - "${FLANG_SOURCE_DIR}/cmake" - "${FLANG_SOURCE_DIR}/cmake/modules" - "${LLVM_COMMON_CMAKE_UTILS}" - "${LLVM_COMMON_CMAKE_UTILS}/Modules" - "${LLVM_CMAKE_UTILS}" - "${LLVM_CMAKE_UTILS}/modules" - "${CLANG_CMAKE_UTILS}/modules" - ) - - include(AddClang) - include(AddLLVM) - include(AddFlang) - include(HandleLLVMOptions) - - include(TestBigEndian) - test_big_endian(IS_BIGENDIAN) - if (IS_BIGENDIAN) - add_compile_definitions(FLANG_BIG_ENDIAN=1) - else () - add_compile_definitions(FLANG_LITTLE_ENDIAN=1) - endif () - include_directories(BEFORE - ${FLANG_SOURCE_DIR}/include) -endif() - -check_cxx_compiler_flag(-fno-lto FLANG_RUNTIME_HAS_FNO_LTO_FLAG) -if (FLANG_RUNTIME_HAS_FNO_LTO_FLAG) - append("-fno-lto" CMAKE_CXX_FLAGS) -endif() - -# Disable libstdc++ assertions, even in an LLVM_ENABLE_ASSERTIONS build, to -# avoid an unwanted dependency on libstdc++.so. -add_definitions(-U_GLIBCXX_ASSERTIONS) - -set(sources - binary-to-decimal.cpp - decimal-to-binary.cpp -) - -include(AddFlangOffloadRuntime) -enable_cuda_compilation(FortranDecimal "${sources}") -enable_omp_offload_compilation("${sources}") - -add_flang_library(FortranDecimal INSTALL_WITH_TOOLCHAIN ${sources}) - -if (DEFINED MSVC) - set(CMAKE_MSVC_RUNTIME_LIBRARY MultiThreaded) - add_flang_library(FortranDecimal.static INSTALL_WITH_TOOLCHAIN - binary-to-decimal.cpp - decimal-to-binary.cpp - ) - set(CMAKE_MSVC_RUNTIME_LIBRARY MultiThreadedDLL) - add_flang_library(FortranDecimal.dynamic INSTALL_WITH_TOOLCHAIN - binary-to-decimal.cpp - decimal-to-binary.cpp - ) - set(CMAKE_MSVC_RUNTIME_LIBRARY MultiThreadedDebug) - add_flang_library(FortranDecimal.static_dbg INSTALL_WITH_TOOLCHAIN - binary-to-decimal.cpp - decimal-to-binary.cpp - ) - set(CMAKE_MSVC_RUNTIME_LIBRARY MultiThreadedDebugDLL) - add_flang_library(FortranDecimal.dynamic_dbg INSTALL_WITH_TOOLCHAIN - binary-to-decimal.cpp - decimal-to-binary.cpp - ) - add_dependencies(FortranDecimal FortranDecimal.static FortranDecimal.dynamic - FortranDecimal.static_dbg FortranDecimal.dynamic_dbg) -endif() diff --git a/flang/lib/Evaluate/CMakeLists.txt b/flang/lib/Evaluate/CMakeLists.txt index b38f450d746ea7..ebdc55cff91c43 100644 --- a/flang/lib/Evaluate/CMakeLists.txt +++ b/flang/lib/Evaluate/CMakeLists.txt @@ -61,7 +61,6 @@ add_flang_library(FortranEvaluate LINK_LIBS FortranCommon - FortranDecimal FortranParser ${LIBPGMATH} ${QUADMATHLIB} diff --git a/flang/lib/Evaluate/real.cpp b/flang/lib/Evaluate/real.cpp index 2c0f2833f07dc5..af6df14f119c53 100644 --- a/flang/lib/Evaluate/real.cpp +++ b/flang/lib/Evaluate/real.cpp @@ -9,7 +9,7 @@ #include "flang/Evaluate/real.h" #include "int-power.h" #include "flang/Common/idioms.h" -#include "flang/Decimal/decimal.h" +#include "flang/Common/decimal.h" #include "flang/Parser/characters.h" #include "llvm/Support/raw_ostream.h" #include <limits> diff --git a/flang/runtime/CMakeLists.txt b/flang/runtime/CMakeLists.txt index fbfaae9a880648..8e74467aa399eb 100644 --- a/flang/runtime/CMakeLists.txt +++ b/flang/runtime/CMakeLists.txt @@ -111,6 +111,8 @@ add_definitions(-U_LIBCPP_ENABLE_ASSERTIONS) add_subdirectory(Float128Math) set(sources + ${FLANG_SOURCE_DIR}/lib/Common/binary-to-decimal.cpp + ${FLANG_SOURCE_DIR}/lib/Common/decimal-to-binary.cpp ISO_Fortran_binding.cpp allocator-registry.cpp allocatable.cpp @@ -270,39 +272,27 @@ endif() if (NOT DEFINED MSVC) add_flang_library(FortranRuntime ${sources} - LINK_LIBS - FortranDecimal INSTALL_WITH_TOOLCHAIN ) else() add_flang_library(FortranRuntime ${sources} - LINK_LIBS - FortranDecimal ) set(CMAKE_MSVC_RUNTIME_LIBRARY MultiThreaded) add_flang_library(FortranRuntime.static ${sources} - LINK_LIBS - FortranDecimal.static INSTALL_WITH_TOOLCHAIN) set_target_properties(FortranRuntime.static PROPERTIES FOLDER "Flang/Runtime Libraries") set(CMAKE_MSVC_RUNTIME_LIBRARY MultiThreadedDLL) add_flang_library(FortranRuntime.dynamic ${sources} - LINK_LIBS - FortranDecimal.dynamic INSTALL_WITH_TOOLCHAIN) set_target_properties(FortranRuntime.dynamic PROPERTIES FOLDER "Flang/Runtime Libraries") set(CMAKE_MSVC_RUNTIME_LIBRARY MultiThreadedDebug) add_flang_library(FortranRuntime.static_dbg ${sources} - LINK_LIBS - FortranDecimal.static_dbg INSTALL_WITH_TOOLCHAIN) set_target_properties(FortranRuntime.static_dbg PROPERTIES FOLDER "Flang/Runtime Libraries") set(CMAKE_MSVC_RUNTIME_LIBRARY MultiThreadedDebugDLL) add_flang_library(FortranRuntime.dynamic_dbg ${sources} - LINK_LIBS - FortranDecimal.dynamic_dbg INSTALL_WITH_TOOLCHAIN) set_target_properties(FortranRuntime.dynamic_dbg PROPERTIES FOLDER "Flang/Runtime Libraries") add_dependencies(FortranRuntime FortranRuntime.static FortranRuntime.dynamic diff --git a/flang/runtime/edit-input.h b/flang/runtime/edit-input.h index 55a7a455781719..50d1db6e024053 100644 --- a/flang/runtime/edit-input.h +++ b/flang/runtime/edit-input.h @@ -11,7 +11,7 @@ #include "format.h" #include "io-stmt.h" -#include "flang/Decimal/decimal.h" +#include "flang/Common/decimal.h" namespace Fortran::runtime::io { diff --git a/flang/runtime/edit-output.h b/flang/runtime/edit-output.h index 42cc993f98cc1c..578c7c762f2e36 100644 --- a/flang/runtime/edit-output.h +++ b/flang/runtime/edit-output.h @@ -21,7 +21,7 @@ #include "format.h" #include "io-stmt.h" #include "flang/Common/uint128.h" -#include "flang/Decimal/decimal.h" +#include "flang/Common/decimal.h" namespace Fortran::runtime::io { diff --git a/flang/runtime/environment.h b/flang/runtime/environment.h index b8b9f10e4e57f5..dfa8c14dd64081 100644 --- a/flang/runtime/environment.h +++ b/flang/runtime/environment.h @@ -10,7 +10,7 @@ #define FORTRAN_RUNTIME_ENVIRONMENT_H_ #include "flang/Common/optional.h" -#include "flang/Decimal/decimal.h" +#include "flang/Common/decimal.h" struct EnvironmentDefaultList; diff --git a/flang/runtime/format-implementation.h b/flang/runtime/format-implementation.h index 46204ca927c135..783463ace8b27f 100644 --- a/flang/runtime/format-implementation.h +++ b/flang/runtime/format-implementation.h @@ -16,7 +16,7 @@ #include "io-stmt.h" #include "memory.h" #include "flang/Common/format.h" -#include "flang/Decimal/decimal.h" +#include "flang/Common/decimal.h" #include "flang/Runtime/main.h" #include <algorithm> #include <cstring> diff --git a/flang/runtime/format.h b/flang/runtime/format.h index 815bf70685e647..25aa8e9961e74a 100644 --- a/flang/runtime/format.h +++ b/flang/runtime/format.h @@ -15,7 +15,7 @@ #include "io-error.h" #include "flang/Common/Fortran-consts.h" #include "flang/Common/optional.h" -#include "flang/Decimal/decimal.h" +#include "flang/Common/decimal.h" #include "flang/Runtime/freestanding-tools.h" #include <cinttypes> diff --git a/flang/test/CMakeLists.txt b/flang/test/CMakeLists.txt index cab214c2ef4c8c..e38c9b50259376 100644 --- a/flang/test/CMakeLists.txt +++ b/flang/test/CMakeLists.txt @@ -72,7 +72,6 @@ set(FLANG_TEST_DEPENDS llvm-readobj split-file FortranRuntime - FortranDecimal ) if (LLVM_ENABLE_PLUGINS AND NOT WIN32) list(APPEND FLANG_TEST_DEPENDS Bye) diff --git a/flang/test/Driver/linker-flags.f90 b/flang/test/Driver/linker-flags.f90 index ac9500d7c45cec..fdeb95e4dd97c6 100644 --- a/flang/test/Driver/linker-flags.f90 +++ b/flang/test/Driver/linker-flags.f90 @@ -33,7 +33,7 @@ ! SOLARIS-F128NONE-NOT: FortranFloat128Math ! UNIX-F128LIBQUADMATH-SAME: "-lFortranFloat128Math" "--as-needed" "-lquadmath" "--no-as-needed" ! SOLARIS-F128LIBQUADMATH-SAME: "-lFortranFloat128Math" "-z" "ignore" "-lquadmath" "-z" "record" -! UNIX-SAME: "-lFortranRuntime" "-lFortranDecimal" "-lm" +! UNIX-SAME: "-lFortranRuntime" "-lm" ! COMPILER-RT: "{{.*}}{{\\|/}}libclang_rt.builtins.a" ! DARWIN-LABEL: "{{.*}}ld{{(\.exe)?}}" @@ -41,20 +41,18 @@ ! DARWIN-F128NONE-NOT: FortranFloat128Math ! DARWIN-F128LIBQUADMATH-SAME: "-lFortranFloat128Math" "--as-needed" "-lquadmath" "--no-as-needed" ! DARWIN-SAME: -lFortranRuntime -! DARWIN-SAME: -lFortranDecimal ! HAIKU-LABEL: "{{.*}}ld{{(\.exe)?}}" ! HAIKU-SAME: "[[object_file]]" ! HAIKU-F128NONE-NOT: FortranFloat128Math ! HAIKU-F128LIBQUADMATH-SAME: "-lFortranFloat128Math" "--as-needed" "-lquadmath" "--no-as-needed" -! HAIKU-SAME: "-lFortranRuntime" "-lFortranDecimal" +! HAIKU-SAME: "-lFortranRuntime" ! MINGW-LABEL: "{{.*}}ld{{(\.exe)?}}" ! MINGW-SAME: "[[object_file]]" ! MINGW-F128NONE-NOT: FortranFloat128Math ! MINGW-F128LIBQUADMATH-SAME: "-lFortranFloat128Math" "--as-needed" "-lquadmath" "--no-as-needed" ! MINGW-SAME: -lFortranRuntime -! MINGW-SAME: -lFortranDecimal ! NOTE: This also matches lld-link (when CLANG_DEFAULT_LINKER=lld) and ! any .exe suffix that is added when resolving to the full path of diff --git a/flang/test/Driver/msvc-dependent-lib-flags.f90 b/flang/test/Driver/msvc-dependent-lib-flags.f90 index 765917f07d8e72..befe61fdadcd14 100644 --- a/flang/test/Driver/msvc-dependent-lib-flags.f90 +++ b/flang/test/Driver/msvc-dependent-lib-flags.f90 @@ -8,7 +8,6 @@ ! MSVC-SAME: -D_MT ! MSVC-SAME: --dependent-lib=libcmt ! MSVC-SAME: --dependent-lib=FortranRuntime.static.lib -! MSVC-SAME: --dependent-lib=FortranDecimal.static.lib ! MSVC-DEBUG: -fc1 ! MSVC-DEBUG-SAME: --dependent-lib=clang_rt.builtins.lib @@ -16,7 +15,6 @@ ! MSVC-DEBUG-SAME: -D_DEBUG ! MSVC-DEBUG-SAME: --dependent-lib=libcmtd ! MSVC-DEBUG-SAME: --dependent-lib=FortranRuntime.static_dbg.lib -! MSVC-DEBUG-SAME: --dependent-lib=FortranDecimal.static_dbg.lib ! MSVC-DLL: -fc1 ! MSVC-DLL-SAME: --dependent-lib=clang_rt.builtins.lib @@ -24,7 +22,6 @@ ! MSVC-DLL-SAME: -D_DLL ! MSVC-DLL-SAME: --dependent-lib=msvcrt ! MSVC-DLL-SAME: --dependent-lib=FortranRuntime.dynamic.lib -! MSVC-DLL-SAME: --dependent-lib=FortranDecimal.dynamic.lib ! MSVC-DLL-DEBUG: -fc1 ! MSVC-DLL-DEBUG-SAME: --dependent-lib=clang_rt.builtins.lib @@ -33,4 +30,3 @@ ! MSVC-DLL-DEBUG-SAME: -D_DLL ! MSVC-DLL-DEBUG-SAME: --dependent-lib=msvcrtd ! MSVC-DLL-DEBUG-SAME: --dependent-lib=FortranRuntime.dynamic_dbg.lib -! MSVC-DLL-DEBUG-SAME: --dependent-lib=FortranDecimal.dynamic_dbg.lib diff --git a/flang/test/Driver/nostdlib.f90 b/flang/test/Driver/nostdlib.f90 index cd707e632a45ff..ab7c675fe7b77d 100644 --- a/flang/test/Driver/nostdlib.f90 +++ b/flang/test/Driver/nostdlib.f90 @@ -25,5 +25,4 @@ ! platform individually. ! CHECK-NOT: "-lFortranRuntime" -! CHECK-NOT: "-lFortranDecimal" ! CHECK-NOT: "-lgcc" diff --git a/flang/test/Runtime/no-cpp-dep.c b/flang/test/Runtime/no-cpp-dep.c index 606a5d189f7199..b1a5fa004014cc 100644 --- a/flang/test/Runtime/no-cpp-dep.c +++ b/flang/test/Runtime/no-cpp-dep.c @@ -6,7 +6,7 @@ a C compiler. REQUIRES: c-compiler RUN: %if system-aix %{ export OBJECT_MODE=64 %} -RUN: %cc -std=c99 %s -I%include %libruntime %libdecimal -lm \ +RUN: %cc -std=c99 %s -I%include %libruntime -lm \ RUN: %if system-aix %{-lpthread %} RUN: rm a.out */ diff --git a/flang/test/lit.cfg.py b/flang/test/lit.cfg.py index f43234fb125b7e..c452b6d231c89f 100644 --- a/flang/test/lit.cfg.py +++ b/flang/test/lit.cfg.py @@ -168,12 +168,10 @@ # we don't have one, we can just disable the test. if config.cc: libruntime = os.path.join(config.flang_lib_dir, "libFortranRuntime.a") - libdecimal = os.path.join(config.flang_lib_dir, "libFortranDecimal.a") include = os.path.join(config.flang_src_dir, "include") if ( os.path.isfile(libruntime) - and os.path.isfile(libdecimal) and os.path.isdir(include) ): config.available_features.add("c-compiler") @@ -183,7 +181,6 @@ ) ) tools.append(ToolSubst("%libruntime", command=libruntime, unresolved="fatal")) - tools.append(ToolSubst("%libdecimal", command=libdecimal, unresolved="fatal")) tools.append(ToolSubst("%include", command=include, unresolved="fatal")) # Add all the tools and their substitutions (if applicable). Use the search paths provided for diff --git a/flang/unittests/Decimal/CMakeLists.txt b/flang/unittests/Decimal/CMakeLists.txt index d301a9d3628c56..02bf1b0d7e13d3 100644 --- a/flang/unittests/Decimal/CMakeLists.txt +++ b/flang/unittests/Decimal/CMakeLists.txt @@ -1,10 +1,10 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) add_flang_nongtest_unittest(quick-sanity-test - FortranDecimal + FortranCommon ) # This test is not run by default as it takes a long time to execute. add_flang_nongtest_unittest(thorough-test SLOW_TEST - FortranDecimal + FortranCommon ) diff --git a/flang/unittests/Decimal/quick-sanity-test.cpp b/flang/unittests/Decimal/quick-sanity-test.cpp index dafb075307ab6a..c36c73b817e1f9 100644 --- a/flang/unittests/Decimal/quick-sanity-test.cpp +++ b/flang/unittests/Decimal/quick-sanity-test.cpp @@ -1,4 +1,4 @@ -#include "flang/Decimal/decimal.h" +#include "flang/Common/decimal.h" #include "llvm/Support/raw_ostream.h" #include <cinttypes> #include <cstdio> diff --git a/flang/unittests/Decimal/thorough-test.cpp b/flang/unittests/Decimal/thorough-test.cpp index 46951f33eb8fee..0f7a2d4b33e764 100644 --- a/flang/unittests/Decimal/thorough-test.cpp +++ b/flang/unittests/Decimal/thorough-test.cpp @@ -1,4 +1,4 @@ -#include "flang/Decimal/decimal.h" +#include "flang/Common/decimal.h" #include "llvm/Support/raw_ostream.h" #include <cinttypes> #include <cstdio> diff --git a/flang/unittests/Evaluate/CMakeLists.txt b/flang/unittests/Evaluate/CMakeLists.txt index 52eb385f4763fb..c008304c095575 100644 --- a/flang/unittests/Evaluate/CMakeLists.txt +++ b/flang/unittests/Evaluate/CMakeLists.txt @@ -43,7 +43,6 @@ add_flang_nongtest_unittest(intrinsics FortranCommon FortranEvaluateTesting FortranEvaluate - FortranDecimal FortranSemantics FortranParser FortranRuntime @@ -64,7 +63,6 @@ set(LLVM_REQUIRES_RTTI ON) add_flang_nongtest_unittest(real FortranEvaluateTesting FortranEvaluate - FortranDecimal FortranSemantics ) llvm_update_compile_flags(real.test) diff --git a/lld/COFF/MinGW.cpp b/lld/COFF/MinGW.cpp index 76f5a0a7500b9d..797ab37f069810 100644 --- a/lld/COFF/MinGW.cpp +++ b/lld/COFF/MinGW.cpp @@ -51,7 +51,6 @@ AutoExporter::AutoExporter( "libc++", "libc++abi", "libFortranRuntime", - "libFortranDecimal", "libunwind", "libmsvcrt", "libucrtbase", >From 090ce709977631b7bd5615572766418091c3f25a Mon Sep 17 00:00:00 2001 From: Michael Kruse <llvm-proj...@meinersbur.de> Date: Wed, 8 Jan 2025 15:17:17 +0100 Subject: [PATCH 2/3] clang-format headers --- flang/lib/Evaluate/real.cpp | 2 +- flang/runtime/edit-output.h | 2 +- flang/runtime/environment.h | 2 +- flang/runtime/format-implementation.h | 2 +- flang/runtime/format.h | 2 +- flang/unittests/Evaluate/CMakeLists.txt | 1 + 6 files changed, 6 insertions(+), 5 deletions(-) diff --git a/flang/lib/Evaluate/real.cpp b/flang/lib/Evaluate/real.cpp index af6df14f119c53..4c78a0ab658e0e 100644 --- a/flang/lib/Evaluate/real.cpp +++ b/flang/lib/Evaluate/real.cpp @@ -8,8 +8,8 @@ #include "flang/Evaluate/real.h" #include "int-power.h" -#include "flang/Common/idioms.h" #include "flang/Common/decimal.h" +#include "flang/Common/idioms.h" #include "flang/Parser/characters.h" #include "llvm/Support/raw_ostream.h" #include <limits> diff --git a/flang/runtime/edit-output.h b/flang/runtime/edit-output.h index 578c7c762f2e36..6ae49265b64df5 100644 --- a/flang/runtime/edit-output.h +++ b/flang/runtime/edit-output.h @@ -20,8 +20,8 @@ #include "format.h" #include "io-stmt.h" -#include "flang/Common/uint128.h" #include "flang/Common/decimal.h" +#include "flang/Common/uint128.h" namespace Fortran::runtime::io { diff --git a/flang/runtime/environment.h b/flang/runtime/environment.h index dfa8c14dd64081..90aa1e8dd28d77 100644 --- a/flang/runtime/environment.h +++ b/flang/runtime/environment.h @@ -9,8 +9,8 @@ #ifndef FORTRAN_RUNTIME_ENVIRONMENT_H_ #define FORTRAN_RUNTIME_ENVIRONMENT_H_ -#include "flang/Common/optional.h" #include "flang/Common/decimal.h" +#include "flang/Common/optional.h" struct EnvironmentDefaultList; diff --git a/flang/runtime/format-implementation.h b/flang/runtime/format-implementation.h index 783463ace8b27f..1dd526ce897aea 100644 --- a/flang/runtime/format-implementation.h +++ b/flang/runtime/format-implementation.h @@ -15,8 +15,8 @@ #include "format.h" #include "io-stmt.h" #include "memory.h" -#include "flang/Common/format.h" #include "flang/Common/decimal.h" +#include "flang/Common/format.h" #include "flang/Runtime/main.h" #include <algorithm> #include <cstring> diff --git a/flang/runtime/format.h b/flang/runtime/format.h index 25aa8e9961e74a..8362c7233b688f 100644 --- a/flang/runtime/format.h +++ b/flang/runtime/format.h @@ -14,8 +14,8 @@ #include "environment.h" #include "io-error.h" #include "flang/Common/Fortran-consts.h" -#include "flang/Common/optional.h" #include "flang/Common/decimal.h" +#include "flang/Common/optional.h" #include "flang/Runtime/freestanding-tools.h" #include <cinttypes> diff --git a/flang/unittests/Evaluate/CMakeLists.txt b/flang/unittests/Evaluate/CMakeLists.txt index c008304c095575..210a397e46b675 100644 --- a/flang/unittests/Evaluate/CMakeLists.txt +++ b/flang/unittests/Evaluate/CMakeLists.txt @@ -63,6 +63,7 @@ set(LLVM_REQUIRES_RTTI ON) add_flang_nongtest_unittest(real FortranEvaluateTesting FortranEvaluate + FortranCommon FortranSemantics ) llvm_update_compile_flags(real.test) >From ec8a23592452512b9091cd52416cb8fd0c4add2e Mon Sep 17 00:00:00 2001 From: Michael Kruse <llvm-proj...@meinersbur.de> Date: Thu, 9 Jan 2025 03:13:50 +0100 Subject: [PATCH 3/3] Keep identity of FortranDecimal --- .../{Common => Decimal}/binary-floating-point.h | 8 ++++---- flang/include/flang/{Common => Decimal}/decimal.h | 11 ++++++----- flang/lib/CMakeLists.txt | 1 + flang/lib/Common/CMakeLists.txt | 2 -- flang/lib/Decimal/CMakeLists.txt | 12 ++++++++++++ .../{Common => Decimal}/big-radix-floating-point.h | 12 ++++++------ flang/lib/{Common => Decimal}/binary-to-decimal.cpp | 4 ++-- flang/lib/{Common => Decimal}/decimal-to-binary.cpp | 6 +++--- flang/lib/Evaluate/CMakeLists.txt | 1 + flang/lib/Evaluate/real.cpp | 2 +- flang/runtime/CMakeLists.txt | 4 ++-- flang/runtime/edit-input.h | 2 +- flang/runtime/edit-output.h | 2 +- flang/runtime/environment.h | 2 +- flang/runtime/format-implementation.h | 2 +- flang/runtime/format.h | 2 +- flang/test/CMakeLists.txt | 1 + flang/unittests/Decimal/CMakeLists.txt | 4 ++-- flang/unittests/Decimal/quick-sanity-test.cpp | 2 +- flang/unittests/Decimal/thorough-test.cpp | 2 +- flang/unittests/Evaluate/CMakeLists.txt | 3 ++- 21 files changed, 50 insertions(+), 35 deletions(-) rename flang/include/flang/{Common => Decimal}/binary-floating-point.h (96%) rename flang/include/flang/{Common => Decimal}/decimal.h (95%) create mode 100644 flang/lib/Decimal/CMakeLists.txt rename flang/lib/{Common => Decimal}/big-radix-floating-point.h (97%) rename flang/lib/{Common => Decimal}/binary-to-decimal.cpp (99%) rename flang/lib/{Common => Decimal}/decimal-to-binary.cpp (99%) diff --git a/flang/include/flang/Common/binary-floating-point.h b/flang/include/flang/Decimal/binary-floating-point.h similarity index 96% rename from flang/include/flang/Common/binary-floating-point.h rename to flang/include/flang/Decimal/binary-floating-point.h index 705acc31bdfb21..1e0cde97d98e61 100644 --- a/flang/include/flang/Common/binary-floating-point.h +++ b/flang/include/flang/Decimal/binary-floating-point.h @@ -1,4 +1,4 @@ -//===-- include/flang/Common/binary-floating-point.h ------------*- C++ -*-===// +//===-- include/flang/Decimal/binary-floating-point.h -----------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -6,8 +6,8 @@ // //===----------------------------------------------------------------------===// -#ifndef FORTRAN_COMMON_BINARY_FLOATING_POINT_H_ -#define FORTRAN_COMMON_BINARY_FLOATING_POINT_H_ +#ifndef FORTRAN_DECIMAL_BINARY_FLOATING_POINT_H_ +#define FORTRAN_DECIMAL_BINARY_FLOATING_POINT_H_ // Access and manipulate the fields of an IEEE-754 binary // floating-point value via a generalized template. @@ -208,4 +208,4 @@ template <int BINARY_PRECISION> class BinaryFloatingPointNumber { RawType raw_{0}; }; } // namespace Fortran::decimal -#endif /* FORTRAN_COMMON_BINARY_FLOATING_POINT_H_ */ +#endif diff --git a/flang/include/flang/Common/decimal.h b/flang/include/flang/Decimal/decimal.h similarity index 95% rename from flang/include/flang/Common/decimal.h rename to flang/include/flang/Decimal/decimal.h index c086f97129f6a5..443163d058e28b 100644 --- a/flang/include/flang/Common/decimal.h +++ b/flang/include/flang/Decimal/decimal.h @@ -1,15 +1,16 @@ -/*===-- include/flang/Common/decimal.h ------------------------------*- C -*-=== +/*===-- include/flang/Decimal/decimal.h ---------------------------*- C++ -*-=== * * 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: Apache-2.0 WITH LLVM-exception * - *===----------------------------------------------------------------------===*/ + * ===-----------------------------------------------------------------------=== + */ /* C and C++ API for binary-to/from-decimal conversion package. */ -#ifndef FORTRAN_COMMON_DECIMAL_H_ -#define FORTRAN_COMMON_DECIMAL_H_ +#ifndef FORTRAN_DECIMAL_DECIMAL_H_ +#define FORTRAN_DECIMAL_DECIMAL_H_ #include "flang/Common/api-attrs.h" #include <stddef.h> @@ -136,4 +137,4 @@ RT_API_ATTRS enum NS(ConversionResultFlags) ConvertDecimalToLongDouble( #ifdef __cplusplus } // extern "C" #endif -#endif /* FORTRAN_COMMON_DECIMAL_H_ */ +#endif diff --git a/flang/lib/CMakeLists.txt b/flang/lib/CMakeLists.txt index e5a5e504ec1a4e..f41d4df1f07e3c 100644 --- a/flang/lib/CMakeLists.txt +++ b/flang/lib/CMakeLists.txt @@ -1,5 +1,6 @@ add_subdirectory(Common) add_subdirectory(Evaluate) +add_subdirectory(Decimal) add_subdirectory(Lower) add_subdirectory(Parser) add_subdirectory(Semantics) diff --git a/flang/lib/Common/CMakeLists.txt b/flang/lib/Common/CMakeLists.txt index 3e5f0b13af8881..de6bea396f3cbe 100644 --- a/flang/lib/Common/CMakeLists.txt +++ b/flang/lib/Common/CMakeLists.txt @@ -35,8 +35,6 @@ if(FLANG_VENDOR) endif() add_flang_library(FortranCommon - binary-to-decimal.cpp - decimal-to-binary.cpp Fortran.cpp Fortran-features.cpp default-kinds.cpp diff --git a/flang/lib/Decimal/CMakeLists.txt b/flang/lib/Decimal/CMakeLists.txt new file mode 100644 index 00000000000000..477d44e0565ebe --- /dev/null +++ b/flang/lib/Decimal/CMakeLists.txt @@ -0,0 +1,12 @@ +#===-- lib/Decimal/CMakeLists.txt ------------------------------------------===# +# +# 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: Apache-2.0 WITH LLVM-exception +# +#===------------------------------------------------------------------------===# + +add_flang_library(FortranDecimal + binary-to-decimal.cpp + decimal-to-binary.cpp +) diff --git a/flang/lib/Common/big-radix-floating-point.h b/flang/lib/Decimal/big-radix-floating-point.h similarity index 97% rename from flang/lib/Common/big-radix-floating-point.h rename to flang/lib/Decimal/big-radix-floating-point.h index 6d247f3796eea5..f9afebf5b3d703 100644 --- a/flang/lib/Common/big-radix-floating-point.h +++ b/flang/lib/Decimal/big-radix-floating-point.h @@ -1,4 +1,4 @@ -//===-- lib/Common/big-radix-floating-point.h -------------------*- C++ -*-===// +//===-- lib/Decimal/big-radix-floating-point.h ------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -6,8 +6,8 @@ // //===----------------------------------------------------------------------===// -#ifndef FORTRAN_COMMON_BIG_RADIX_FLOATING_POINT_H_ -#define FORTRAN_COMMON_BIG_RADIX_FLOATING_POINT_H_ +#ifndef FORTRAN_DECIMAL_BIG_RADIX_FLOATING_POINT_H_ +#define FORTRAN_DECIMAL_BIG_RADIX_FLOATING_POINT_H_ // This is a helper class for use in floating-point conversions between // binary and decimal representations. It holds a multiple-precision @@ -21,11 +21,11 @@ // for conversions between binary and decimal representations; it is not // a general-purpose facility. -#include "flang/Common/binary-floating-point.h" #include "flang/Common/bit-population-count.h" -#include "flang/Common/decimal.h" #include "flang/Common/leading-zero-bit-count.h" #include "flang/Common/uint128.h" +#include "flang/Decimal/binary-floating-point.h" +#include "flang/Decimal/decimal.h" #include <cinttypes> #include <limits> #include <type_traits> @@ -393,4 +393,4 @@ template <int PREC, int LOG10RADIX = 16> class BigRadixFloatingPointNumber { enum FortranRounding rounding_ { RoundNearest }; }; } // namespace Fortran::decimal -#endif /* FORTRAN_COMMON_BIG_RADIX_FLOATING_POINT_H_ */ +#endif diff --git a/flang/lib/Common/binary-to-decimal.cpp b/flang/lib/Decimal/binary-to-decimal.cpp similarity index 99% rename from flang/lib/Common/binary-to-decimal.cpp rename to flang/lib/Decimal/binary-to-decimal.cpp index fb2caefdae8fa1..b64865e95df24d 100644 --- a/flang/lib/Common/binary-to-decimal.cpp +++ b/flang/lib/Decimal/binary-to-decimal.cpp @@ -1,4 +1,4 @@ -//===-- lib/Common/binary-to-decimal.cpp ------------------------*- C++ -*-===// +//===-- lib/Decimal/binary-to-decimal.cpp ---------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -7,7 +7,7 @@ //===----------------------------------------------------------------------===// #include "big-radix-floating-point.h" -#include "flang/Common/decimal.h" +#include "flang/Decimal/decimal.h" #include <cassert> #include <cfloat> #include <string> diff --git a/flang/lib/Common/decimal-to-binary.cpp b/flang/lib/Decimal/decimal-to-binary.cpp similarity index 99% rename from flang/lib/Common/decimal-to-binary.cpp rename to flang/lib/Decimal/decimal-to-binary.cpp index cbf1664e9c240d..94c51774237399 100644 --- a/flang/lib/Common/decimal-to-binary.cpp +++ b/flang/lib/Decimal/decimal-to-binary.cpp @@ -1,4 +1,4 @@ -//===-- lib/Common/decimal-to-binary.cpp ------------------------*- C++ -*-===// +//===-- lib/Decimal/decimal-to-binary.cpp ---------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -7,10 +7,10 @@ //===----------------------------------------------------------------------===// #include "big-radix-floating-point.h" -#include "flang/Common/binary-floating-point.h" #include "flang/Common/bit-population-count.h" -#include "flang/Common/decimal.h" #include "flang/Common/leading-zero-bit-count.h" +#include "flang/Decimal/binary-floating-point.h" +#include "flang/Decimal/decimal.h" #include "flang/Runtime/freestanding-tools.h" #include <cinttypes> #include <cstring> diff --git a/flang/lib/Evaluate/CMakeLists.txt b/flang/lib/Evaluate/CMakeLists.txt index ebdc55cff91c43..b38f450d746ea7 100644 --- a/flang/lib/Evaluate/CMakeLists.txt +++ b/flang/lib/Evaluate/CMakeLists.txt @@ -61,6 +61,7 @@ add_flang_library(FortranEvaluate LINK_LIBS FortranCommon + FortranDecimal FortranParser ${LIBPGMATH} ${QUADMATHLIB} diff --git a/flang/lib/Evaluate/real.cpp b/flang/lib/Evaluate/real.cpp index 4c78a0ab658e0e..2c0f2833f07dc5 100644 --- a/flang/lib/Evaluate/real.cpp +++ b/flang/lib/Evaluate/real.cpp @@ -8,8 +8,8 @@ #include "flang/Evaluate/real.h" #include "int-power.h" -#include "flang/Common/decimal.h" #include "flang/Common/idioms.h" +#include "flang/Decimal/decimal.h" #include "flang/Parser/characters.h" #include "llvm/Support/raw_ostream.h" #include <limits> diff --git a/flang/runtime/CMakeLists.txt b/flang/runtime/CMakeLists.txt index 8e74467aa399eb..6343c4276f0e3e 100644 --- a/flang/runtime/CMakeLists.txt +++ b/flang/runtime/CMakeLists.txt @@ -111,8 +111,8 @@ add_definitions(-U_LIBCPP_ENABLE_ASSERTIONS) add_subdirectory(Float128Math) set(sources - ${FLANG_SOURCE_DIR}/lib/Common/binary-to-decimal.cpp - ${FLANG_SOURCE_DIR}/lib/Common/decimal-to-binary.cpp + ${FLANG_SOURCE_DIR}/lib/Decimal/binary-to-decimal.cpp + ${FLANG_SOURCE_DIR}/lib/Decimal/decimal-to-binary.cpp ISO_Fortran_binding.cpp allocator-registry.cpp allocatable.cpp diff --git a/flang/runtime/edit-input.h b/flang/runtime/edit-input.h index 50d1db6e024053..55a7a455781719 100644 --- a/flang/runtime/edit-input.h +++ b/flang/runtime/edit-input.h @@ -11,7 +11,7 @@ #include "format.h" #include "io-stmt.h" -#include "flang/Common/decimal.h" +#include "flang/Decimal/decimal.h" namespace Fortran::runtime::io { diff --git a/flang/runtime/edit-output.h b/flang/runtime/edit-output.h index 6ae49265b64df5..42cc993f98cc1c 100644 --- a/flang/runtime/edit-output.h +++ b/flang/runtime/edit-output.h @@ -20,8 +20,8 @@ #include "format.h" #include "io-stmt.h" -#include "flang/Common/decimal.h" #include "flang/Common/uint128.h" +#include "flang/Decimal/decimal.h" namespace Fortran::runtime::io { diff --git a/flang/runtime/environment.h b/flang/runtime/environment.h index 90aa1e8dd28d77..b8b9f10e4e57f5 100644 --- a/flang/runtime/environment.h +++ b/flang/runtime/environment.h @@ -9,8 +9,8 @@ #ifndef FORTRAN_RUNTIME_ENVIRONMENT_H_ #define FORTRAN_RUNTIME_ENVIRONMENT_H_ -#include "flang/Common/decimal.h" #include "flang/Common/optional.h" +#include "flang/Decimal/decimal.h" struct EnvironmentDefaultList; diff --git a/flang/runtime/format-implementation.h b/flang/runtime/format-implementation.h index 1dd526ce897aea..46204ca927c135 100644 --- a/flang/runtime/format-implementation.h +++ b/flang/runtime/format-implementation.h @@ -15,8 +15,8 @@ #include "format.h" #include "io-stmt.h" #include "memory.h" -#include "flang/Common/decimal.h" #include "flang/Common/format.h" +#include "flang/Decimal/decimal.h" #include "flang/Runtime/main.h" #include <algorithm> #include <cstring> diff --git a/flang/runtime/format.h b/flang/runtime/format.h index 8362c7233b688f..815bf70685e647 100644 --- a/flang/runtime/format.h +++ b/flang/runtime/format.h @@ -14,8 +14,8 @@ #include "environment.h" #include "io-error.h" #include "flang/Common/Fortran-consts.h" -#include "flang/Common/decimal.h" #include "flang/Common/optional.h" +#include "flang/Decimal/decimal.h" #include "flang/Runtime/freestanding-tools.h" #include <cinttypes> diff --git a/flang/test/CMakeLists.txt b/flang/test/CMakeLists.txt index e38c9b50259376..cab214c2ef4c8c 100644 --- a/flang/test/CMakeLists.txt +++ b/flang/test/CMakeLists.txt @@ -72,6 +72,7 @@ set(FLANG_TEST_DEPENDS llvm-readobj split-file FortranRuntime + FortranDecimal ) if (LLVM_ENABLE_PLUGINS AND NOT WIN32) list(APPEND FLANG_TEST_DEPENDS Bye) diff --git a/flang/unittests/Decimal/CMakeLists.txt b/flang/unittests/Decimal/CMakeLists.txt index 02bf1b0d7e13d3..d301a9d3628c56 100644 --- a/flang/unittests/Decimal/CMakeLists.txt +++ b/flang/unittests/Decimal/CMakeLists.txt @@ -1,10 +1,10 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) add_flang_nongtest_unittest(quick-sanity-test - FortranCommon + FortranDecimal ) # This test is not run by default as it takes a long time to execute. add_flang_nongtest_unittest(thorough-test SLOW_TEST - FortranCommon + FortranDecimal ) diff --git a/flang/unittests/Decimal/quick-sanity-test.cpp b/flang/unittests/Decimal/quick-sanity-test.cpp index c36c73b817e1f9..dafb075307ab6a 100644 --- a/flang/unittests/Decimal/quick-sanity-test.cpp +++ b/flang/unittests/Decimal/quick-sanity-test.cpp @@ -1,4 +1,4 @@ -#include "flang/Common/decimal.h" +#include "flang/Decimal/decimal.h" #include "llvm/Support/raw_ostream.h" #include <cinttypes> #include <cstdio> diff --git a/flang/unittests/Decimal/thorough-test.cpp b/flang/unittests/Decimal/thorough-test.cpp index 0f7a2d4b33e764..46951f33eb8fee 100644 --- a/flang/unittests/Decimal/thorough-test.cpp +++ b/flang/unittests/Decimal/thorough-test.cpp @@ -1,4 +1,4 @@ -#include "flang/Common/decimal.h" +#include "flang/Decimal/decimal.h" #include "llvm/Support/raw_ostream.h" #include <cinttypes> #include <cstdio> diff --git a/flang/unittests/Evaluate/CMakeLists.txt b/flang/unittests/Evaluate/CMakeLists.txt index 210a397e46b675..52eb385f4763fb 100644 --- a/flang/unittests/Evaluate/CMakeLists.txt +++ b/flang/unittests/Evaluate/CMakeLists.txt @@ -43,6 +43,7 @@ add_flang_nongtest_unittest(intrinsics FortranCommon FortranEvaluateTesting FortranEvaluate + FortranDecimal FortranSemantics FortranParser FortranRuntime @@ -63,7 +64,7 @@ set(LLVM_REQUIRES_RTTI ON) add_flang_nongtest_unittest(real FortranEvaluateTesting FortranEvaluate - FortranCommon + FortranDecimal FortranSemantics ) llvm_update_compile_flags(real.test) _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits