Skip to content

Commit ec8a235

Browse files
committed
Keep identity of FortranDecimal
1 parent 090ce70 commit ec8a235

21 files changed

+50
-35
lines changed

flang/include/flang/Common/binary-floating-point.h renamed to flang/include/flang/Decimal/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/Common/binary-floating-point.h ------------*- C++ -*-===//
1+
//===-- include/flang/Decimal/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_COMMON_BINARY_FLOATING_POINT_H_
10-
#define FORTRAN_COMMON_BINARY_FLOATING_POINT_H_
9+
#ifndef FORTRAN_DECIMAL_BINARY_FLOATING_POINT_H_
10+
#define FORTRAN_DECIMAL_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 /* FORTRAN_COMMON_BINARY_FLOATING_POINT_H_ */
211+
#endif

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

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
1-
/*===-- include/flang/Common/decimal.h ------------------------------*- C -*-===
1+
/*===-- include/flang/Decimal/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-
*===----------------------------------------------------------------------===*/
7+
* ===-----------------------------------------------------------------------===
8+
*/
89

910
/* C and C++ API for binary-to/from-decimal conversion package. */
1011

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

1415
#include "flang/Common/api-attrs.h"
1516
#include <stddef.h>
@@ -136,4 +137,4 @@ RT_API_ATTRS enum NS(ConversionResultFlags) ConvertDecimalToLongDouble(
136137
#ifdef __cplusplus
137138
} // extern "C"
138139
#endif
139-
#endif /* FORTRAN_COMMON_DECIMAL_H_ */
140+
#endif

flang/lib/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
add_subdirectory(Common)
22
add_subdirectory(Evaluate)
3+
add_subdirectory(Decimal)
34
add_subdirectory(Lower)
45
add_subdirectory(Parser)
56
add_subdirectory(Semantics)

flang/lib/Common/CMakeLists.txt

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

