File tree Expand file tree Collapse file tree 9 files changed +491
-2
lines changed Expand file tree Collapse file tree 9 files changed +491
-2
lines changed Original file line number Diff line number Diff line change 3
3
# ------------------------------------------------------------------------------
4
4
5
5
# Initialize ALL_COMPILER_FEATURES as empty list.
6
- set (ALL_COMPILER_FEATURES "float128" )
6
+ set (ALL_COMPILER_FEATURES "float128" "fixed_point" )
7
7
8
8
# Making sure ALL_COMPILER_FEATURES is sorted.
9
9
list (SORT ALL_COMPILER_FEATURES )
@@ -42,16 +42,23 @@ set(AVAILABLE_COMPILER_FEATURES "")
42
42
# Try compile a C file to check if flag is supported.
43
43
set (CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY )
44
44
foreach (feature IN LISTS ALL_COMPILER_FEATURES )
45
+ set (compile_options ${LIBC_COMPILE_OPTIONS_NATIVE} )
46
+ if (${feature} STREQUAL "fixed_point" )
47
+ list (APPEND compiler_options "-ffixed-point" )
48
+ endif ()
49
+
45
50
try_compile (
46
51
has_feature
47
52
${CMAKE_CURRENT_BINARY_DIR} /compiler_features
48
53
SOURCES ${LIBC_SOURCE_DIR} /cmake/modules/compiler_features/check_${feature}.cpp
49
- COMPILE_DEFINITIONS -I${LIBC_SOURCE_DIR} ${LIBC_COMPILE_OPTIONS_NATIVE }
54
+ COMPILE_DEFINITIONS -I${LIBC_SOURCE_DIR} ${compiler_options }
50
55
)
51
56
if (has_feature )
52
57
list (APPEND AVAILABLE_COMPILER_FEATURES ${feature} )
53
58
if (${feature} STREQUAL "float128" )
54
59
set (LIBC_COMPILER_HAS_FLOAT128 TRUE )
60
+ elseif (${feature} STREQUAL "fixed_point" )
61
+ set (LIBC_COMPILER_HAS_FIXED_POINT TRUE )
55
62
endif ()
56
63
endif ()
57
64
endforeach ()
Original file line number Diff line number Diff line change
1
+ #include " include/llvm-libc-macross/stdfix_macros.h"
2
+
3
+ #ifndef LIBC_COMPILER_HAS_FIXED_POINT
4
+ #error unsupported
5
+ #endif
Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ set(TARGET_PUBLIC_HEADERS
16
16
libc.include.spawn
17
17
libc.include.setjmp
18
18
libc.include.stdbit
19
+ libc.include.stdfix
19
20
libc.include.stdio
20
21
libc.include.stdlib
21
22
libc.include.string
Original file line number Diff line number Diff line change @@ -104,6 +104,14 @@ add_gen_header(
104
104
.llvm-libc-types.float128
105
105
)
106
106
107
+ add_gen_header (
108
+ stdfix
109
+ DEF_FILE stdfix.h.def
110
+ GEN_HDR stdfix.h
111
+ DEPENDS
112
+ .llvm-libc-macros.stdfix_macros
113
+ )
114
+
107
115
# TODO: This should be conditional on POSIX networking being included.
108
116
file (MAKE_DIRECTORY ${LIBC_INCLUDE_DIR} /arpa )
109
117
Original file line number Diff line number Diff line change @@ -227,3 +227,9 @@ add_macro_header(
227
227
HDR
228
228
inttypes-macros.h
229
229
)
230
+
231
+ add_macro_header (
232
+ stdfix_macros
233
+ HDR
234
+ stdfix-macros.h
235
+ )
You can’t perform that action at this time.
0 commit comments