-
Notifications
You must be signed in to change notification settings - Fork 13.7k
[libc] Move freelist + block to __support #96231
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@llvm/pr-subscribers-libc Author: None (PiJoules) ChangesFull diff: https://github.com/llvm/llvm-project/pull/96231.diff 12 Files Affected:
diff --git a/libc/src/__support/CMakeLists.txt b/libc/src/__support/CMakeLists.txt
index 32d693ec6a268..d8a192f1ffa57 100644
--- a/libc/src/__support/CMakeLists.txt
+++ b/libc/src/__support/CMakeLists.txt
@@ -1,6 +1,47 @@
add_subdirectory(CPP)
add_subdirectory(macros)
+add_header_library(
+ block
+ HDRS
+ block.h
+ DEPENDS
+ libc.src.__support.CPP.algorithm
+ libc.src.__support.CPP.limits
+ libc.src.__support.CPP.new
+ libc.src.__support.CPP.optional
+ libc.src.__support.CPP.span
+ libc.src.__support.CPP.type_traits
+)
+
+add_header_library(
+ freelist
+ HDRS
+ freelist.h
+ DEPENDS
+ libc.src.__support.fixedvector
+ libc.src.__support.CPP.array
+ libc.src.__support.CPP.cstddef
+ libc.src.__support.CPP.new
+ libc.src.__support.CPP.span
+)
+
+add_header_library(
+ freelist_heap
+ HDRS
+ freelist_heap.h
+ DEPENDS
+ .block
+ .freelist
+ libc.src.__support.CPP.cstddef
+ libc.src.__support.CPP.array
+ libc.src.__support.CPP.optional
+ libc.src.__support.CPP.span
+ libc.src.__support.libc_assert
+ libc.src.string.memory_utils.inline_memcpy
+ libc.src.string.memory_utils.inline_memset
+)
+
add_header_library(
blockstore
HDRS
diff --git a/libc/src/stdlib/block.h b/libc/src/__support/block.h
similarity index 99%
rename from libc/src/stdlib/block.h
rename to libc/src/__support/block.h
index b0462a12afb39..580f20e1ec4a4 100644
--- a/libc/src/stdlib/block.h
+++ b/libc/src/__support/block.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef LLVM_LIBC_SRC_STDLIB_BLOCK_H
-#define LLVM_LIBC_SRC_STDLIB_BLOCK_H
+#ifndef LLVM_LIBC_SRC___SUPPORT_BLOCK_H
+#define LLVM_LIBC_SRC___SUPPORT_BLOCK_H
#include "src/__support/CPP/algorithm.h"
#include "src/__support/CPP/cstddef.h"
@@ -481,4 +481,4 @@ internal::BlockStatus Block<OffsetType, kAlign>::check_status() const {
} // namespace LIBC_NAMESPACE
-#endif // LLVM_LIBC_SRC_STDLIB_BLOCK_H
+#endif // LLVM_LIBC_SRC___SUPPORT_BLOCK_H
diff --git a/libc/src/stdlib/freelist.h b/libc/src/__support/freelist.h
similarity index 100%
rename from libc/src/stdlib/freelist.h
rename to libc/src/__support/freelist.h
diff --git a/libc/src/stdlib/freelist_heap.h b/libc/src/__support/freelist_heap.h
similarity index 97%
rename from libc/src/stdlib/freelist_heap.h
rename to libc/src/__support/freelist_heap.h
index 6357c047021df..3569baf27bdaa 100644
--- a/libc/src/stdlib/freelist_heap.h
+++ b/libc/src/__support/freelist_heap.h
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef LLVM_LIBC_SRC_STDLIB_FREELIST_HEAP_H
-#define LLVM_LIBC_SRC_STDLIB_FREELIST_HEAP_H
+#ifndef LLVM_LIBC_SRC___SUPPORT_FREELIST_HEAP_H
+#define LLVM_LIBC_SRC___SUPPORT_FREELIST_HEAP_H
#include <stddef.h>
@@ -220,4 +220,4 @@ extern FreeListHeap<> *freelist_heap;
} // namespace LIBC_NAMESPACE
-#endif // LLVM_LIBC_SRC_STDLIB_FREELIST_HEAP_H
+#endif // LLVM_LIBC_SRC___SUPPORT_FREELIST_HEAP_H
diff --git a/libc/src/stdlib/CMakeLists.txt b/libc/src/stdlib/CMakeLists.txt
index fdbf7b75e72f4..3b1ca3ab2fe42 100644
--- a/libc/src/stdlib/CMakeLists.txt
+++ b/libc/src/stdlib/CMakeLists.txt
@@ -380,44 +380,6 @@ elseif(LIBC_TARGET_OS_IS_GPU)
aligned_alloc
)
else()
- add_header_library(
- block
- HDRS
- block.h
- DEPENDS
- libc.src.__support.CPP.algorithm
- libc.src.__support.CPP.limits
- libc.src.__support.CPP.new
- libc.src.__support.CPP.optional
- libc.src.__support.CPP.span
- libc.src.__support.CPP.type_traits
- )
- add_header_library(
- freelist
- HDRS
- freelist.h
- DEPENDS
- libc.src.__support.fixedvector
- libc.src.__support.CPP.array
- libc.src.__support.CPP.cstddef
- libc.src.__support.CPP.new
- libc.src.__support.CPP.span
- )
- add_header_library(
- freelist_heap
- HDRS
- freelist_heap.h
- DEPENDS
- .block
- .freelist
- libc.src.__support.CPP.cstddef
- libc.src.__support.CPP.array
- libc.src.__support.CPP.optional
- libc.src.__support.CPP.span
- libc.src.__support.libc_assert
- libc.src.string.memory_utils.inline_memcpy
- libc.src.string.memory_utils.inline_memset
- )
# Only add malloc in full build mode. Use the system malloc in overlay mode.
if(LLVM_LIBC_FULL_BUILD)
add_entrypoint_object(
@@ -427,7 +389,7 @@ else()
HDRS
malloc.h
DEPENDS
- .freelist_heap
+ libc.src.__support.freelist_heap
)
else()
add_entrypoint_external(
diff --git a/libc/src/stdlib/freelist_malloc.cpp b/libc/src/stdlib/freelist_malloc.cpp
index 185b36444e371..0be7f3467e32c 100644
--- a/libc/src/stdlib/freelist_malloc.cpp
+++ b/libc/src/stdlib/freelist_malloc.cpp
@@ -6,7 +6,7 @@
//
//===----------------------------------------------------------------------===//
-#include "freelist_heap.h"
+#include "src/__support/freelist_heap.h"
#include "src/stdlib/calloc.h"
#include "src/stdlib/free.h"
#include "src/stdlib/malloc.h"
diff --git a/libc/test/src/__support/CMakeLists.txt b/libc/test/src/__support/CMakeLists.txt
index d05377eca8a81..082a002959c95 100644
--- a/libc/test/src/__support/CMakeLists.txt
+++ b/libc/test/src/__support/CMakeLists.txt
@@ -1,5 +1,47 @@
add_custom_target(libc-support-tests)
+add_libc_test(
+ block_test
+ SUITE
+ libc-support-tests
+ SRCS
+ block_test.cpp
+ DEPENDS
+ libc.src.__support.CPP.array
+ libc.src.__support.CPP.span
+ libc.src.__support.block
+ libc.src.string.memcpy
+)
+
+add_libc_test(
+ freelist_test
+ SUITE
+ libc-support-tests
+ SRCS
+ freelist_test.cpp
+ DEPENDS
+ libc.src.__support.CPP.array
+ libc.src.__support.CPP.span
+ libc.src.__support.freelist
+)
+
+if(LLVM_LIBC_FULL_BUILD)
+ add_libc_test(
+ freelist_heap_test
+ SUITE
+ libc-support-tests
+ SRCS
+ freelist_heap_test.cpp
+ freelist_malloc_test.cpp
+ DEPENDS
+ libc.src.__support.CPP.span
+ libc.src.__support.freelist_heap
+ libc.src.stdlib.malloc
+ libc.src.string.memcmp
+ libc.src.string.memcpy
+ )
+endif()
+
add_libc_test(
blockstore_test
SUITE
diff --git a/libc/test/src/stdlib/block_test.cpp b/libc/test/src/__support/block_test.cpp
similarity index 99%
rename from libc/test/src/stdlib/block_test.cpp
rename to libc/test/src/__support/block_test.cpp
index 0544e699cc8b2..6614e4b583d3f 100644
--- a/libc/test/src/stdlib/block_test.cpp
+++ b/libc/test/src/__support/block_test.cpp
@@ -7,10 +7,9 @@
//===----------------------------------------------------------------------===//
#include <stddef.h>
-#include "src/stdlib/block.h"
-
#include "src/__support/CPP/array.h"
#include "src/__support/CPP/span.h"
+#include "src/__support/block.h"
#include "src/string/memcpy.h"
#include "test/UnitTest/Test.h"
diff --git a/libc/test/src/stdlib/freelist_heap_test.cpp b/libc/test/src/__support/freelist_heap_test.cpp
similarity index 99%
rename from libc/test/src/stdlib/freelist_heap_test.cpp
rename to libc/test/src/__support/freelist_heap_test.cpp
index e30c23e724a06..a35cb5589ed62 100644
--- a/libc/test/src/stdlib/freelist_heap_test.cpp
+++ b/libc/test/src/__support/freelist_heap_test.cpp
@@ -7,7 +7,7 @@
//===----------------------------------------------------------------------===//
#include "src/__support/CPP/span.h"
-#include "src/stdlib/freelist_heap.h"
+#include "src/__support/freelist_heap.h"
#include "src/string/memcmp.h"
#include "src/string/memcpy.h"
#include "test/UnitTest/Test.h"
diff --git a/libc/test/src/stdlib/freelist_malloc_test.cpp b/libc/test/src/__support/freelist_malloc_test.cpp
similarity index 98%
rename from libc/test/src/stdlib/freelist_malloc_test.cpp
rename to libc/test/src/__support/freelist_malloc_test.cpp
index b2527c5b571b1..989e9548fa26d 100644
--- a/libc/test/src/stdlib/freelist_malloc_test.cpp
+++ b/libc/test/src/__support/freelist_malloc_test.cpp
@@ -6,9 +6,9 @@
//
//===----------------------------------------------------------------------===//
+#include "src/__support/freelist_heap.h"
#include "src/stdlib/calloc.h"
#include "src/stdlib/free.h"
-#include "src/stdlib/freelist_heap.h"
#include "src/stdlib/malloc.h"
#include "test/UnitTest/Test.h"
diff --git a/libc/test/src/stdlib/freelist_test.cpp b/libc/test/src/__support/freelist_test.cpp
similarity index 99%
rename from libc/test/src/stdlib/freelist_test.cpp
rename to libc/test/src/__support/freelist_test.cpp
index e25c74b47b852..cae0ed470315c 100644
--- a/libc/test/src/stdlib/freelist_test.cpp
+++ b/libc/test/src/__support/freelist_test.cpp
@@ -10,7 +10,7 @@
#include "src/__support/CPP/array.h"
#include "src/__support/CPP/span.h"
-#include "src/stdlib/freelist.h"
+#include "src/__support/freelist.h"
#include "test/UnitTest/Test.h"
using LIBC_NAMESPACE::FreeList;
diff --git a/libc/test/src/stdlib/CMakeLists.txt b/libc/test/src/stdlib/CMakeLists.txt
index 0ded674ee0e12..38488778c657c 100644
--- a/libc/test/src/stdlib/CMakeLists.txt
+++ b/libc/test/src/stdlib/CMakeLists.txt
@@ -54,48 +54,6 @@ add_libc_test(
libc.src.stdlib.atoll
)
-add_libc_test(
- block_test
- SUITE
- libc-stdlib-tests
- SRCS
- block_test.cpp
- DEPENDS
- libc.src.stdlib.block
- libc.src.__support.CPP.array
- libc.src.__support.CPP.span
- libc.src.string.memcpy
-)
-
-add_libc_test(
- freelist_test
- SUITE
- libc-stdlib-tests
- SRCS
- freelist_test.cpp
- DEPENDS
- libc.src.stdlib.freelist
- libc.src.__support.CPP.array
- libc.src.__support.CPP.span
-)
-
-if(LLVM_LIBC_FULL_BUILD)
- add_libc_test(
- freelist_heap_test
- SUITE
- libc-stdlib-tests
- SRCS
- freelist_heap_test.cpp
- freelist_malloc_test.cpp
- DEPENDS
- libc.src.__support.CPP.span
- libc.src.stdlib.freelist_heap
- libc.src.stdlib.malloc
- libc.src.string.memcmp
- libc.src.string.memcpy
- )
-endif()
-
add_fp_unittest(
strtod_test
SUITE
|
nickdesaulniers
approved these changes
Jun 20, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for the cleanup!
d69e246
to
de84a16
Compare
AlexisPerry
pushed a commit
to llvm-project-tlp/llvm-project
that referenced
this pull request
Jul 9, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.