Skip to content

Commit d924c5d

Browse files
authored
[libc][NFC] Sink "PlatformDefs.h" into "FloatProperties.h" (llvm#73226)
`PlatformDefs.h` does not bring a lot of value as a separate file. It is transitively included in `FloatProperties.h` and `FPBits.h`. This patch sinks it into `FloatProperties.h` and removes the associated build targets.
1 parent dbb8643 commit d924c5d

File tree

17 files changed

+13
-66
lines changed

17 files changed

+13
-66
lines changed

libc/src/__support/FPUtil/CMakeLists.txt

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,20 +23,11 @@ add_header_library(
2323
libc.src.errno.errno
2424
)
2525

26-
add_header_library(
27-
platform_defs
28-
HDRS
29-
PlatformDefs.h
30-
DEPENDS
31-
libc.src.__support.common
32-
)
33-
3426
add_header_library(
3527
float_properties
3628
HDRS
3729
FloatProperties.h
3830
DEPENDS
39-
.platform_defs
4031
libc.src.__support.uint128
4132
)
4233

@@ -46,7 +37,6 @@ add_header_library(
4637
FPBits.h
4738
DEPENDS
4839
.float_properties
49-
.platform_defs
5040
libc.src.__support.common
5141
libc.src.__support.CPP.bit
5242
libc.src.__support.CPP.type_traits
@@ -100,7 +90,6 @@ add_header_library(
10090
.fp_bits
10191
.nearest_integer_operations
10292
.normal_float
103-
.platform_defs
10493
libc.src.__support.CPP.bit
10594
libc.src.__support.CPP.type_traits
10695
libc.src.__support.common

libc/src/__support/FPUtil/FPBits.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@
99
#ifndef LLVM_LIBC_SRC___SUPPORT_FPUTIL_FPBITS_H
1010
#define LLVM_LIBC_SRC___SUPPORT_FPUTIL_FPBITS_H
1111

12-
#include "PlatformDefs.h"
13-
1412
#include "src/__support/CPP/bit.h"
1513
#include "src/__support/CPP/type_traits.h"
1614
#include "src/__support/bit.h"

libc/src/__support/FPUtil/FloatProperties.h

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,23 @@
99
#ifndef LLVM_LIBC_SRC___SUPPORT_FPUTIL_FLOATPROPERTIES_H
1010
#define LLVM_LIBC_SRC___SUPPORT_FPUTIL_FLOATPROPERTIES_H
1111

12-
#include "PlatformDefs.h"
13-
1412
#include "src/__support/UInt128.h"
13+
#include "src/__support/macros/properties/architectures.h" // LIBC_TARGET_ARCH_XXX
1514

1615
#include <stdint.h>
1716

17+
// https://developer.arm.com/documentation/dui0491/i/C-and-C---Implementation-Details/Basic-data-types
18+
// https://developer.apple.com/documentation/xcode/writing-arm64-code-for-apple-platforms
19+
// https://docs.amd.com/bundle/HIP-Programming-Guide-v5.1/page/Programming_with_HIP.html
20+
#if defined(_WIN32) || defined(__arm__) || defined(__NVPTX__) || \
21+
defined(__AMDGPU__) || (defined(__APPLE__) && defined(__aarch64__))
22+
#define LONG_DOUBLE_IS_DOUBLE
23+
#endif
24+
25+
#if !defined(LONG_DOUBLE_IS_DOUBLE) && defined(LIBC_TARGET_ARCH_IS_X86)
26+
#define SPECIAL_X86_LONG_DOUBLE
27+
#endif
28+
1829
namespace LIBC_NAMESPACE {
1930
namespace fputil {
2031

libc/src/__support/FPUtil/ManipulationFunctions.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
#include "FloatProperties.h"
1414
#include "NearestIntegerOperations.h"
1515
#include "NormalFloat.h"
16-
#include "PlatformDefs.h"
1716

1817
#include "src/__support/CPP/bit.h"
1918
#include "src/__support/CPP/type_traits.h"

libc/src/__support/FPUtil/PlatformDefs.h

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

libc/src/__support/FPUtil/generic/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ add_header_library(
1010
libc.src.__support.CPP.type_traits
1111
libc.src.__support.FPUtil.fenv_impl
1212
libc.src.__support.FPUtil.fp_bits
13-
libc.src.__support.FPUtil.platform_defs
1413
libc.src.__support.FPUtil.rounding_mode
1514
libc.src.__support.bit
1615
libc.src.__support.uint128

libc/src/__support/FPUtil/generic/sqrt.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
#include "src/__support/CPP/type_traits.h"
1515
#include "src/__support/FPUtil/FEnvImpl.h"
1616
#include "src/__support/FPUtil/FPBits.h"
17-
#include "src/__support/FPUtil/PlatformDefs.h"
1817
#include "src/__support/FPUtil/rounding_mode.h"
1918
#include "src/__support/UInt128.h"
2019
#include "src/__support/bit.h"

libc/src/__support/FPUtil/generic/sqrt_80_bit_long_double.h

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

1212
#include "src/__support/FPUtil/FEnvImpl.h"
1313
#include "src/__support/FPUtil/FPBits.h"
14-
#include "src/__support/FPUtil/PlatformDefs.h"
1514
#include "src/__support/FPUtil/rounding_mode.h"
1615
#include "src/__support/UInt128.h"
1716
#include "src/__support/bit.h"

libc/test/src/stdio/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,6 @@ add_fp_unittest(
132132
DEPENDS
133133
libc.src.stdio.sprintf
134134
libc.src.__support.FPUtil.fp_bits
135-
libc.src.__support.FPUtil.platform_defs
136135
COMPILE_OPTIONS
137136
${sprintf_test_copts}
138137
)

libc/test/src/stdio/sprintf_test.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
#include "src/stdio/sprintf.h"
1010

1111
#include "src/__support/FPUtil/FPBits.h"
12-
#include "src/__support/FPUtil/PlatformDefs.h"
1312
#include "test/UnitTest/RoundingModeUtils.h"
1413
#include "test/UnitTest/Test.h"
1514

libc/test/src/stdio/sscanf_test.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88

99
#include "src/__support/CPP/limits.h"
1010
#include "src/__support/FPUtil/FPBits.h"
11-
#include "src/__support/FPUtil/PlatformDefs.h"
1211

1312
#include "src/stdio/sscanf.h"
1413

libc/utils/MPFRWrapper/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ if(LIBC_TESTS_CAN_USE_MPFR)
1414
libc.src.__support.FPUtil.fp_bits
1515
libc.src.__support.FPUtil.float_properties
1616
libc.src.__support.FPUtil.fpbits_str
17-
libc.src.__support.FPUtil.platform_defs
1817
LibcTest.unit
1918
)
2019
if(EXISTS ${LLVM_LIBC_MPFR_INSTALL_PATH})

libc/utils/MPFRWrapper/MPFRUtils.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
#include "src/__support/CPP/string_view.h"
1313
#include "src/__support/FPUtil/FPBits.h"
1414
#include "src/__support/FPUtil/FloatProperties.h"
15-
#include "src/__support/FPUtil/PlatformDefs.h"
1615
#include "src/__support/FPUtil/fpbits_str.h"
1716
#include "test/UnitTest/FPMatcher.h"
1817

utils/bazel/llvm-project-overlay/libc/BUILD.bazel

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -657,7 +657,6 @@ libc_support_library(
657657
name = "__support_fputil_float_properties",
658658
hdrs = ["src/__support/FPUtil/FloatProperties.h"],
659659
deps = [
660-
":__support_fputil_platform_defs",
661660
":__support_uint128",
662661
],
663662
)
@@ -672,7 +671,6 @@ libc_support_library(
672671
":__support_cpp_bit",
673672
":__support_cpp_type_traits",
674673
":__support_fputil_float_properties",
675-
":__support_fputil_platform_defs",
676674
":__support_uint128",
677675
],
678676
)
@@ -686,7 +684,6 @@ libc_support_library(
686684
":__support_cpp_type_traits",
687685
":__support_fputil_float_properties",
688686
":__support_fputil_fp_bits",
689-
":__support_fputil_platform_defs",
690687
":__support_integer_to_string",
691688
":__support_uint128",
692689
],
@@ -719,7 +716,6 @@ libc_support_library(
719716
":__support_fputil_fp_bits",
720717
":__support_fputil_nearest_integer_operations",
721718
":__support_fputil_normal_float",
722-
":__support_fputil_platform_defs",
723719
":__support_macros_optimization",
724720
":__support_uint128",
725721
],
@@ -747,14 +743,6 @@ libc_support_library(
747743
],
748744
)
749745

750-
libc_support_library(
751-
name = "__support_fputil_platform_defs",
752-
hdrs = ["src/__support/FPUtil/PlatformDefs.h"],
753-
deps = [
754-
":__support_common",
755-
],
756-
)
757-
758746
sqrt_common_hdrs = [
759747
"src/__support/FPUtil/sqrt.h",
760748
"src/__support/FPUtil/generic/sqrt.h",
@@ -781,7 +769,6 @@ libc_support_library(
781769
":__support_cpp_type_traits",
782770
":__support_fputil_fenv_impl",
783771
":__support_fputil_fp_bits",
784-
":__support_fputil_platform_defs",
785772
":__support_fputil_rounding_mode",
786773
":__support_uint128",
787774
],

utils/bazel/llvm-project-overlay/libc/libc_build_rules.bzl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,6 @@ def libc_math_function(
144144
":__support_fputil_manipulation_functions",
145145
":__support_fputil_nearest_integer_operations",
146146
":__support_fputil_normal_float",
147-
":__support_fputil_platform_defs",
148147
":__support_math_extras",
149148
":__support_fputil_except_value_utils",
150149
]

utils/bazel/llvm-project-overlay/libc/test/src/stdio/BUILD.bazel

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ libc_test(
6161
],
6262
deps = [
6363
"//libc:__support_fputil_fp_bits",
64-
"//libc:__support_fputil_platform_defs",
6564
"//libc/test/UnitTest:fp_test_helpers",
6665
],
6766
)

utils/bazel/llvm-project-overlay/libc/utils/MPFRWrapper/BUILD.bazel

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ libc_support_library(
4747
"//libc:__support_fputil_float_properties",
4848
"//libc:__support_fputil_fp_bits",
4949
"//libc:__support_fputil_fpbits_str",
50-
"//libc:__support_fputil_platform_defs",
5150
"//libc/test/UnitTest:fp_test_helpers",
5251
"//libc/utils/MPFRWrapper:mpfr_impl",
5352
],

0 commit comments

Comments
 (0)