Separate builtin implementation from "all implementations"

This commit is contained in:
John Keiser
2021-03-05 11:59:48 -08:00
parent ec5ba79447
commit cf4e538536
11 changed files with 41 additions and 32 deletions
+1 -1
View File
@@ -34,8 +34,8 @@
}
*/
#include "simdjson/base.h"
#include "simdjson/dom.h"
#include "simdjson/implementations.h"
#include "simdjson/builtin.h"
#endif // SIMDJSON_H
+2 -8
View File
@@ -1,23 +1,17 @@
#ifndef SIMDJSON_ARM64_H
#define SIMDJSON_ARM64_H
#include "simdjson/implementation-base.h"
#ifdef SIMDJSON_FALLBACK_H
#error "arm64.h must be included before fallback.h"
#endif
#include "simdjson/portability.h"
#ifndef SIMDJSON_IMPLEMENTATION_ARM64
#define SIMDJSON_IMPLEMENTATION_ARM64 (SIMDJSON_IS_ARM64)
#endif
#define SIMDJSON_CAN_ALWAYS_RUN_ARM64 SIMDJSON_IMPLEMENTATION_ARM64 && SIMDJSON_IS_ARM64
#include "simdjson/internal/isadetection.h"
#include "simdjson/internal/jsoncharutils_tables.h"
#include "simdjson/internal/numberparsing_tables.h"
#include "simdjson/internal/simdprune_tables.h"
#if SIMDJSON_IMPLEMENTATION_ARM64
namespace simdjson {
+1
View File
@@ -3,6 +3,7 @@
#include "simdjson/compiler_check.h"
#include "simdjson/common_defs.h"
#include "simdjson/portability.h"
SIMDJSON_PUSH_DISABLE_WARNINGS
SIMDJSON_DISABLE_UNDESIRED_WARNINGS
+5
View File
@@ -6,14 +6,19 @@
#ifndef SIMDJSON_BUILTIN_IMPLEMENTATION
#if SIMDJSON_CAN_ALWAYS_RUN_HASWELL
#define SIMDJSON_BUILTIN_IMPLEMENTATION haswell
#include "simdjson/haswell.h"
#elif SIMDJSON_CAN_ALWAYS_RUN_WESTMERE
#define SIMDJSON_BUILTIN_IMPLEMENTATION westmere
#include "simdjson/westmere.h"
#elif SIMDJSON_CAN_ALWAYS_RUN_ARM64
#define SIMDJSON_BUILTIN_IMPLEMENTATION arm64
#include "simdjson/arm64.h"
#elif SIMDJSON_CAN_ALWAYS_RUN_PPC64
#define SIMDJSON_BUILTIN_IMPLEMENTATION ppc64
#include "simdjson/ppc64.h"
#elif SIMDJSON_CAN_ALWAYS_RUN_FALLBACK
#define SIMDJSON_BUILTIN_IMPLEMENTATION fallback
#include "simdjson/fallback.h"
#else
#error "All possible implementations (including fallback) have been disabled! simdjson will not run."
#endif
+2
View File
@@ -1,6 +1,8 @@
#ifndef SIMDJSON_DOM_H
#define SIMDJSON_DOM_H
#include "simdjson/base.h"
SIMDJSON_PUSH_DISABLE_WARNINGS
SIMDJSON_DISABLE_UNDESIRED_WARNINGS
+1 -1
View File
@@ -1,7 +1,7 @@
#ifndef SIMDJSON_FALLBACK_H
#define SIMDJSON_FALLBACK_H
#include "simdjson/portability.h"
#include "simdjson/implementation-base.h"
// Default Fallback to on unless a builtin implementation has already been selected.
#ifndef SIMDJSON_IMPLEMENTATION_FALLBACK
+2 -2
View File
@@ -1,6 +1,8 @@
#ifndef SIMDJSON_HASWELL_H
#define SIMDJSON_HASWELL_H
#include "simdjson/implementation-base.h"
#ifdef SIMDJSON_WESTMERE_H
#error "haswell.h must be included before westmere.h"
#endif
@@ -8,8 +10,6 @@
#error "haswell.h must be included before fallback.h"
#endif
#include "simdjson/portability.h"
// Default Haswell to on if this is x86-64. Even if we're not compiled for it, it could be selected
// at runtime.
#ifndef SIMDJSON_IMPLEMENTATION_HASWELL
+23
View File
@@ -0,0 +1,23 @@
#ifndef SIMDJSON_IMPLEMENTATION_BASE_H
#define SIMDJSON_IMPLEMENTATION_BASE_H
/**
* @file
* @private
*
* Includes common stuff needed for implementations.
*/
#include "simdjson/base.h"
#include "simdjson/implementation.h"
// Implementation-internal files (must be included before the implementations themselves, to keep
// amalgamation working--otherwise, the first time a file is included, it might be put inside the
// #ifdef SIMDJSON_IMPLEMENTATION_ARM64/FALLBACK/etc., which means the other implementations can't
// compile unless that implementation is turned on).
#include "simdjson/internal/isadetection.h"
#include "simdjson/internal/jsoncharutils_tables.h"
#include "simdjson/internal/numberparsing_tables.h"
#include "simdjson/internal/simdprune_tables.h"
#endif // SIMDJSON_IMPLEMENTATION_BASE_H
-10
View File
@@ -4,22 +4,12 @@
SIMDJSON_PUSH_DISABLE_WARNINGS
SIMDJSON_DISABLE_UNDESIRED_WARNINGS
// Implementation-internal files (must be included before the implementations themselves, to keep
// amalgamation working--otherwise, the first time a file is included, it might be put inside the
// #ifdef SIMDJSON_IMPLEMENTATION_ARM64/FALLBACK/etc., which means the other implementations can't
// compile unless that implementation is turned on).
#include "simdjson/internal/isadetection.h"
#include "simdjson/internal/jsoncharutils_tables.h"
#include "simdjson/internal/numberparsing_tables.h"
#include "simdjson/internal/simdprune_tables.h"
// Implementations
#include "simdjson/arm64.h"
#include "simdjson/haswell.h"
#include "simdjson/westmere.h"
#include "simdjson/ppc64.h"
#include "simdjson/fallback.h"
#include "simdjson/builtin.h"
SIMDJSON_POP_DISABLE_WARNINGS
+2 -8
View File
@@ -1,23 +1,17 @@
#ifndef SIMDJSON_PPC64_H
#define SIMDJSON_PPC64_H
#include "simdjson/implementation-base.h"
#ifdef SIMDJSON_FALLBACK_H
#error "ppc64.h must be included before fallback.h"
#endif
#include "simdjson/portability.h"
#ifndef SIMDJSON_IMPLEMENTATION_PPC64
#define SIMDJSON_IMPLEMENTATION_PPC64 (SIMDJSON_IS_PPC64)
#endif
#define SIMDJSON_CAN_ALWAYS_RUN_PPC64 SIMDJSON_IMPLEMENTATION_PPC64 && SIMDJSON_IS_PPC64
#include "simdjson/internal/isadetection.h"
#include "simdjson/internal/jsoncharutils_tables.h"
#include "simdjson/internal/numberparsing_tables.h"
#include "simdjson/internal/simdprune_tables.h"
#if SIMDJSON_IMPLEMENTATION_PPC64
namespace simdjson {
+2 -2
View File
@@ -1,12 +1,12 @@
#ifndef SIMDJSON_WESTMERE_H
#define SIMDJSON_WESTMERE_H
#include "simdjson/implementation-base.h"
#ifdef SIMDJSON_FALLBACK_H
#error "westmere.h must be included before fallback.h"
#endif
#include "simdjson/portability.h"
// Default Westmere to on if this is x86-64, unless we'll always select Haswell.
#ifndef SIMDJSON_IMPLEMENTATION_WESTMERE
#define SIMDJSON_IMPLEMENTATION_WESTMERE (SIMDJSON_IS_X86_64 && !SIMDJSON_REQUIRES_HASWELL)