diff options
author | Ian Lynagh <ian@well-typed.com> | 2012-09-16 14:03:58 +0100 |
---|---|---|
committer | Ian Lynagh <ian@well-typed.com> | 2012-09-16 14:03:58 +0100 |
commit | a62b56ef0b9d1750289ffd3f77b578dc73452374 (patch) | |
tree | 57faa02949547782417d970639588ad276429fd7 /compiler/llvmGen/Llvm/Types.hs | |
parent | 7f5af24fb2af9b0469c79180c72d78cb12e7358f (diff) | |
download | haskell-a62b56ef0b9d1750289ffd3f77b578dc73452374.tar.gz |
Pass DynFlags down to llvmWord
Diffstat (limited to 'compiler/llvmGen/Llvm/Types.hs')
-rw-r--r-- | compiler/llvmGen/Llvm/Types.hs | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/compiler/llvmGen/Llvm/Types.hs b/compiler/llvmGen/Llvm/Types.hs index 35de40bdc4..6414501310 100644 --- a/compiler/llvmGen/Llvm/Types.hs +++ b/compiler/llvmGen/Llvm/Types.hs @@ -12,6 +12,7 @@ import Data.List (intercalate) import Numeric import Constants +import DynFlags import FastString import Unique @@ -325,21 +326,21 @@ isGlobal (LMGlobalVar _ _ _ _ _ _) = True isGlobal _ = False -- | Width in bits of an 'LlvmType', returns 0 if not applicable -llvmWidthInBits :: LlvmType -> Int -llvmWidthInBits (LMInt n) = n -llvmWidthInBits (LMFloat) = 32 -llvmWidthInBits (LMDouble) = 64 -llvmWidthInBits (LMFloat80) = 80 -llvmWidthInBits (LMFloat128) = 128 +llvmWidthInBits :: DynFlags -> LlvmType -> Int +llvmWidthInBits _ (LMInt n) = n +llvmWidthInBits _ (LMFloat) = 32 +llvmWidthInBits _ (LMDouble) = 64 +llvmWidthInBits _ (LMFloat80) = 80 +llvmWidthInBits _ (LMFloat128) = 128 -- Could return either a pointer width here or the width of what -- it points to. We will go with the former for now. -llvmWidthInBits (LMPointer _) = llvmWidthInBits llvmWord -llvmWidthInBits (LMArray _ _) = llvmWidthInBits llvmWord -llvmWidthInBits LMLabel = 0 -llvmWidthInBits LMVoid = 0 -llvmWidthInBits (LMStruct tys) = sum $ map llvmWidthInBits tys -llvmWidthInBits (LMFunction _) = 0 -llvmWidthInBits (LMAlias (_,t)) = llvmWidthInBits t +llvmWidthInBits dflags (LMPointer _) = llvmWidthInBits dflags (llvmWord dflags) +llvmWidthInBits dflags (LMArray _ _) = llvmWidthInBits dflags (llvmWord dflags) +llvmWidthInBits _ LMLabel = 0 +llvmWidthInBits _ LMVoid = 0 +llvmWidthInBits dflags (LMStruct tys) = sum $ map (llvmWidthInBits dflags) tys +llvmWidthInBits _ (LMFunction _) = 0 +llvmWidthInBits dflags (LMAlias (_,t)) = llvmWidthInBits dflags t -- ----------------------------------------------------------------------------- @@ -356,9 +357,9 @@ i1 = LMInt 1 i8Ptr = pLift i8 -- | The target architectures word size -llvmWord, llvmWordPtr :: LlvmType -llvmWord = LMInt (wORD_SIZE * 8) -llvmWordPtr = pLift llvmWord +llvmWord, llvmWordPtr :: DynFlags -> LlvmType +llvmWord _ = LMInt (wORD_SIZE * 8) +llvmWordPtr dflags = pLift (llvmWord dflags) -- ----------------------------------------------------------------------------- -- * LLVM Function Types |