diff options
| author | Duncan Sands <baldrick@free.fr> | 2007-12-12 23:03:45 +0000 |
|---|---|---|
| committer | Duncan Sands <baldrick@free.fr> | 2007-12-12 23:03:45 +0000 |
| commit | 67f1c493d105fdfb8ffa980ff82ff7d9e3fafefc (patch) | |
| tree | f4deb78e05abb63d0a95fc6c7eb5f0bcbf58d20b /include | |
| parent | 8d2ed33f6f16850a7062d1fb5ab66fd025f301e8 (diff) | |
Remove host endianness info from TargetData and
put it in a new header System/Host.h instead.
Instead of getting the endianness from configure,
calculate it directly.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44959 91177308-0d34-0410-b5e6-96231b3b80d8
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 64858f26b9..32e154a695 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 0000000000..df46b25527 --- /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 fcc57a1b2a..3136a38ac0 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. |
