1 //===- llvm/Support/Host.h - Host machine characteristics --------*- C++ -*-===// 2 // 3 // The LLVM Compiler Infrastructure 4 // 5 // This file is distributed under the University of Illinois Open Source 6 // License. See LICENSE.TXT for details. 7 // 8 //===----------------------------------------------------------------------===// 9 // 10 // Methods for querying the nature of the host machine. 11 // 12 //===----------------------------------------------------------------------===// 13 14 #ifndef LLVM_SUPPORT_HOST_H 15 #define LLVM_SUPPORT_HOST_H 16 17 #include "llvm/ADT/StringMap.h" 18 19 #if defined(__linux__) || defined(__GNU__) || defined(__HAIKU__) 20 #include <endian.h> 21 #elif defined(_AIX) 22 #include <sys/machine.h> 23 #else 24 #if !defined(BYTE_ORDER) && !defined(LLVM_ON_WIN32) 25 #include <machine/endian.h> 26 #endif 27 #endif 28 29 #include <string> 30 31 namespace llvm { 32 namespace sys { 33 34 #if defined(BYTE_ORDER) && defined(BIG_ENDIAN) && BYTE_ORDER == BIG_ENDIAN 35 static const bool IsBigEndianHost = true; 36 #else 37 static const bool IsBigEndianHost = false; 38 #endif 39 40 static const bool IsLittleEndianHost = !IsBigEndianHost; 41 } 42 } 43 44 #endif 45