mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-27 13:30:05 +00:00
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
This commit is contained in:
parent
8d2ed33f6f
commit
67f1c493d1
@ -227,10 +227,7 @@ dnl Define a substitution, ARCH, for the target architecture
|
||||
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
|
||||
|
62
configure
vendored
62
configure
vendored
@ -828,6 +828,7 @@ NOLINKALL
|
||||
LLVM_ON_UNIX
|
||||
LLVM_ON_WIN32
|
||||
ARCH
|
||||
ENDIAN
|
||||
CC
|
||||
CFLAGS
|
||||
LDFLAGS
|
||||
@ -838,7 +839,6 @@ OBJEXT
|
||||
CPP
|
||||
GREP
|
||||
EGREP
|
||||
ENDIAN
|
||||
LLVM_CROSS_COMPILING
|
||||
BUILD_CC
|
||||
BUILD_EXEEXT
|
||||
@ -4183,19 +4183,9 @@ echo "${ECHO_T}$ac_cv_c_bigendian" >&6; }
|
||||
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 @@ else
|
||||
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 @@ ia64-*-hpux*)
|
||||
;;
|
||||
*-*-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 @@ else
|
||||
-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 @@ else
|
||||
-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 @@ else
|
||||
-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 @@ else
|
||||
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 @@ else
|
||||
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 @@ else
|
||||
-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 @@ else
|
||||
-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 @@ else
|
||||
-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 @@ else
|
||||
-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 @@ else
|
||||
-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 @@ else
|
||||
-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 @@ else
|
||||
-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 @@ NOLINKALL!$NOLINKALL$ac_delim
|
||||
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 @@ OBJEXT!$OBJEXT$ac_delim
|
||||
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
|
||||
|
@ -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
|
||||
|
36
include/llvm/System/Host.h
Normal file
36
include/llvm/System/Host.h
Normal file
@ -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
|
@ -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.
|
||||
|
@ -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 @@ void ExecutionEngine::StoreValueToMemory(const GenericValue &Val, GenericValue *
|
||||
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 @@ void ExecutionEngine::LoadValueFromMemory(GenericValue &Result,
|
||||
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);
|
||||
|
@ -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 @@ const TargetAlignElem TargetData::InvalidAlignmentElem =
|
||||
// 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
|
||||
|
Loading…
Reference in New Issue
Block a user