Add missing ptr null to constructors with no arguments (e.g. Nil)

This commit is contained in:
Martin Fredin 2023-05-14 13:24:18 +02:00
parent 86256066b6
commit 2d41dac6eb

View file

@ -17,13 +17,13 @@ import Control.Monad.State (gets, modify)
import Data.Char (ord) import Data.Char (ord)
import Data.Coerce (coerce) import Data.Coerce (coerce)
import Data.Foldable.Extra (notNull) import Data.Foldable.Extra (notNull)
import Data.List (isPrefixOf)
import qualified Data.Map as Map import qualified Data.Map as Map
import Data.Maybe (fromJust, fromMaybe, isNothing) import Data.Maybe (fromJust, fromMaybe, isNothing)
import Data.Tuple.Extra (second) import Data.Tuple.Extra (second)
import Debug.Trace (traceShow)
import Grammar.Print (printTree) import Grammar.Print (printTree)
import Monomorphizer.MonomorphizerIr import Monomorphizer.MonomorphizerIr
import Debug.Trace (traceShow)
import Data.List (isPrefixOf)
compileScs :: [Def] -> CompilerState () compileScs :: [Def] -> CompilerState ()
@ -205,7 +205,7 @@ firstMainContent True =
firstMainContent False = [] firstMainContent False = []
lastMainContent :: Bool -> [LLVMIr] lastMainContent :: Bool -> [LLVMIr]
lastMainContent True = [UnsafeRaw "call void @cheap_dispose()\n"] lastMainContent True = [UnsafeRaw "call void @cheap_dispose()\n"]
lastMainContent False =[] lastMainContent False =[]
compileExp :: T Exp -> CompilerState () compileExp :: T Exp -> CompilerState ()
@ -480,7 +480,7 @@ exprToValue et@(e, t) = case e of
pure $ VIdent vc (type2LlvmType t) pure $ VIdent vc (type2LlvmType t)
| otherwise -> pure $ VFunction name Global (type2LlvmType t) | otherwise -> pure $ VFunction name Global (type2LlvmType t)
where where
call = Call FastCC (type2LlvmType t) Global name [] call = Call FastCC (type2LlvmType t) Global name [(Ptr, VNull)]
Nothing -> gets $ val Nothing -> gets $ val
. fromJust . fromJust