[libc][NFC] Sink "PlatformDefs.h" into "FloatProperties.h" (#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.
This commit is contained in:
Guillaume Chatelet 2023-11-23 11:23:18 +01:00 committed by GitHub
parent dbb8643333
commit d924c5d721
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 13 additions and 66 deletions

View File

@ -23,20 +23,11 @@ add_header_library(
libc.src.errno.errno
)
add_header_library(
platform_defs
HDRS
PlatformDefs.h
DEPENDS
libc.src.__support.common
)
add_header_library(
float_properties
HDRS
FloatProperties.h
DEPENDS
.platform_defs
libc.src.__support.uint128
)
@ -46,7 +37,6 @@ add_header_library(
FPBits.h
DEPENDS
.float_properties
.platform_defs
libc.src.__support.common
libc.src.__support.CPP.bit
libc.src.__support.CPP.type_traits
@ -100,7 +90,6 @@ add_header_library(
.fp_bits
.nearest_integer_operations
.normal_float
.platform_defs
libc.src.__support.CPP.bit
libc.src.__support.CPP.type_traits
libc.src.__support.common

View File

@ -9,8 +9,6 @@
#ifndef LLVM_LIBC_SRC___SUPPORT_FPUTIL_FPBITS_H
#define LLVM_LIBC_SRC___SUPPORT_FPUTIL_FPBITS_H
#include "PlatformDefs.h"
#include "src/__support/CPP/bit.h"
#include "src/__support/CPP/type_traits.h"
#include "src/__support/bit.h"

View File

@ -9,12 +9,23 @@
#ifndef LLVM_LIBC_SRC___SUPPORT_FPUTIL_FLOATPROPERTIES_H
#define LLVM_LIBC_SRC___SUPPORT_FPUTIL_FLOATPROPERTIES_H
#include "PlatformDefs.h"
#include "src/__support/UInt128.h"
#include "src/__support/macros/properties/architectures.h" // LIBC_TARGET_ARCH_XXX
#include <stdint.h>
// https://developer.arm.com/documentation/dui0491/i/C-and-C---Implementation-Details/Basic-data-types
// https://developer.apple.com/documentation/xcode/writing-arm64-code-for-apple-platforms
// https://docs.amd.com/bundle/HIP-Programming-Guide-v5.1/page/Programming_with_HIP.html
#if defined(_WIN32) || defined(__arm__) || defined(__NVPTX__) || \
defined(__AMDGPU__) || (defined(__APPLE__) && defined(__aarch64__))
#define LONG_DOUBLE_IS_DOUBLE
#endif
#if !defined(LONG_DOUBLE_IS_DOUBLE) && defined(LIBC_TARGET_ARCH_IS_X86)
#define SPECIAL_X86_LONG_DOUBLE
#endif
namespace LIBC_NAMESPACE {
namespace fputil {

View File

@ -13,7 +13,6 @@
#include "FloatProperties.h"
#include "NearestIntegerOperations.h"
#include "NormalFloat.h"
#include "PlatformDefs.h"
#include "src/__support/CPP/bit.h"
#include "src/__support/CPP/type_traits.h"

View File

@ -1,26 +0,0 @@
//===-- Platform specific macro definitions ---------------------*- 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
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_LIBC_SRC___SUPPORT_FPUTIL_PLATFORMDEFS_H
#define LLVM_LIBC_SRC___SUPPORT_FPUTIL_PLATFORMDEFS_H
#include "src/__support/macros/properties/architectures.h"
// https://developer.arm.com/documentation/dui0491/i/C-and-C---Implementation-Details/Basic-data-types
// https://developer.apple.com/documentation/xcode/writing-arm64-code-for-apple-platforms
// https://docs.amd.com/bundle/HIP-Programming-Guide-v5.1/page/Programming_with_HIP.html
#if defined(_WIN32) || defined(__arm__) || defined(__NVPTX__) || \
defined(__AMDGPU__) || (defined(__APPLE__) && defined(__aarch64__))
#define LONG_DOUBLE_IS_DOUBLE
#endif
#if !defined(LONG_DOUBLE_IS_DOUBLE) && defined(LIBC_TARGET_ARCH_IS_X86)
#define SPECIAL_X86_LONG_DOUBLE
#endif
#endif // LLVM_LIBC_SRC___SUPPORT_FPUTIL_PLATFORMDEFS_H

View File

@ -10,7 +10,6 @@ add_header_library(
libc.src.__support.CPP.type_traits
libc.src.__support.FPUtil.fenv_impl
libc.src.__support.FPUtil.fp_bits
libc.src.__support.FPUtil.platform_defs
libc.src.__support.FPUtil.rounding_mode
libc.src.__support.bit
libc.src.__support.uint128

View File

@ -14,7 +14,6 @@
#include "src/__support/CPP/type_traits.h"
#include "src/__support/FPUtil/FEnvImpl.h"
#include "src/__support/FPUtil/FPBits.h"
#include "src/__support/FPUtil/PlatformDefs.h"
#include "src/__support/FPUtil/rounding_mode.h"
#include "src/__support/UInt128.h"
#include "src/__support/bit.h"

View File

@ -11,7 +11,6 @@
#include "src/__support/FPUtil/FEnvImpl.h"
#include "src/__support/FPUtil/FPBits.h"
#include "src/__support/FPUtil/PlatformDefs.h"
#include "src/__support/FPUtil/rounding_mode.h"
#include "src/__support/UInt128.h"
#include "src/__support/bit.h"

View File

@ -132,7 +132,6 @@ add_fp_unittest(
DEPENDS
libc.src.stdio.sprintf
libc.src.__support.FPUtil.fp_bits
libc.src.__support.FPUtil.platform_defs
COMPILE_OPTIONS
${sprintf_test_copts}
)

View File

@ -9,7 +9,6 @@
#include "src/stdio/sprintf.h"
#include "src/__support/FPUtil/FPBits.h"
#include "src/__support/FPUtil/PlatformDefs.h"
#include "test/UnitTest/RoundingModeUtils.h"
#include "test/UnitTest/Test.h"

View File

@ -8,7 +8,6 @@
#include "src/__support/CPP/limits.h"
#include "src/__support/FPUtil/FPBits.h"
#include "src/__support/FPUtil/PlatformDefs.h"
#include "src/stdio/sscanf.h"

View File

@ -14,7 +14,6 @@ if(LIBC_TESTS_CAN_USE_MPFR)
libc.src.__support.FPUtil.fp_bits
libc.src.__support.FPUtil.float_properties
libc.src.__support.FPUtil.fpbits_str
libc.src.__support.FPUtil.platform_defs
LibcTest.unit
)
if(EXISTS ${LLVM_LIBC_MPFR_INSTALL_PATH})

View File

@ -12,7 +12,6 @@
#include "src/__support/CPP/string_view.h"
#include "src/__support/FPUtil/FPBits.h"
#include "src/__support/FPUtil/FloatProperties.h"
#include "src/__support/FPUtil/PlatformDefs.h"
#include "src/__support/FPUtil/fpbits_str.h"
#include "test/UnitTest/FPMatcher.h"

View File

@ -657,7 +657,6 @@ libc_support_library(
name = "__support_fputil_float_properties",
hdrs = ["src/__support/FPUtil/FloatProperties.h"],
deps = [
":__support_fputil_platform_defs",
":__support_uint128",
],
)
@ -672,7 +671,6 @@ libc_support_library(
":__support_cpp_bit",
":__support_cpp_type_traits",
":__support_fputil_float_properties",
":__support_fputil_platform_defs",
":__support_uint128",
],
)
@ -686,7 +684,6 @@ libc_support_library(
":__support_cpp_type_traits",
":__support_fputil_float_properties",
":__support_fputil_fp_bits",
":__support_fputil_platform_defs",
":__support_integer_to_string",
":__support_uint128",
],
@ -719,7 +716,6 @@ libc_support_library(
":__support_fputil_fp_bits",
":__support_fputil_nearest_integer_operations",
":__support_fputil_normal_float",
":__support_fputil_platform_defs",
":__support_macros_optimization",
":__support_uint128",
],
@ -747,14 +743,6 @@ libc_support_library(
],
)
libc_support_library(
name = "__support_fputil_platform_defs",
hdrs = ["src/__support/FPUtil/PlatformDefs.h"],
deps = [
":__support_common",
],
)
sqrt_common_hdrs = [
"src/__support/FPUtil/sqrt.h",
"src/__support/FPUtil/generic/sqrt.h",
@ -781,7 +769,6 @@ libc_support_library(
":__support_cpp_type_traits",
":__support_fputil_fenv_impl",
":__support_fputil_fp_bits",
":__support_fputil_platform_defs",
":__support_fputil_rounding_mode",
":__support_uint128",
],

View File

@ -144,7 +144,6 @@ def libc_math_function(
":__support_fputil_manipulation_functions",
":__support_fputil_nearest_integer_operations",
":__support_fputil_normal_float",
":__support_fputil_platform_defs",
":__support_math_extras",
":__support_fputil_except_value_utils",
]

View File

@ -61,7 +61,6 @@ libc_test(
],
deps = [
"//libc:__support_fputil_fp_bits",
"//libc:__support_fputil_platform_defs",
"//libc/test/UnitTest:fp_test_helpers",
],
)

View File

@ -47,7 +47,6 @@ libc_support_library(
"//libc:__support_fputil_float_properties",
"//libc:__support_fputil_fp_bits",
"//libc:__support_fputil_fpbits_str",
"//libc:__support_fputil_platform_defs",
"//libc/test/UnitTest:fp_test_helpers",
"//libc/utils/MPFRWrapper:mpfr_impl",
],