[commit: ghc] wip/kavon-nosplit-llvm: added support for insertvalue instruction (48797fd)

git at git.haskell.org git at git.haskell.org
Tue Jun 27 09:14:58 UTC 2017


Repository : ssh://git@git.haskell.org/ghc

On branch  : wip/kavon-nosplit-llvm
Link       : http://ghc.haskell.org/trac/ghc/changeset/48797fd24e22c63b6419b70df3160f8be60a075e/ghc

>---------------------------------------------------------------

commit 48797fd24e22c63b6419b70df3160f8be60a075e
Author: Kavon Farvardin <kavon at farvard.in>
Date:   Mon May 15 11:55:02 2017 +0100

    added support for insertvalue instruction


>---------------------------------------------------------------

48797fd24e22c63b6419b70df3160f8be60a075e
 compiler/llvmGen/Llvm/AbsSyn.hs | 9 ++++++++-
 compiler/llvmGen/Llvm/PpLlvm.hs | 8 ++++++++
 2 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/compiler/llvmGen/Llvm/AbsSyn.hs b/compiler/llvmGen/Llvm/AbsSyn.hs
index 45d79f5..e107cb2 100644
--- a/compiler/llvmGen/Llvm/AbsSyn.hs
+++ b/compiler/llvmGen/Llvm/AbsSyn.hs
@@ -241,6 +241,14 @@ data LlvmExpression
   | Insert LlvmVar LlvmVar LlvmVar
   
   {- |
+    Insert a scalar element into a structure
+      * val:   The structure
+      * elt:   The scalar to insert
+      * index: The index at which to insert within the structure
+  -}
+  | InsertV LlvmVar LlvmVar Int
+
+  {- |
     Allocate amount * sizeof(tp) bytes on the heap
       * tp:     LlvmType to reserve room for
       * amount: The nr of tp's which must be allocated
@@ -347,4 +355,3 @@ data LlvmExpression
   | MExpr [MetaAnnot] LlvmExpression
 
   deriving (Eq)
-
diff --git a/compiler/llvmGen/Llvm/PpLlvm.hs b/compiler/llvmGen/Llvm/PpLlvm.hs
index 293999b..5812340 100644
--- a/compiler/llvmGen/Llvm/PpLlvm.hs
+++ b/compiler/llvmGen/Llvm/PpLlvm.hs
@@ -232,6 +232,7 @@ ppLlvmExpression expr
         Extract    vec idx          -> ppExtract vec idx
         ExtractV   struct idx       -> ppExtractV struct idx
         Insert     vec elt idx      -> ppInsert vec elt idx
+        InsertV    struct elt idx   -> ppInsertV struct elt idx
         GetElemPtr inb ptr indexes  -> ppGetElementPtr inb ptr indexes
         Load       ptr              -> ppLoad ptr
         ALoad      ord st ptr       -> ppALoad ord st ptr
@@ -466,6 +467,13 @@ ppInsert vec elt idx =
     <+> ppr (getVarType elt) <+> ppName elt <> comma
     <+> ppr idx
     
+ppInsertV :: LlvmVar -> LlvmVar -> Int -> SDoc
+ppInsertV struct elt idx =
+    text "insertvalue"
+    <+> ppr (getVarType struct) <+> ppName struct <> comma
+    <+> ppr (getVarType elt) <+> ppName elt <> comma
+    <+> ppr idx
+
 
 ppMetaStatement :: [MetaAnnot] -> LlvmStatement -> SDoc
 ppMetaStatement meta stmt = ppLlvmStatement stmt <> ppMetaAnnots meta



More information about the ghc-commits mailing list