Skip to content

Commit a08aa48

Browse files
committed
Join FortranDecimal into FortranCommon
1 parent 8f17c90 commit a08aa48

30 files changed

+40
-157
lines changed

clang/lib/Driver/ToolChains/CommonArgs.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1317,7 +1317,7 @@ void tools::addOpenMPHostOffloadingArgs(const Compilation &C,
13171317
/// Add Fortran runtime libs
13181318
void tools::addFortranRuntimeLibs(const ToolChain &TC, const ArgList &Args,
13191319
llvm::opt::ArgStringList &CmdArgs) {
1320-
// Link FortranRuntime and FortranDecimal
1320+
// Link FortranRuntime
13211321
// These are handled earlier on Windows by telling the frontend driver to
13221322
// add the correct libraries to link against as dependents in the object
13231323
// file.
@@ -1334,7 +1334,6 @@ void tools::addFortranRuntimeLibs(const ToolChain &TC, const ArgList &Args,
13341334
addAsNeededOption(TC, Args, CmdArgs, /*as_needed=*/false);
13351335
}
13361336
CmdArgs.push_back("-lFortranRuntime");
1337-
CmdArgs.push_back("-lFortranDecimal");
13381337
addArchSpecificRPath(TC, Args, CmdArgs);
13391338
}
13401339

clang/lib/Driver/ToolChains/Flang.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -357,29 +357,25 @@ static void processVSRuntimeLibrary(const ToolChain &TC, const ArgList &Args,
357357
CmdArgs.push_back("-D_MT");
358358
CmdArgs.push_back("--dependent-lib=libcmt");
359359
CmdArgs.push_back("--dependent-lib=FortranRuntime.static.lib");
360-
CmdArgs.push_back("--dependent-lib=FortranDecimal.static.lib");
361360
break;
362361
case options::OPT__SLASH_MTd:
363362
CmdArgs.push_back("-D_MT");
364363
CmdArgs.push_back("-D_DEBUG");
365364
CmdArgs.push_back("--dependent-lib=libcmtd");
366365
CmdArgs.push_back("--dependent-lib=FortranRuntime.static_dbg.lib");
367-
CmdArgs.push_back("--dependent-lib=FortranDecimal.static_dbg.lib");
368366
break;
369367
case options::OPT__SLASH_MD:
370368
CmdArgs.push_back("-D_MT");
371369
CmdArgs.push_back("-D_DLL");
372370
CmdArgs.push_back("--dependent-lib=msvcrt");
373371
CmdArgs.push_back("--dependent-lib=FortranRuntime.dynamic.lib");
374-
CmdArgs.push_back("--dependent-lib=FortranDecimal.dynamic.lib");
375372
break;
376373
case options::OPT__SLASH_MDd:
377374
CmdArgs.push_back("-D_MT");
378375
CmdArgs.push_back("-D_DEBUG");
379376
CmdArgs.push_back("-D_DLL");
380377
CmdArgs.push_back("--dependent-lib=msvcrtd");
381378
CmdArgs.push_back("--dependent-lib=FortranRuntime.dynamic_dbg.lib");
382-
CmdArgs.push_back("--dependent-lib=FortranDecimal.dynamic_dbg.lib");
383379
break;
384380
}
385381
}

flang/docs/FlangDriver.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -175,19 +175,18 @@ like this:
175175

176176
```
177177
$ flang -v -o example example.o
178-
"/usr/bin/ld" [...] example.o [...] "-lFortranRuntime" "-lFortranDecimal" [...]
178+
"/usr/bin/ld" [...] example.o [...] "-lFortranRuntime" [...]
179179
```
180180

181181
The automatically added libraries are:
182182

183183
* `FortranRuntime`: Provides most of the Flang runtime library.
184-
* `FortranDecimal`: Provides operations for decimal numbers.
185184

