diff options
author | Stefan Schulze Frielinghaus <stefansf@linux.ibm.com> | 2019-11-25 12:20:18 +0100 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2020-01-06 23:00:04 -0500 |
commit | f3560a3a85404fc9998f626a1434205f7bb4a2a6 (patch) | |
tree | 06865a904145b07b40a8e984b19a4e68038a0c6c | |
parent | 4cfdeafd9b2342ba0b2bb2015b67663e7caa1bf2 (diff) | |
download | haskell-f3560a3a85404fc9998f626a1434205f7bb4a2a6.tar.gz |
Fix endian handling of LLVM backend
Get rid of CPP macro WORDS_BIGENDIAN which is not defined anymore, and
replace it by DynFlag. This fixes partially #17337.
(cherry picked from commit 6c59cc71dc20f26d5a6650b16a82faeae72f2065)
-rw-r--r-- | compiler/llvmGen/Llvm/Types.hs | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/compiler/llvmGen/Llvm/Types.hs b/compiler/llvmGen/Llvm/Types.hs index 6e349d813f..f477aa64ed 100644 --- a/compiler/llvmGen/Llvm/Types.hs +++ b/compiler/llvmGen/Llvm/Types.hs @@ -843,8 +843,10 @@ ppDouble d [x,y] -> [x,y] _ -> error "dToStr: too many hex digits for float" - str = map toUpper $ concat $ fixEndian $ map hex bs - in text "0x" <> text str + in sdocWithDynFlags (\dflags -> + let fixEndian = if wORDS_BIGENDIAN dflags then id else reverse + str = map toUpper $ concat $ fixEndian $ map hex bs + in text "0x" <> text str) -- Note [LLVM Float Types] -- ~~~~~~~~~~~~~~~~~~~~~~~ @@ -874,14 +876,6 @@ widenFp = float2Double ppFloat :: Float -> SDoc ppFloat = ppDouble . widenFp --- | Reverse or leave byte data alone to fix endianness on this target. -fixEndian :: [a] -> [a] -#if defined(WORDS_BIGENDIAN) -fixEndian = id -#else -fixEndian = reverse -#endif - -------------------------------------------------------------------------------- -- * Misc functions |