diff options
Diffstat (limited to 'compiler/llvmGen/Llvm')
-rw-r--r-- | compiler/llvmGen/Llvm/AbsSyn.hs | 10 | ||||
-rw-r--r-- | compiler/llvmGen/Llvm/MetaData.hs | 2 | ||||
-rw-r--r-- | compiler/llvmGen/Llvm/PpLlvm.hs | 4 | ||||
-rw-r--r-- | compiler/llvmGen/Llvm/Types.hs | 6 |
4 files changed, 17 insertions, 5 deletions
diff --git a/compiler/llvmGen/Llvm/AbsSyn.hs b/compiler/llvmGen/Llvm/AbsSyn.hs index 8f38c799c7..a89ee35706 100644 --- a/compiler/llvmGen/Llvm/AbsSyn.hs +++ b/compiler/llvmGen/Llvm/AbsSyn.hs @@ -4,6 +4,8 @@ module Llvm.AbsSyn where +import GhcPrelude + import Llvm.MetaData import Llvm.Types @@ -106,7 +108,7 @@ data LlvmAtomicOp -- | Llvm Statements data LlvmStatement {- | - Assign an expression to an variable: + Assign an expression to a variable: * dest: Variable to assign to * source: Source expression -} @@ -258,7 +260,7 @@ data LlvmExpression | ALoad LlvmSyncOrdering SingleThreaded LlvmVar {- | - Navigate in an structure, selecting elements + Navigate in a structure, selecting elements * inbound: Is the pointer inbounds? (computed pointer doesn't overflow) * ptr: Location of the structure * indexes: A list of indexes to select the correct value. @@ -323,8 +325,8 @@ data LlvmExpression basic block in a new variable of type tp. * tp: type of the merged variable, must match the types of the predecessor variables. - * precessors: A list of variables and the basic block that they originate - from. + * predecessors: A list of variables and the basic block that they originate + from. -} | Phi LlvmType [(LlvmVar,LlvmVar)] diff --git a/compiler/llvmGen/Llvm/MetaData.hs b/compiler/llvmGen/Llvm/MetaData.hs index 5fe9e37ddc..97e8086f42 100644 --- a/compiler/llvmGen/Llvm/MetaData.hs +++ b/compiler/llvmGen/Llvm/MetaData.hs @@ -2,6 +2,8 @@ module Llvm.MetaData where +import GhcPrelude + import Llvm.Types import Outputable diff --git a/compiler/llvmGen/Llvm/PpLlvm.hs b/compiler/llvmGen/Llvm/PpLlvm.hs index 293999bd1e..b350ab408d 100644 --- a/compiler/llvmGen/Llvm/PpLlvm.hs +++ b/compiler/llvmGen/Llvm/PpLlvm.hs @@ -25,6 +25,8 @@ module Llvm.PpLlvm ( #include "HsVersions.h" +import GhcPrelude + import Llvm.AbsSyn import Llvm.MetaData import Llvm.Types @@ -238,7 +240,7 @@ ppLlvmExpression expr Malloc tp amount -> ppMalloc tp amount AtomicRMW aop tgt src ordering -> ppAtomicRMW aop tgt src ordering CmpXChg addr old new s_ord f_ord -> ppCmpXChg addr old new s_ord f_ord - Phi tp precessors -> ppPhi tp precessors + Phi tp predecessors -> ppPhi tp predecessors Asm asm c ty v se sk -> ppAsm asm c ty v se sk MExpr meta expr -> ppMetaExpr meta expr diff --git a/compiler/llvmGen/Llvm/Types.hs b/compiler/llvmGen/Llvm/Types.hs index bf23cd89f7..bc7bbaab1b 100644 --- a/compiler/llvmGen/Llvm/Types.hs +++ b/compiler/llvmGen/Llvm/Types.hs @@ -8,6 +8,8 @@ module Llvm.Types where #include "HsVersions.h" +import GhcPrelude + import Data.Char import Data.Int import Numeric @@ -152,6 +154,7 @@ data LlvmStatic -- static expressions, could split out but leave -- for moment for ease of use. Not many of them. + | LMTrunc LlvmStatic LlvmType -- ^ Truncate | LMBitc LlvmStatic LlvmType -- ^ Pointer to Pointer conversion | LMPtoI LlvmStatic LlvmType -- ^ Pointer to Integer conversion | LMAdd LlvmStatic LlvmStatic -- ^ Constant addition operation @@ -165,6 +168,8 @@ instance Outputable LlvmStatic where ppr (LMStaticArray d t) = ppr t <> text " [" <> ppCommaJoin d <> char ']' ppr (LMStaticStruc d t) = ppr t <> text "<{" <> ppCommaJoin d <> text "}>" ppr (LMStaticPointer v) = ppr v + ppr (LMTrunc v t) + = ppr t <> text " trunc (" <> ppr v <> text " to " <> ppr t <> char ')' ppr (LMBitc v t) = ppr t <> text " bitcast (" <> ppr v <> text " to " <> ppr t <> char ')' ppr (LMPtoI v t) @@ -275,6 +280,7 @@ getStatType (LMStaticStr _ t) = t getStatType (LMStaticArray _ t) = t getStatType (LMStaticStruc _ t) = t getStatType (LMStaticPointer v) = getVarType v +getStatType (LMTrunc _ t) = t getStatType (LMBitc _ t) = t getStatType (LMPtoI _ t) = t getStatType (LMAdd t _) = getStatType t |