LLVM_ON_UNIX
LLVM_ON_WIN32
ARCH
-ENDIAN
CC
CFLAGS
LDFLAGS
CPP
GREP
EGREP
+ENDIAN
LLVM_CROSS_COMPILING
BUILD_CC
BUILD_EXEEXT
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
fi
- if test x"${enable_ltdl_install-no}" != xno; then
+
+
+if test x"${enable_ltdl_install-no}" != xno; then
INSTALL_LTDL_TRUE=
INSTALL_LTDL_FALSE='#'
else
INSTALL_LTDL_FALSE=
fi
- if test x"${enable_ltdl_convenience-no}" != xno; then
+
+
+if test x"${enable_ltdl_convenience-no}" != xno; then
CONVENIENCE_LTDL_TRUE=
CONVENIENCE_LTDL_FALSE='#'
else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
-#line 9870 "configure"
+#line 9884 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
;;
*-*-irix6*)
# Find out which ABI we are using.
- echo '#line 11805 "configure"' > conftest.$ac_ext
+ echo '#line 11819 "configure"' > conftest.$ac_ext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
-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:13445: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:13459: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:13449: \$? = $ac_status" >&5
+ echo "$as_me:13463: \$? = $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.
-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:13713: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:13727: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:13717: \$? = $ac_status" >&5
+ echo "$as_me:13731: \$? = $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.
-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:13817: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:13831: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:13821: \$? = $ac_status" >&5
+ echo "$as_me:13835: \$? = $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
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
-#line 16125 "configure"
+#line 16139 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<EOF
-#line 16225 "configure"
+#line 16239 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
-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:18561: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:18575: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:18565: \$? = $ac_status" >&5
+ echo "$as_me:18579: \$? = $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.
-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:18665: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:18679: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:18669: \$? = $ac_status" >&5
+ echo "$as_me:18683: \$? = $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
-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:20235: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:20249: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:20239: \$? = $ac_status" >&5
+ echo "$as_me:20253: \$? = $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.
-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:20339: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:20353: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:20343: \$? = $ac_status" >&5
+ echo "$as_me:20357: \$? = $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
-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:22542: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:22556: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:22546: \$? = $ac_status" >&5
+ echo "$as_me:22560: \$? = $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.
-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:22810: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:22824: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:22814: \$? = $ac_status" >&5
+ echo "$as_me:22828: \$? = $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.
-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:22914: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:22928: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:22918: \$? = $ac_status" >&5
+ echo "$as_me:22932: \$? = $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
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
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
switch (Ty->getTypeID()) {
case Type::IntegerTyID: {
unsigned BitWidth = cast<IntegerType>(Ty)->getBitWidth();
- GenericValue TmpVal = Val;
- if (BitWidth <= 8)
- *((uint8_t*)Ptr) = uint8_t(Val.IntVal.getZExtValue());
- else if (BitWidth <= 16) {
- *((uint16_t*)Ptr) = uint16_t(Val.IntVal.getZExtValue());
- } else if (BitWidth <= 32) {
- *((uint32_t*)Ptr) = uint32_t(Val.IntVal.getZExtValue());
- } else if (BitWidth <= 64) {
- *((uint64_t*)Ptr) = uint64_t(Val.IntVal.getZExtValue());
- } else {
- uint64_t *Dest = (uint64_t*)Ptr;
- const uint64_t *Src = Val.IntVal.getRawData();
- for (uint32_t i = 0; i < Val.IntVal.getNumWords(); ++i)
- Dest[i] = Src[i];
+ unsigned StoreBytes = (BitWidth + 7)/8;
+ uint8_t *Src = (uint8_t *)Val.IntVal.getRawData();
+ uint8_t *Dst = (uint8_t *)Ptr;
+
+ if (getTargetData()->hostIsLittleEndian())
+ // 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);
+ else {
+ // Big-endian host - the source is an array of 64 bit words ordered from
+ // LSW to MSW. Each word is ordered from MSB to LSB.
+ // Order the destination from MSB to LSB: Reverse the word order, but not
+ // the bytes in a word.
+ while (StoreBytes > sizeof(uint64_t)) {
+ StoreBytes -= sizeof(uint64_t);
+ // May not be aligned so use memcpy.
+ memcpy(Dst + StoreBytes, Src, sizeof(uint64_t));
+ Src += sizeof(uint64_t);
+ }
+
+ memcpy(Dst, Src + sizeof(uint64_t) - StoreBytes, StoreBytes);
}
break;
}
switch (Ty->getTypeID()) {
case Type::IntegerTyID: {
unsigned BitWidth = cast<IntegerType>(Ty)->getBitWidth();
- if (BitWidth <= 8)
- Result.IntVal = APInt(BitWidth, *((uint8_t*)Ptr));
- else if (BitWidth <= 16) {
- Result.IntVal = APInt(BitWidth, *((uint16_t*)Ptr));
- } else if (BitWidth <= 32) {
- Result.IntVal = APInt(BitWidth, *((uint32_t*)Ptr));
- } else if (BitWidth <= 64) {
- Result.IntVal = APInt(BitWidth, *((uint64_t*)Ptr));
- } else
- Result.IntVal = APInt(BitWidth, (BitWidth+63)/64, (uint64_t*)Ptr);
+ unsigned LoadBytes = (BitWidth + 7)/8;
+
+ // An APInt with all words initially zero.
+ Result.IntVal = APInt(BitWidth, 0);
+
+ uint8_t *Src = (uint8_t *)Ptr;
+ uint8_t *Dst = (uint8_t *)Result.IntVal.getRawData();
+
+ if (getTargetData()->hostIsLittleEndian())
+ // 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);
+ else {
+ // Big-endian - the destination is an array of 64 bit words ordered from
+ // LSW to MSW. Each word must be ordered from MSB to LSB. The source is
+ // ordered from MSB to LSB: Reverse the word order, but not the bytes in
+ // a word.
+ while (LoadBytes > sizeof(uint64_t)) {
+ LoadBytes -= sizeof(uint64_t);
+ // May not be aligned so use memcpy.
+ memcpy(Dst, Src + LoadBytes, sizeof(uint64_t));
+ Dst += sizeof(uint64_t);
+ }
+
+ memcpy(Dst + sizeof(uint64_t) - LoadBytes, Src, LoadBytes);
+ }
break;
}
case Type::FloatTyID: