Skip to content

Commit

Permalink
[libc][cmake] split fputil into individual targets
Browse files Browse the repository at this point in the history
The libc.src.__support.FPUtil.fputil target encompassed many unrelated
files, and provided a lot of hidden dependencies. This patch splits out
all of these files into component parts and cleans up the cmake files
that used them. It does not touch any source files for simplicity, but
there may be changes made to them in future patches.

Reviewed By: lntue

Differential Revision: https://reviews.llvm.org/D132980
  • Loading branch information
michaelrj-google committed Aug 31, 2022
1 parent d45c04d commit 9ac66f0
Show file tree
Hide file tree
Showing 16 changed files with 471 additions and 283 deletions.
2 changes: 1 addition & 1 deletion libc/fuzzing/math/CMakeLists.txt
Expand Up @@ -45,7 +45,7 @@ add_libc_fuzzer(
libc.src.math.trunc
libc.src.math.truncf
libc.src.math.truncl
libc.src.__support.FPUtil.fputil
libc.src.__support.FPUtil.fp_bits
libc.src.__support.CPP.type_traits
)

Expand Down
3 changes: 2 additions & 1 deletion libc/src/__support/CMakeLists.txt
Expand Up @@ -61,7 +61,8 @@ add_header_library(
.uint128
libc.include.errno
libc.src.__support.CPP.limits
libc.src.__support.FPUtil.fputil
libc.src.__support.FPUtil.fp_bits
libc.src.__support.FPUtil.builtin_wrappers
libc.src.errno.errno
)

Expand Down
134 changes: 118 additions & 16 deletions libc/src/__support/FPUtil/CMakeLists.txt
@@ -1,36 +1,137 @@
#TODO(michaelrj): separate the fputil library into individual targets.
add_header_library(
fputil
builtin_wrappers
HDRS
builtin_wrappers.h
)

add_header_library(
fenv_impl
HDRS
FEnvImpl.h
BasicOperations.h
DivisionAndRemainderOperations.h
DEPENDS
libc.include.fenv
libc.src.__support.common
)

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
)

add_header_library(
fp_bits
HDRS
FPBits.h
BasicOperations.h
ManipulationFunctions.h
DEPENDS
.platform_defs
.float_properties
.builtin_wrappers
libc.src.__support.CPP.bit
libc.src.__support.CPP.type_traits
libc.src.__support.common
)

add_header_library(
nearest_integer_operations
HDRS
NearestIntegerOperations.h
NormalFloat.h
PlatformDefs.h
builtin_wrappers.h
except_value_utils.h
DEPENDS
.fp_bits
.fenv_impl
libc.src.__support.CPP.type_traits
libc.include.math
libc.include.errno
libc.include.fenv
libc.src.errno.errno
)

add_header_library(
normal_float
HDRS
NormalFloat.h
DEPENDS
.fp_bits
libc.src.__support.CPP.type_traits
)

add_header_library(
manipulation_functions
HDRS
ManipulationFunctions.h
DEPENDS
.fp_bits
.nearest_integer_operations
.normal_float
.platform_defs
libc.src.__support.CPP.bit
libc.src.__support.CPP.type_traits
libc.include.math
libc.src.__support.common
libc.include.errno
libc.src.errno.errno
)

add_header_library(
basic_operations
HDRS
BasicOperations.h
DEPENDS
.fp_bits
libc.src.__support.CPP.type_traits
)

add_header_library(
division_and_remainder_operations
HDRS
DivisionAndRemainderOperations.h
DEPENDS
.fp_bits
.manipulation_functions
.normal_float
libc.src.__support.CPP.type_traits
)

add_header_library(
except_value_utils
HDRS
except_value_utils.h
DEPENDS
.fp_bits
.fenv_impl
)


add_header_library(
hypot
HDRS
Hypot.h
DEPENDS
.basic_operations
.fenv_impl
.fp_bits
.builtin_wrappers
libc.src.__support.CPP.bit
libc.src.__support.CPP.type_traits
libc.src.__support.uint128
libc.src.errno.errno
)

add_header_library(
xfloat
HDRS
XFloat.h
DEPENDS
.fputil #FPBits and NormalFloat
.fp_bits
.normal_float
libc.src.__support.uint
)

Expand All @@ -39,7 +140,7 @@ add_header_library(
HDRS
sqrt.h
DEPENDS
.fputil
libc.src.__support.common
libc.src.__support.FPUtil.generic.sqrt
)