186185
If the code is C/C++ based and invokes Fortran routines, one can either use Clang
187186
or Flang as the linker driver. If Clang is used, it will automatically all
188187
required runtime libraries needed by C++ (e.g., for STL) to the linker invocation.
189188
In this case, one has to explicitly provide the Fortran runtime libraries
190-
`FortranRuntime` and/or `FortranDecimal`. An alternative is to use Flang to link.
189+
`FortranRuntime`. An alternative is to use Flang to link.
191190
In this case, it may be required to explicitly supply C++ runtime libraries.
192191

193192
On Darwin, the logical root where the system libraries are located (sysroot)

flang/include/flang/Decimal/binary-floating-point.h renamed to flang/include/flang/Common/binary-floating-point.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
//===-- include/flang/Decimal/binary-floating-point.h -----------*- C++ -*-===//
1+
//===-- include/flang/Common/binary-floating-point.h ------------*- C++ -*-===//
22
//
33
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
44
// See https://llvm.org/LICENSE.txt for license information.
55
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
66
//
77
//===----------------------------------------------------------------------===//
88

9-
#ifndef FORTRAN_DECIMAL_BINARY_FLOATING_POINT_H_
10-
#define FORTRAN_DECIMAL_BINARY_FLOATING_POINT_H_
9+
#ifndef FORTRAN_COMMON_BINARY_FLOATING_POINT_H_
10+
#define FORTRAN_COMMON_BINARY_FLOATING_POINT_H_
1111

1212
// Access and manipulate the fields of an IEEE-754 binary
1313
// floating-point value via a generalized template.
@@ -208,4 +208,4 @@ template <int BINARY_PRECISION> class BinaryFloatingPointNumber {
208208
RawType raw_{0};
209209
};
210210
} // namespace Fortran::decimal
211-
#endif
211+
#endif /* FORTRAN_COMMON_BINARY_FLOATING_POINT_H_ */

flang/include/flang/Decimal/decimal.h renamed to flang/include/flang/Common/decimal.h

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
1-
/*===-- include/flang/Decimal/decimal.h ---------------------------*- C++ -*-===
1+
/*===-- include/flang/Common/decimal.h ------------------------------*- C -*-===
22
*
33
* Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
44
* See https://llvm.org/LICENSE.txt for license information.
55
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
66
*
7-
* ===-----------------------------------------------------------------------===
8-
*/
7+
*===----------------------------------------------------------------------===*/
98

109
/* C and C++ API for binary-to/from-decimal conversion package. */
1110

12-
#ifndef FORTRAN_DECIMAL_DECIMAL_H_
13-
#define FORTRAN_DECIMAL_DECIMAL_H_
11+
#ifndef FORTRAN_COMMON_DECIMAL_H_
12+
#define FORTRAN_COMMON_DECIMAL_H_
1413

1514
#include "flang/Common/api-attrs.h"
1615
#include <stddef.h>
@@ -137,4 +136,4 @@ RT_API_ATTRS enum NS(ConversionResultFlags) ConvertDecimalToLongDouble(
137136
#ifdef __cplusplus
138137
} // extern "C"
139138
#endif
140-
#endif
139+
#endif /* FORTRAN_COMMON_DECIMAL_H_ */

flang/lib/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
add_subdirectory(Common)
22
add_subdirectory(Evaluate)
3-
add_subdirectory(Decimal)
43
add_subdirectory(Lower)
54
add_subdirectory(Parser)
65
add_subdirectory(Semantics)

flang/lib/Common/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ if(FLANG_VENDOR)
3535
endif()
3636

