[llvm-commits] [llvm] r44959 - in /llvm/trunk: autoconf/configure.ac configure include/llvm/Config/config.h.in include/llvm/System/Host.h include/llvm/Target/TargetData.h lib/ExecutionEngine/ExecutionEngine.cpp lib/Target/TargetData.cpp
Duncan Sands
baldrick at free.fr
Wed Dec 12 15:03:45 PST 2007
Author: baldrick
Date: Wed Dec 12 17:03:45 2007
New Revision: 44959
URL: http://llvm.org/viewvc/llvm-project?rev=44959&view=rev
Log:
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.
Added:
llvm/trunk/include/llvm/System/Host.h
Modified:
llvm/trunk/autoconf/configure.ac
llvm/trunk/configure
llvm/trunk/include/llvm/Config/config.h.in
llvm/trunk/include/llvm/Target/TargetData.h
llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp
llvm/trunk/lib/Target/TargetData.cpp
Modified: llvm/trunk/autoconf/configure.ac
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/autoconf/configure.ac?rev=44959&r1=44958&r2=44959&view=diff
==============================================================================
--- llvm/trunk/autoconf/configure.ac (original)
+++ llvm/trunk/autoconf/configure.ac Wed Dec 12 17:03:45 2007
@@ -227,10 +227,7 @@
AC_SUBST(ARCH,$llvm_cv_target_arch)
dnl Check for the endianness of the target
-AC_C_BIGENDIAN([AC_SUBST([ENDIAN],[big]),
- AC_DEFINE([MSB_FIRST], [1], [Define if this target is big endian])],
- [AC_SUBST([ENDIAN],[little]),
- AC_DEFINE([LSB_FIRST], [1], [Define if this target is little endian])])
+AC_C_BIGENDIAN(AC_SUBST([ENDIAN],[big]),AC_SUBST([ENDIAN],[little]))
dnl Check for build platform executable suffix if we're crosscompiling
if test "$cross_compiling" = yes; then
Modified: llvm/trunk/configure
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/configure?rev=44959&r1=44958&r2=44959&view=diff
==============================================================================
--- llvm/trunk/configure (original)
+++ llvm/trunk/configure Wed Dec 12 17:03:45 2007
@@ -828,6 +828,7 @@
LLVM_ON_UNIX
LLVM_ON_WIN32
ARCH
+ENDIAN
CC
CFLAGS
LDFLAGS
@@ -838,7 +839,6 @@
CPP
GREP
EGREP
-ENDIAN
LLVM_CROSS_COMPILING
BUILD_CC
BUILD_EXEEXT
@@ -4183,19 +4183,9 @@
case $ac_cv_c_bigendian in
yes)
ENDIAN=big
-,
-
-cat >>confdefs.h <<\_ACEOF
-#define MSB_FIRST 1
-_ACEOF
;;
no)
ENDIAN=little
-,
-
-cat >>confdefs.h <<\_ACEOF
-#define LSB_FIRST 1
-_ACEOF
;;
*)
{ { echo "$as_me:$LINENO: error: unknown endianness
@@ -9881,7 +9871,7 @@
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
-#line 9884 "configure"
+#line 9874 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11816,7 +11806,7 @@
;;
*-*-irix6*)
# Find out which ABI we are using.
- echo '#line 11819 "configure"' > conftest.$ac_ext
+ echo '#line 11809 "configure"' > conftest.$ac_ext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
@@ -13456,11 +13446,11 @@
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:13459: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:13449: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:13463: \$? = $ac_status" >&5
+ echo "$as_me:13453: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@@ -13724,11 +13714,11 @@
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:13727: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:13717: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:13731: \$? = $ac_status" >&5
+ echo "$as_me:13721: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@@ -13828,11 +13818,11 @@
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:13831: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:13821: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:13835: \$? = $ac_status" >&5
+ echo "$as_me:13825: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@@ -16136,7 +16126,7 @@
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
-#line 16139 "configure"
+#line 16129 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -16236,7 +16226,7 @@
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
-#line 16239 "configure"
+#line 16229 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -18572,11 +18562,11 @@
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:18575: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:18565: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:18579: \$? = $ac_status" >&5
+ echo "$as_me:18569: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@@ -18676,11 +18666,11 @@
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:18679: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:18669: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:18683: \$? = $ac_status" >&5
+ echo "$as_me:18673: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@@ -20246,11 +20236,11 @@
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:20249: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:20239: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:20253: \$? = $ac_status" >&5
+ echo "$as_me:20243: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@@ -20350,11 +20340,11 @@
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:20353: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:20343: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:20357: \$? = $ac_status" >&5
+ echo "$as_me:20347: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@@ -22553,11 +22543,11 @@
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:22556: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:22546: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:22560: \$? = $ac_status" >&5
+ echo "$as_me:22550: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@@ -22821,11 +22811,11 @@
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:22824: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:22814: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:22828: \$? = $ac_status" >&5
+ echo "$as_me:22818: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@@ -22925,11 +22915,11 @@
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:22928: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:22918: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:22932: \$? = $ac_status" >&5
+ echo "$as_me:22922: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@@ -32769,6 +32759,7 @@
LLVM_ON_UNIX!$LLVM_ON_UNIX$ac_delim
LLVM_ON_WIN32!$LLVM_ON_WIN32$ac_delim
ARCH!$ARCH$ac_delim
+ENDIAN!$ENDIAN$ac_delim
CC!$CC$ac_delim
CFLAGS!$CFLAGS$ac_delim
LDFLAGS!$LDFLAGS$ac_delim
@@ -32779,7 +32770,6 @@
CPP!$CPP$ac_delim
GREP!$GREP$ac_delim
EGREP!$EGREP$ac_delim
-ENDIAN!$ENDIAN$ac_delim
LLVM_CROSS_COMPILING!$LLVM_CROSS_COMPILING$ac_delim
BUILD_CC!$BUILD_CC$ac_delim
BUILD_EXEEXT!$BUILD_EXEEXT$ac_delim
Modified: llvm/trunk/include/llvm/Config/config.h.in
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Config/config.h.in?rev=44959&r1=44958&r2=44959&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Config/config.h.in (original)
+++ llvm/trunk/include/llvm/Config/config.h.in Wed Dec 12 17:03:45 2007
@@ -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
Added: llvm/trunk/include/llvm/System/Host.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/System/Host.h?rev=44959&view=auto
==============================================================================
--- llvm/trunk/include/llvm/System/Host.h (added)
+++ llvm/trunk/include/llvm/System/Host.h Wed Dec 12 17:03:45 2007
@@ -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
Modified: llvm/trunk/include/llvm/Target/TargetData.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetData.h?rev=44959&r1=44958&r2=44959&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Target/TargetData.h (original)
+++ llvm/trunk/include/llvm/Target/TargetData.h Wed Dec 12 17:03:45 2007
@@ -142,10 +142,6 @@
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.
Modified: llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp?rev=44959&r1=44958&r2=44959&view=diff
==============================================================================
--- llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp (original)
+++ llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp Wed Dec 12 17:03:45 2007
@@ -23,6 +23,7 @@
#include "llvm/Support/Debug.h"
#include "llvm/Support/MutexGuard.h"
#include "llvm/System/DynamicLibrary.h"
+#include "llvm/System/Host.h"
#include "llvm/Target/TargetData.h"
#include <math.h>
using namespace llvm;
@@ -637,7 +638,7 @@
uint8_t *Src = (uint8_t *)Val.IntVal.getRawData();
uint8_t *Dst = (uint8_t *)Ptr;
- if (getTargetData()->hostIsLittleEndian())
+ if (sys::littleEndianHost())
// Little-endian host - the source is ordered from LSB to MSB.
// Order the destination from LSB to MSB: Do a straight copy.
memcpy(Dst, Src, StoreBytes);
@@ -698,7 +699,7 @@
uint8_t *Src = (uint8_t *)Ptr;
uint8_t *Dst = (uint8_t *)Result.IntVal.getRawData();
- if (getTargetData()->hostIsLittleEndian())
+ if (sys::littleEndianHost())
// Little-endian host - the destination must be ordered from LSB to MSB.
// The source is ordered from LSB to MSB: Do a straight copy.
memcpy(Dst, Src, LoadBytes);
Modified: llvm/trunk/lib/Target/TargetData.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/TargetData.cpp?rev=44959&r1=44958&r2=44959&view=diff
==============================================================================
--- llvm/trunk/lib/Target/TargetData.cpp (original)
+++ llvm/trunk/lib/Target/TargetData.cpp Wed Dec 12 17:03:45 2007
@@ -25,7 +25,6 @@
#include "llvm/Support/ManagedStatic.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/StringExtras.h"
-#include "llvm/Config/config.h"
#include <algorithm>
#include <cstdlib>
#include <sstream>
@@ -133,14 +132,6 @@
// TargetData Class Implementation
//===----------------------------------------------------------------------===//
-bool TargetData::hostIsLittleEndian() const {
-#ifdef LSB_FIRST
- return true;
-#else
- return false;
-#endif
-}
-
/*!
A TargetDescription string consists of a sequence of hyphen-delimited
specifiers for target endianness, pointer size and alignments, and various
More information about the llvm-commits
mailing list