Add information for unimplemented codegen
This commit is contained in:
@@ -20,6 +20,7 @@ import qualified LLVM.AST.FloatingPointPredicate as FP
|
|||||||
|
|
||||||
import Control.Monad.State hiding (void)
|
import Control.Monad.State hiding (void)
|
||||||
|
|
||||||
|
import Data.Text.Prettyprint.Doc (pretty)
|
||||||
import Data.Text (Text, unpack)
|
import Data.Text (Text, unpack)
|
||||||
import Data.String.Conversions
|
import Data.String.Conversions
|
||||||
import Data.String
|
import Data.String
|
||||||
@@ -117,7 +118,7 @@ codegenLVal (Member (Id sName) field) = do
|
|||||||
gep struct [ConstantOperand (C.Int 32 0), ConstantOperand (C.Int 32 (fromIntegral offset))]
|
gep struct [ConstantOperand (C.Int 32 0), ConstantOperand (C.Int 32 (fromIntegral offset))]
|
||||||
Nothing -> error $ "Struct " ++ show sName ++ " not found"
|
Nothing -> error $ "Struct " ++ show sName ++ " not found"
|
||||||
|
|
||||||
codeGenLVal _ = error "Unimplemented or invalid LValue"
|
codegenLVal e = error $ "Unimplemented or invalid LValue " ++ show (pretty e) ++ " (" ++ show e ++ ")"
|
||||||
|
|
||||||
-- Given a struct and a field name, return the offset of the field in the struct.
|
-- Given a struct and a field name, return the offset of the field in the struct.
|
||||||
-- In LLVM each field is actually size 1
|
-- In LLVM each field is actually size 1
|
||||||
@@ -216,6 +217,8 @@ codegenExpr (Cast t e) = undefined -- TODO casts
|
|||||||
|
|
||||||
codegenExpr (Sizeof t) = ConstantOperand . C.Int 32 . fromIntegral <$> size t
|
codegenExpr (Sizeof t) = ConstantOperand . C.Int 32 . fromIntegral <$> size t
|
||||||
|
|
||||||
|
codegenExpr e = error $ "Unimplemented or invalid Expression " ++ show (pretty e) ++ " (" ++ show e ++ ")"
|
||||||
|
|
||||||
mkTerminator :: IRBuilder () -> IRBuilder ()
|
mkTerminator :: IRBuilder () -> IRBuilder ()
|
||||||
mkTerminator instr = do
|
mkTerminator instr = do
|
||||||
check <- hasTerminator
|
check <- hasTerminator
|
||||||
@@ -290,7 +293,7 @@ codegenStmt (Var name t (Just e)) = codegenStmt (Assign BaseAssign (Id name) e)
|
|||||||
-- This is because allocation is done already
|
-- This is because allocation is done already
|
||||||
codegenStmt (Var name _ Nothing) = return ()
|
codegenStmt (Var name _ Nothing) = return ()
|
||||||
|
|
||||||
codegenStmt s = error $ "Unimplemented or invalid statement " ++ show s
|
codegenStmt s = error $ "Unimplemented or invalid statement " ++ show (pretty s) ++ " (" ++ show s ++ ")"
|
||||||
|
|
||||||
-- Generate code for a function
|
-- Generate code for a function
|
||||||
-- First create the function, then allocate space for the arguments and locals
|
-- First create the function, then allocate space for the arguments and locals
|
||||||
|
|||||||
Reference in New Issue
Block a user