3737
add_flang_library(FortranCommon
38+
binary-to-decimal.cpp
39+
decimal-to-binary.cpp
3840
Fortran.cpp
3941
Fortran-features.cpp
4042
default-kinds.cpp

flang/lib/Decimal/big-radix-floating-point.h renamed to flang/lib/Common/big-radix-floating-point.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
//===-- lib/Decimal/big-radix-floating-point.h ------------------*- C++ -*-===//
1+
//===-- lib/Common/big-radix-floating-point.h -------------------*- C++ -*-===//
22
//
33
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
44
// See https://llvm.org/LICENSE.txt for license information.
55
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
66
//
77
//===----------------------------------------------------------------------===//
88

9-
#ifndef FORTRAN_DECIMAL_BIG_RADIX_FLOATING_POINT_H_
10-
#define FORTRAN_DECIMAL_BIG_RADIX_FLOATING_POINT_H_
9+
#ifndef FORTRAN_COMMON_BIG_RADIX_FLOATING_POINT_H_
10+
#define FORTRAN_COMMON_BIG_RADIX_FLOATING_POINT_H_
1111

1212
// This is a helper class for use in floating-point conversions between
1313
// binary and decimal representations. It holds a multiple-precision
@@ -21,11 +21,11 @@
2121
// for conversions between binary and decimal representations; it is not
2222
// a general-purpose facility.
2323

24+
#include "flang/Common/binary-floating-point.h"
2425
#include "flang/Common/bit-population-count.h"
26+
#include "flang/Common/decimal.h"
2527
#include "flang/Common/leading-zero-bit-count.h"
2628
#include "flang/Common/uint128.h"
27-
#include "flang/Decimal/binary-floating-point.h"
28-
#include "flang/Decimal/decimal.h"
2929
#include <cinttypes>
3030
#include <limits>
3131
#include <type_traits>
@@ -393,4 +393,4 @@ template <int PREC, int LOG10RADIX = 16> class BigRadixFloatingPointNumber {
393393
enum FortranRounding rounding_ { RoundNearest };
394394
};
395395
} // namespace Fortran::decimal
396-
#endif
396+
#endif /* FORTRAN_COMMON_BIG_RADIX_FLOATING_POINT_H_ */

flang/lib/Decimal/binary-to-decimal.cpp renamed to flang/lib/Common/binary-to-decimal.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//===-- lib/Decimal/binary-to-decimal.cpp ---------------------------------===//
1+
//===-- lib/Common/binary-to-decimal.cpp ------------------------*- C++ -*-===//
22
//
33
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
44
// See https://llvm.org/LICENSE.txt for license information.
@@ -7,7 +7,7 @@
77
//===----------------------------------------------------------------------===//
88

99
#include "big-radix-floating-point.h"
10-
#include "flang/Decimal/decimal.h"
10+
#include "flang/Common/decimal.h"
1111
#include <cassert>
1212
#include <cfloat>
1313
#include <string>

flang/lib/Decimal/decimal-to-binary.cpp renamed to flang/lib/Common/decimal-to-binary.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//===-- lib/Decimal/decimal-to-binary.cpp ---------------------------------===//
1+
//===-- lib/Common/decimal-to-binary.cpp ------------------------*- C++ -*-===//
22
//
33
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
44
// See https://llvm.org/LICENSE.txt for license information.
@@ -7,10 +7,10 @@
77
//===----------------------------------------------------------------------===//
88

99
#include "big-radix-floating-point.h"
10+
#include "flang/Common/binary-floating-point.h"
1011
#include "flang/Common/bit-population-count.h"
12+
#include "flang/Common/decimal.h"
1113
#include "flang/Common/leading-zero-bit-count.h"
12-
#include "flang/Decimal/binary-floating-point.h"
13-
#include "flang/Decimal/decimal.h"
1414
#include "flang/Runtime/freestanding-tools.h"
1515
#include <cinttypes>
1616
#include <cstring>

flang/lib/Decimal/CMakeLists.txt

Lines changed: 0 additions & 86 deletions
This file was deleted.

