[llvm] r375316 - Move endian constant from Host.h to SwapByteOrder.h, prune include
Reid Kleckner via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 18 17:48:11 PDT 2019
Author: rnk
Date: Fri Oct 18 17:48:11 2019
New Revision: 375316
URL: http://llvm.org/viewvc/llvm-project?rev=375316&view=rev
Log:
Move endian constant from Host.h to SwapByteOrder.h, prune include
Works on this dependency chain:
ArrayRef.h ->
Hashing.h -> --CUT--
Host.h ->
StringMap.h / StringRef.h
ArrayRef is very popular, but Host.h is rarely needed. Move the
IsBigEndianHost constant to SwapByteOrder.h. Clients of that header are
more likely to need it.
Modified:
llvm/trunk/include/llvm/ADT/Hashing.h
llvm/trunk/include/llvm/BinaryFormat/Wasm.h
llvm/trunk/include/llvm/Support/Host.h
llvm/trunk/include/llvm/Support/SHA1.h
llvm/trunk/include/llvm/Support/SwapByteOrder.h
llvm/trunk/lib/ExecutionEngine/Orc/JITTargetMachineBuilder.cpp
llvm/trunk/lib/Support/Windows/WindowsSupport.h
llvm/trunk/lib/Target/X86/Disassembler/X86DisassemblerDecoder.cpp
llvm/trunk/tools/llvm-exegesis/lib/RegisterValue.cpp
Modified: llvm/trunk/include/llvm/ADT/Hashing.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/Hashing.h?rev=375316&r1=375315&r2=375316&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/Hashing.h (original)
+++ llvm/trunk/include/llvm/ADT/Hashing.h Fri Oct 18 17:48:11 2019
@@ -45,7 +45,6 @@
#define LLVM_ADT_HASHING_H
#include "llvm/Support/DataTypes.h"
-#include "llvm/Support/Host.h"
#include "llvm/Support/SwapByteOrder.h"
#include "llvm/Support/type_traits.h"
#include <algorithm>
Modified: llvm/trunk/include/llvm/BinaryFormat/Wasm.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/BinaryFormat/Wasm.h?rev=375316&r1=375315&r2=375316&view=diff
==============================================================================
--- llvm/trunk/include/llvm/BinaryFormat/Wasm.h (original)
+++ llvm/trunk/include/llvm/BinaryFormat/Wasm.h Fri Oct 18 17:48:11 2019
@@ -16,6 +16,7 @@
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/SmallVector.h"
+#include "llvm/ADT/StringRef.h"
namespace llvm {
namespace wasm {
Modified: llvm/trunk/include/llvm/Support/Host.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/Host.h?rev=375316&r1=375315&r2=375316&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/Host.h (original)
+++ llvm/trunk/include/llvm/Support/Host.h Fri Oct 18 17:48:11 2019
@@ -15,39 +15,11 @@
#include "llvm/ADT/StringMap.h"
-#if defined(__linux__) || defined(__GNU__) || defined(__HAIKU__)
-#include <endian.h>
-#elif defined(_AIX)
-#include <sys/machine.h>
-#elif defined(__sun)
-/* Solaris provides _BIG_ENDIAN/_LITTLE_ENDIAN selector in sys/types.h */
-#include <sys/types.h>
-#define BIG_ENDIAN 4321
-#define LITTLE_ENDIAN 1234
-#if defined(_BIG_ENDIAN)
-#define BYTE_ORDER BIG_ENDIAN
-#else
-#define BYTE_ORDER LITTLE_ENDIAN
-#endif
-#else
-#if !defined(BYTE_ORDER) && !defined(_WIN32)
-#include <machine/endian.h>
-#endif
-#endif
-
#include <string>
namespace llvm {
namespace sys {
-#if defined(BYTE_ORDER) && defined(BIG_ENDIAN) && BYTE_ORDER == BIG_ENDIAN
-constexpr bool IsBigEndianHost = true;
-#else
-constexpr bool IsBigEndianHost = false;
-#endif
-
- static const bool IsLittleEndianHost = !IsBigEndianHost;
-
/// getDefaultTargetTriple() - Return the default target triple the compiler
/// has been configured to produce code for.
///
Modified: llvm/trunk/include/llvm/Support/SHA1.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/SHA1.h?rev=375316&r1=375315&r2=375316&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/SHA1.h (original)
+++ llvm/trunk/include/llvm/Support/SHA1.h Fri Oct 18 17:48:11 2019
@@ -16,13 +16,13 @@
#define LLVM_SUPPORT_SHA1_H
#include "llvm/ADT/ArrayRef.h"
+#include "llvm/ADT/StringRef.h"
#include <array>
#include <cstdint>
namespace llvm {
template <typename T> class ArrayRef;
-class StringRef;
/// A class that wrap the SHA1 algorithm.
class SHA1 {
Modified: llvm/trunk/include/llvm/Support/SwapByteOrder.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/SwapByteOrder.h?rev=375316&r1=375315&r2=375316&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/SwapByteOrder.h (original)
+++ llvm/trunk/include/llvm/Support/SwapByteOrder.h Fri Oct 18 17:48:11 2019
@@ -22,9 +22,37 @@
#include <stdlib.h>
#endif
+#if defined(__linux__) || defined(__GNU__) || defined(__HAIKU__)
+#include <endian.h>
+#elif defined(_AIX)
+#include <sys/machine.h>
+#elif defined(__sun)
+/* Solaris provides _BIG_ENDIAN/_LITTLE_ENDIAN selector in sys/types.h */
+#include <sys/types.h>
+#define BIG_ENDIAN 4321
+#define LITTLE_ENDIAN 1234
+#if defined(_BIG_ENDIAN)
+#define BYTE_ORDER BIG_ENDIAN
+#else
+#define BYTE_ORDER LITTLE_ENDIAN
+#endif
+#else
+#if !defined(BYTE_ORDER) && !defined(_WIN32)
+#include <machine/endian.h>
+#endif
+#endif
+
namespace llvm {
namespace sys {
+#if defined(BYTE_ORDER) && defined(BIG_ENDIAN) && BYTE_ORDER == BIG_ENDIAN
+constexpr bool IsBigEndianHost = true;
+#else
+constexpr bool IsBigEndianHost = false;
+#endif
+
+static const bool IsLittleEndianHost = !IsBigEndianHost;
+
/// SwapByteOrder_16 - This function returns a byte-swapped representation of
/// the 16-bit argument.
inline uint16_t SwapByteOrder_16(uint16_t value) {
Modified: llvm/trunk/lib/ExecutionEngine/Orc/JITTargetMachineBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/Orc/JITTargetMachineBuilder.cpp?rev=375316&r1=375315&r2=375316&view=diff
==============================================================================
--- llvm/trunk/lib/ExecutionEngine/Orc/JITTargetMachineBuilder.cpp (original)
+++ llvm/trunk/lib/ExecutionEngine/Orc/JITTargetMachineBuilder.cpp Fri Oct 18 17:48:11 2019
@@ -8,6 +8,7 @@
#include "llvm/ExecutionEngine/Orc/JITTargetMachineBuilder.h"
+#include "llvm/Support/Host.h"
#include "llvm/Support/TargetRegistry.h"
namespace llvm {
Modified: llvm/trunk/lib/Support/Windows/WindowsSupport.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Windows/WindowsSupport.h?rev=375316&r1=375315&r2=375316&view=diff
==============================================================================
--- llvm/trunk/lib/Support/Windows/WindowsSupport.h (original)
+++ llvm/trunk/lib/Support/Windows/WindowsSupport.h Fri Oct 18 17:48:11 2019
@@ -38,6 +38,7 @@
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/Twine.h"
#include "llvm/Config/config.h" // Get build system configuration settings
+#include "llvm/Support/Allocator.h"
#include "llvm/Support/Chrono.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/VersionTuple.h"
Modified: llvm/trunk/lib/Target/X86/Disassembler/X86DisassemblerDecoder.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/Disassembler/X86DisassemblerDecoder.cpp?rev=375316&r1=375315&r2=375316&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/Disassembler/X86DisassemblerDecoder.cpp (original)
+++ llvm/trunk/lib/Target/X86/Disassembler/X86DisassemblerDecoder.cpp Fri Oct 18 17:48:11 2019
@@ -12,13 +12,14 @@
//
//===----------------------------------------------------------------------===//
+#include "X86DisassemblerDecoder.h"
+#include "llvm/ADT/StringRef.h"
+
#include <cstdarg> /* for va_*() */
#include <cstdio> /* for vsnprintf() */
#include <cstdlib> /* for exit() */
#include <cstring> /* for memset() */
-#include "X86DisassemblerDecoder.h"
-
using namespace llvm::X86Disassembler;
/// Specifies whether a ModR/M byte is needed and (if so) which
Modified: llvm/trunk/tools/llvm-exegesis/lib/RegisterValue.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-exegesis/lib/RegisterValue.cpp?rev=375316&r1=375315&r2=375316&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-exegesis/lib/RegisterValue.cpp (original)
+++ llvm/trunk/tools/llvm-exegesis/lib/RegisterValue.cpp Fri Oct 18 17:48:11 2019
@@ -8,6 +8,7 @@
#include "RegisterValue.h"
#include "llvm/ADT/APFloat.h"
+#include "llvm/ADT/StringRef.h"
namespace llvm {
namespace exegesis {
More information about the llvm-commits
mailing list