[libc][NFC] Remove headergen for the cacheline size macro.

We want to be able to build and test the string functions in contexts
like that of Fuchsia where LLVM pieces like tablegen are not available.
Since header generation uses tablegen, we are removing the dependency on
headergen here.

Reviewed By: gchatelet

Differential Revision: https://reviews.llvm.org/D97363
This commit is contained in:
Siva Chandra Reddy 2021-02-24 00:05:53 -08:00
parent b90fdb7c11
commit 5f0800cc18
8 changed files with 20 additions and 60 deletions

View File

@ -1,21 +1,7 @@
add_gen_header(
cacheline_size
DEF_FILE
cacheline_size.h.def
GEN_HDR
cacheline_size.h
PARAMS
machine_cacheline_size=cacheline_size_${LIBC_TARGET_MACHINE}.h.inc
DATA_FILES
cacheline_size_${LIBC_TARGET_MACHINE}.h.inc
)
add_header_library(
memory_utils
HDRS
utils.h
memcpy_utils.h
memset_utils.h
DEPENDS
.cacheline_size
)

View File

@ -1,27 +0,0 @@
//===-- Cacheline Size Constant -------------------------------------------===//
//
// 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_MEMORY_CONSTANTS_H
#define LLVM_LIBC_SRC_MEMORY_CONSTANTS_H
// LLVM_LIBC_CACHELINE_SIZE
//
// Explicitly defines the size of the L1 cache for purposes of alignment.
//
// NOTE: this macro should be replaced with the following C++17 features, when
// those are generally available:
//
// * `std::hardware_constructive_interference_size`
// * `std::hardware_destructive_interference_size`
//
// See http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0154r1.html
// for more information.
%%include_file(${machine_cacheline_size})
#endif // LLVM_LIBC_SRC_MEMORY_CONSTANTS_H

View File

@ -1,3 +0,0 @@
// We would need to read special register ctr_el0 to find out L1 dcache size.
// This value is a good estimate based on a real aarch64 machine.
#define LLVM_LIBC_CACHELINE_SIZE 64

View File

@ -1,9 +0,0 @@
// Cache line sizes for ARM: These values are not strictly correct since
// cache line sizes depend on implementations, not architectures. There
// are even implementations with cache line sizes configurable at boot
// time.
#if defined(__ARM_ARCH_5T__)
#define LLVM_LIBC_CACHELINE_SIZE 32
#elif defined(__ARM_ARCH_7A__)
#define LLVM_LIBC_CACHELINE_SIZE 64
#endif

View File

@ -1 +0,0 @@
#define LLVM_LIBC_CACHELINE_SIZE 128

View File

@ -1 +0,0 @@
#define LLVM_LIBC_CACHELINE_SIZE 64

View File

@ -1 +0,0 @@
#define LLVM_LIBC_CACHELINE_SIZE 64

View File

@ -6,10 +6,26 @@
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_LIBC_SRC_MEMORY_UTILS_H
#define LLVM_LIBC_SRC_MEMORY_UTILS_H
#ifndef LLVM_LIBC_SRC_MEMORY_UTILS_UTILS_H
#define LLVM_LIBC_SRC_MEMORY_UTILS_UTILS_H
#include "src/string/memory_utils/cacheline_size.h"
// Cache line sizes for ARM: These values are not strictly correct since
// cache line sizes depend on implementations, not architectures. There
// are even implementations with cache line sizes configurable at boot
// time.
#if defined(__aarch64__)
#define LLVM_LIBC_CACHELINE_SIZE 64
#elif defined(__ARM_ARCH_5T__)
#define LLVM_LIBC_CACHELINE_SIZE 32
#elif defined(__ARM_ARCH_7A__)
#define LLVM_LIBC_CACHELINE_SIZE 64
#elif defined(__PPC64__)
#define LLVM_LIBC_CACHELINE_SIZE 128
#elif defined(__i386__) || defined(__x86_64__)
#define LLVM_LIBC_CACHELINE_SIZE 64
#else
#error "Unsupported platform for memory functions."
#endif
#include <stddef.h> // size_t
#include <stdint.h> // intptr_t / uintptr_t
@ -66,4 +82,4 @@ template <size_t alignment, typename T> static T *assume_aligned(T *ptr) {
} // namespace __llvm_libc
#endif // LLVM_LIBC_SRC_MEMORY_UTILS_H
#endif // LLVM_LIBC_SRC_MEMORY_UTILS_UTILS_H