flang/lib/Evaluate/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ add_flang_library(FortranEvaluate
6161

6262
LINK_LIBS
6363
FortranCommon
64-
FortranDecimal
6564
FortranParser
6665
${LIBPGMATH}
6766
${QUADMATHLIB}

flang/lib/Evaluate/real.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#include "flang/Evaluate/real.h"
1010
#include "int-power.h"
1111
#include "flang/Common/idioms.h"
12-
#include "flang/Decimal/decimal.h"
12+
#include "flang/Common/decimal.h"
1313
#include "flang/Parser/characters.h"
1414
#include "llvm/Support/raw_ostream.h"
1515
#include <limits>

flang/runtime/CMakeLists.txt

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,8 @@ add_definitions(-U_LIBCPP_ENABLE_ASSERTIONS)
111111
add_subdirectory(Float128Math)
112112

113113
set(sources
114+
${FLANG_SOURCE_DIR}/lib/Common/binary-to-decimal.cpp
115+
${FLANG_SOURCE_DIR}/lib/Common/decimal-to-binary.cpp
114116
ISO_Fortran_binding.cpp
115117
allocator-registry.cpp
116118
allocatable.cpp
@@ -270,39 +272,27 @@ endif()
270272
if (NOT DEFINED MSVC)
271273
add_flang_library(FortranRuntime
272274
${sources}
273-
LINK_LIBS
274-
FortranDecimal
275275

276276
INSTALL_WITH_TOOLCHAIN
277277
)
278278
else()
279279
add_flang_library(FortranRuntime
280280
${sources}
281-
LINK_LIBS
282-
FortranDecimal
283281
)
284282
set(CMAKE_MSVC_RUNTIME_LIBRARY MultiThreaded)
285283
add_flang_library(FortranRuntime.static ${sources}
286-
LINK_LIBS
287-
FortranDecimal.static
288284
INSTALL_WITH_TOOLCHAIN)
289285
set_target_properties(FortranRuntime.static PROPERTIES FOLDER "Flang/Runtime Libraries")
290286
set(CMAKE_MSVC_RUNTIME_LIBRARY MultiThreadedDLL)
291287
add_flang_library(FortranRuntime.dynamic ${sources}
292-
LINK_LIBS
293-
FortranDecimal.dynamic
294288
INSTALL_WITH_TOOLCHAIN)
295289
set_target_properties(FortranRuntime.dynamic PROPERTIES FOLDER "Flang/Runtime Libraries")
296290
set(CMAKE_MSVC_RUNTIME_LIBRARY MultiThreadedDebug)
297291
add_flang_library(FortranRuntime.static_dbg ${sources}
298-
LINK_LIBS
299-
FortranDecimal.static_dbg
300292
INSTALL_WITH_TOOLCHAIN)
301293
set_target_properties(FortranRuntime.static_dbg PROPERTIES FOLDER "Flang/Runtime Libraries")
302294
set(CMAKE_MSVC_RUNTIME_LIBRARY MultiThreadedDebugDLL)
303295
add_flang_library(FortranRuntime.dynamic_dbg ${sources}
304-
LINK_LIBS
305-
FortranDecimal.dynamic_dbg
306296
INSTALL_WITH_TOOLCHAIN)
307297
set_target_properties(FortranRuntime.dynamic_dbg PROPERTIES FOLDER "Flang/Runtime Libraries")
308298
add_dependencies(FortranRuntime FortranRuntime.static FortranRuntime.dynamic

flang/runtime/edit-input.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
#include "format.h"
1313
#include "io-stmt.h"
14-
#include "flang/Decimal/decimal.h"
14+
#include "flang/Common/decimal.h"
1515

1616
namespace Fortran::runtime::io {
1717

flang/runtime/edit-output.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
#include "format.h"
2222
#include "io-stmt.h"
2323
#include "flang/Common/uint128.h"
24-
#include "flang/Decimal/decimal.h"
24+
#include "flang/Common/decimal.h"
2525

2626
namespace Fortran::runtime::io {
2727

flang/runtime/environment.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#define FORTRAN_RUNTIME_ENVIRONMENT_H_
1111

1212
#include "flang/Common/optional.h"
13-
#include "flang/Decimal/decimal.h"
13+
#include "flang/Common/decimal.h"
1414

1515
struct EnvironmentDefaultList;
1616

flang/runtime/format-implementation.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
#include "io-stmt.h"
1717
#include "memory.h"
1818
#include "flang/Common/format.h"
19-
#include "flang/Decimal/decimal.h"
19+
#include "flang/Common/decimal.h"
2020
#include "flang/Runtime/main.h"
2121
#include <algorithm>
2222
#include <cstring>

0 commit comments

Comments
 (0)