summaryrefslogtreecommitdiff
path: root/compiler/llvmGen
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/llvmGen')
-rw-r--r--compiler/llvmGen/LlvmCodeGen/Base.hs3
-rw-r--r--compiler/llvmGen/LlvmCodeGen/Data.hs8
2 files changed, 10 insertions, 1 deletions
diff --git a/compiler/llvmGen/LlvmCodeGen/Base.hs b/compiler/llvmGen/LlvmCodeGen/Base.hs
index 45f20d7f7f..1457efe3cb 100644
--- a/compiler/llvmGen/LlvmCodeGen/Base.hs
+++ b/compiler/llvmGen/LlvmCodeGen/Base.hs
@@ -70,7 +70,8 @@ type UnresStatic = Either UnresLabel LlvmStatic
-- | Translate a basic CmmType to an LlvmType.
cmmToLlvmType :: CmmType -> LlvmType
-cmmToLlvmType ty | isFloatType ty = widthToLlvmFloat $ typeWidth ty
+cmmToLlvmType ty | isVecType ty = LMVector (vecLength ty) (cmmToLlvmType (vecElemType ty))
+ | isFloatType ty = widthToLlvmFloat $ typeWidth ty
| otherwise = widthToLlvmInt $ typeWidth ty
-- | Translate a Cmm Float Width to a LlvmType.
diff --git a/compiler/llvmGen/LlvmCodeGen/Data.hs b/compiler/llvmGen/LlvmCodeGen/Data.hs
index fd0d7ccd99..83b5453aa9 100644
--- a/compiler/llvmGen/LlvmCodeGen/Data.hs
+++ b/compiler/llvmGen/LlvmCodeGen/Data.hs
@@ -171,6 +171,14 @@ genStaticLit (CmmInt i w)
genStaticLit (CmmFloat r w)
= Right $ LMStaticLit (LMFloatLit (fromRational r) (widthToLlvmFloat w))
+genStaticLit (CmmVec ls)
+ = Right $ LMStaticLit (LMVectorLit (map toLlvmLit ls))
+ where
+ toLlvmLit :: CmmLit -> LlvmLit
+ toLlvmLit lit = case genStaticLit lit of
+ Right (LMStaticLit llvmLit) -> llvmLit
+ _ -> panic "genStaticLit"
+
-- Leave unresolved, will fix later
genStaticLit c@(CmmLabel _ ) = Left $ c
genStaticLit c@(CmmLabelOff _ _) = Left $ c