diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/llvm/Config/config.h.in | 6 | ||||
-rw-r--r-- | include/llvm/System/Host.h | 36 | ||||
-rw-r--r-- | include/llvm/Target/TargetData.h | 4 |
3 files changed, 36 insertions, 10 deletions
diff --git a/include/llvm/Config/config.h.in b/include/llvm/Config/config.h.in index 64858f2..32e154a 100644 --- a/include/llvm/Config/config.h.in +++ b/include/llvm/Config/config.h.in @@ -494,9 +494,6 @@ /* Installation prefix directory */ #undef LLVM_PREFIX -/* Define if this target is little endian */ -#undef LSB_FIRST - /* Define if the OS needs help to load dependent libraries for dlopen(). */ #undef LTDL_DLOPEN_DEPLIBS @@ -514,9 +511,6 @@ /* Define to the system default library search path. */ #undef LTDL_SYSSEARCHPATH -/* Define if this target is big endian */ -#undef MSB_FIRST - /* Define if /dev/zero should be used when mapping RWX memory, or undefine if its not necessary */ #undef NEED_DEV_ZERO_FOR_MMAP diff --git a/include/llvm/System/Host.h b/include/llvm/System/Host.h new file mode 100644 index 0000000..df46b25 --- /dev/null +++ b/include/llvm/System/Host.h @@ -0,0 +1,36 @@ +//===- llvm/System/Host.h - Host machine characteristics --------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file was developed by Duncan Sands and is distributed under the +// University of Illinois Open Source License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// Methods for querying the nature of the host machine. +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_SYSTEM_HOST_H +#define LLVM_SYSTEM_HOST_H + +namespace llvm { +namespace sys { + + inline bool littleEndianHost() { + union { + int i; + char c; + }; + i = 1; + return c; + } + + inline bool bigEndianHost() { + return !littleEndianHost(); + } + +} +} + +#endif diff --git a/include/llvm/Target/TargetData.h b/include/llvm/Target/TargetData.h index fcc57a1..3136a38 100644 --- a/include/llvm/Target/TargetData.h +++ b/include/llvm/Target/TargetData.h @@ -142,10 +142,6 @@ public: bool isLittleEndian() const { return LittleEndian; } bool isBigEndian() const { return !LittleEndian; } - /// Host endianness. - bool hostIsLittleEndian() const; - bool hostIsBigEndian() const { return !hostIsLittleEndian(); } - /// getStringRepresentation - Return the string representation of the /// TargetData. This representation is in the same format accepted by the /// string constructor above. |