3737
add_flang_library(FortranCommon
38-
binary-to-decimal.cpp
39-
decimal-to-binary.cpp
4038
Fortran.cpp
4139
Fortran-features.cpp
4240
default-kinds.cpp

flang/lib/Decimal/CMakeLists.txt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#===-- lib/Decimal/CMakeLists.txt ------------------------------------------===#
2+
#
3+
# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
# See https://llvm.org/LICENSE.txt for license information.
5+
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
#
7+
#===------------------------------------------------------------------------===#
8+
9+
add_flang_library(FortranDecimal
10+
binary-to-decimal.cpp
11+
decimal-to-binary.cpp
12+
)

flang/lib/Common/big-radix-floating-point.h renamed to flang/lib/Decimal/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/Common/big-radix-floating-point.h -------------------*- C++ -*-===//
1+
//===-- lib/Decimal/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_COMMON_BIG_RADIX_FLOATING_POINT_H_
10-
#define FORTRAN_COMMON_BIG_RADIX_FLOATING_POINT_H_
9+
#ifndef FORTRAN_DECIMAL_BIG_RADIX_FLOATING_POINT_H_
10+
#define FORTRAN_DECIMAL_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"
2524
#include "flang/Common/bit-population-count.h"
26-
#include "flang/Common/decimal.h"
2725
#include "flang/Common/leading-zero-bit-count.h"
2826
#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 /* FORTRAN_COMMON_BIG_RADIX_FLOATING_POINT_H_ */
396+
#endif

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//===-- lib/Common/binary-to-decimal.cpp ------------------------*- C++ -*-===//
1+
//===-- lib/Decimal/binary-to-decimal.cpp ---------------------------------===//
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/Common/decimal.h"
10+
#include "flang/Decimal/decimal.h"
1111
#include <cassert>
1212
#include <cfloat>
1313
#include <string>

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//===-- lib/Common/decimal-to-binary.cpp ------------------------*- C++ -*-===//
1+
//===-- lib/Decimal/decimal-to-binary.cpp ---------------------------------===//
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"
1110
#include "flang/Common/bit-population-count.h"
12-
#include "flang/Common/decimal.h"
1311
#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/Evaluate/CMakeLists.txt

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

6262
LINK_LIBS
6363
FortranCommon
64+
FortranDecimal
6465
FortranParser
6566
${LIBPGMATH}
6667
${QUADMATHLIB}

flang/lib/Evaluate/real.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88

99
#include "flang/Evaluate/real.h"
1010
#include "int-power.h"
11-
#include "flang/Common/decimal.h"
1211
#include "flang/Common/idioms.h"
12+
#include "flang/Decimal/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 & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +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
114+
${FLANG_SOURCE_DIR}/lib/Decimal/binary-to-decimal.cpp
115+
${FLANG_SOURCE_DIR}/lib/Decimal/decimal-to-binary.cpp
116116
ISO_Fortran_binding.cpp
117117
allocator-registry.cpp
118118
allocatable.cpp

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/Common/decimal.h"
14+
#include "flang/Decimal/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
@@ -20,8 +20,8 @@
2020

2121
#include "format.h"
2222
#include "io-stmt.h"
23-
#include "flang/Common/decimal.h"
2423
#include "flang/Common/uint128.h"
24+
#include "flang/Decimal/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
@@ -9,8 +9,8 @@
99
#ifndef FORTRAN_RUNTIME_ENVIRONMENT_H_
1010
#define FORTRAN_RUNTIME_ENVIRONMENT_H_
1111

12-
#include "flang/Common/decimal.h"
1312
#include "flang/Common/optional.h"
13+
#include "flang/Decimal/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
@@ -15,8 +15,8 @@
1515
#include "format.h"
1616
#include "io-stmt.h"
1717
#include "memory.h"
18-
#include "flang/Common/decimal.h"
1918
#include "flang/Common/format.h"
19+
#include "flang/Decimal/decimal.h"
2020
#include "flang/Runtime/main.h"
2121
#include <algorithm>
2222
#include <cstring>

flang/runtime/format.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
#include "environment.h"
1515
#include "io-error.h"
1616
#include "flang/Common/Fortran-consts.h"
17-
#include "flang/Common/decimal.h"
1817
#include "flang/Common/optional.h"
18+
#include "flang/Decimal/decimal.h"
1919
#include "flang/Runtime/freestanding-tools.h"
2020
#include <cinttypes>
2121

flang/test/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ set(FLANG_TEST_DEPENDS
7272
llvm-readobj
7373
split-file
7474
FortranRuntime
75+
FortranDecimal
7576
)
7677
if (LLVM_ENABLE_PLUGINS AND NOT WIN32)
7778
list(APPEND FLANG_TEST_DEPENDS Bye)
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
22
add_flang_nongtest_unittest(quick-sanity-test
3-
FortranCommon
3+
FortranDecimal
44
)
55

66
# This test is not run by default as it takes a long time to execute.
77
add_flang_nongtest_unittest(thorough-test
88
SLOW_TEST
9-
FortranCommon
9+
FortranDecimal
1010
)

flang/unittests/Decimal/quick-sanity-test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#include "flang/Common/decimal.h"
1+
#include "flang/Decimal/decimal.h"
22
#include "llvm/Support/raw_ostream.h"
33
#include <cinttypes>
44
#include <cstdio>

flang/unittests/Decimal/thorough-test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#include "flang/Common/decimal.h"
1+
#include "flang/Decimal/decimal.h"
22
#include "llvm/Support/raw_ostream.h"
33
#include <cinttypes>
44
#include <cstdio>

flang/unittests/Evaluate/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ add_flang_nongtest_unittest(intrinsics
4343
FortranCommon
4444
FortranEvaluateTesting
4545
FortranEvaluate
46+
FortranDecimal
4647
FortranSemantics
4748
FortranParser
4849
FortranRuntime
@@ -63,7 +64,7 @@ set(LLVM_REQUIRES_RTTI ON)
6364
add_flang_nongtest_unittest(real
6465
FortranEvaluateTesting
6566
FortranEvaluate
66-
FortranCommon
67+
FortranDecimal
6768
FortranSemantics
6869
)
6970
llvm_update_compile_flags(real.test)

0 commit comments

Comments
 (0)