Go to the documentation of this file.
14 #ifndef LLVM_SUPPORT_SWAPBYTEORDER_H
15 #define LLVM_SUPPORT_SWAPBYTEORDER_H
19 #include <type_traits>
20 #if defined(_MSC_VER) && !defined(_DEBUG)
24 #if defined(__linux__) || defined(__GNU__) || defined(__HAIKU__) || \
25 defined(__Fuchsia__) || defined(__EMSCRIPTEN__)
28 #include <sys/machine.h>
31 #include <sys/types.h>
32 #define BIG_ENDIAN 4321
33 #define LITTLE_ENDIAN 1234
34 #if defined(_BIG_ENDIAN)
35 #define BYTE_ORDER BIG_ENDIAN
37 #define BYTE_ORDER LITTLE_ENDIAN
39 #elif defined(__MVS__)
40 #define BIG_ENDIAN 4321
41 #define LITTLE_ENDIAN 1234
42 #define BYTE_ORDER BIG_ENDIAN
44 #if !defined(BYTE_ORDER) && !defined(_WIN32)
45 #include <machine/endian.h>
54 #if defined(_MSC_VER) && !defined(_DEBUG)
57 return _byteswap_ushort(value);
67 #if defined(__llvm__) || (defined(__GNUC__) && !defined(__ICC))
68 return __builtin_bswap32(value);
69 #elif defined(_MSC_VER) && !defined(_DEBUG)
70 return _byteswap_ulong(value);
76 return (Byte0 << 24) | (Byte1 << 8) | (Byte2 >> 8) | (Byte3 >> 24);
82 #if defined(__llvm__) || (defined(__GNUC__) && !defined(__ICC))
83 return __builtin_bswap64(value);
84 #elif defined(_MSC_VER) && !defined(_DEBUG)
85 return _byteswap_uint64(value);
89 return (Hi << 32) | Lo;
95 #if defined(BYTE_ORDER) && defined(BIG_ENDIAN) && BYTE_ORDER == BIG_ENDIAN
151 template <
typename T>
153 return static_cast<T>(
This is an optimization pass for GlobalISel generic memory operations.
constexpr bool IsBigEndianHost
void swapByteOrder(T &Value)
Itanium Name Demangler i e convert the string _Z1fv into f()". You can also use the CRTP base ManglingParser to perform some simple analysis on the mangled name
(vector float) vec_cmpeq(*A, *B) C
uint64_t ByteSwap_64(uint64_t value)
This function returns a byte-swapped representation of the 64-bit argument.
The object format emitted by the WebAssembly backed is documented in
unsigned char getSwappedBytes(unsigned char C)
uint16_t ByteSwap_16(uint16_t value)
ByteSwap_16 - This function returns a byte-swapped representation of the 16-bit argument.
static const bool IsLittleEndianHost
uint32_t ByteSwap_32(uint32_t value)
This function returns a byte-swapped representation of the 32-bit argument.
the resulting code requires compare and branches when and if the revised code is with conditional branches instead of More there is a byte word extend before each where there should be only and the condition codes are not remembered when the same two values are compared twice More LSR enhancements i8 and i32 load store addressing modes are identical int int int d
LLVM Value Representation.