Expand All @@ -48,7 +149,8 @@ add_header_library(
HDRS
FMA.h
DEPENDS
.fputil
libc.src.__support.common
libc.src.__support.CPP.type_traits
libc.src.__support.FPUtil.generic.fma
FLAGS
FMA_OPT
Expand Down
28 changes: 14 additions & 14 deletions libc/src/fenv/CMakeLists.txt
Expand Up @@ -6,7 +6,7 @@ add_entrypoint_object(
fegetround.h
DEPENDS
libc.include.fenv
libc.src.__support.FPUtil.fputil
libc.src.__support.FPUtil.fenv_impl
COMPILE_OPTIONS
-O2
)
Expand All @@ -19,7 +19,7 @@ add_entrypoint_object(
fesetround.h
DEPENDS
libc.include.fenv
libc.src.__support.FPUtil.fputil
libc.src.__support.FPUtil.fenv_impl
COMPILE_OPTIONS
-O2
)
Expand All @@ -32,7 +32,7 @@ add_entrypoint_object(
feclearexcept.h
DEPENDS
libc.include.fenv
libc.src.__support.FPUtil.fputil
libc.src.__support.FPUtil.fenv_impl
COMPILE_OPTIONS
-O2
)
Expand All @@ -45,7 +45,7 @@ add_entrypoint_object(
feraiseexcept.h
DEPENDS
libc.include.fenv
libc.src.__support.FPUtil.fputil
libc.src.__support.FPUtil.fenv_impl
COMPILE_OPTIONS
-O2
)
Expand All @@ -58,7 +58,7 @@ add_entrypoint_object(
fetestexcept.h
DEPENDS
libc.include.fenv
libc.src.__support.FPUtil.fputil
libc.src.__support.FPUtil.fenv_impl
COMPILE_OPTIONS
-O2
)
Expand All @@ -71,7 +71,7 @@ add_entrypoint_object(
fegetenv.h
DEPENDS
libc.include.fenv
libc.src.__support.FPUtil.fputil
libc.src.__support.FPUtil.fenv_impl
COMPILE_OPTIONS
-O2
)
Expand All @@ -84,7 +84,7 @@ add_entrypoint_object(
fesetenv.h
DEPENDS
libc.include.fenv
libc.src.__support.FPUtil.fputil
libc.src.__support.FPUtil.fenv_impl
COMPILE_OPTIONS
-O2
)
Expand All @@ -97,7 +97,7 @@ add_entrypoint_object(
fegetexceptflag.h
DEPENDS
libc.include.fenv
libc.src.__support.FPUtil.fputil
libc.src.__support.FPUtil.fenv_impl
COMPILE_OPTIONS
-O2
)
Expand All @@ -110,7 +110,7 @@ add_entrypoint_object(
fesetexceptflag.h
DEPENDS
libc.include.fenv
libc.src.__support.FPUtil.fputil
libc.src.__support.FPUtil.fenv_impl
COMPILE_OPTIONS
-O2
)
Expand All @@ -123,7 +123,7 @@ add_entrypoint_object(
feholdexcept.h
DEPENDS
libc.include.fenv
libc.src.__support.FPUtil.fputil
libc.src.__support.FPUtil.fenv_impl
COMPILE_OPTIONS
-O2
)
Expand All @@ -136,7 +136,7 @@ add_entrypoint_object(
feupdateenv.h
DEPENDS
libc.include.fenv
libc.src.__support.FPUtil.fputil
libc.src.__support.FPUtil.fenv_impl
COMPILE_OPTIONS
-O2
)
Expand All @@ -149,7 +149,7 @@ add_entrypoint_object(
feenableexcept.h
DEPENDS
libc.include.fenv
libc.src.__support.FPUtil.fputil
libc.src.__support.FPUtil.fenv_impl
COMPILE_OPTIONS
-O2
)
Expand All @@ -162,7 +162,7 @@ add_entrypoint_object(
fedisableexcept.h
DEPENDS
libc.include.fenv
libc.src.__support.FPUtil.fputil
libc.src.__support.FPUtil.fenv_impl
COMPILE_OPTIONS
-O2
)
Expand All @@ -175,7 +175,7 @@ add_entrypoint_object(
fegetexcept.h
DEPENDS
libc.include.fenv
libc.src.__support.FPUtil.fputil
libc.src.__support.FPUtil.fenv_impl
COMPILE_OPTIONS
-O2
)
2 changes: 0 additions & 2 deletions libc/src/math/CMakeLists.txt
Expand Up @@ -47,7 +47,6 @@ add_entrypoint_object(
HDRS
fmaf.h
DEPENDS
libc.src.__support.FPUtil.fputil
libc.src.__support.FPUtil.fma
COMPILE_OPTIONS
-O3
Expand All @@ -60,7 +59,6 @@ add_entrypoint_object(
HDRS
fma.h
DEPENDS
libc.src.__support.FPUtil.fputil
libc.src.__support.FPUtil.fma
COMPILE_OPTIONS
-O3
Expand Down

0 comments on commit 9ac66f0

Please sign in to comment.