aboutsummaryrefslogtreecommitdiff
path: root/Sil/Types.dcl
diff options
context:
space:
mode:
authorCamil Staps2017-07-24 18:22:04 +0200
committerCamil Staps2017-07-24 18:22:04 +0200
commitdcc9dd17186907d105cf01358b39e1551c0fc874 (patch)
tree7806814445ee9b7b7a7992882866445bea746e71 /Sil/Types.dcl
parentOptimisations (diff)
Use B-stack for basic arguments (not locals): resolve #9
Diffstat (limited to 'Sil/Types.dcl')
-rw-r--r--Sil/Types.dcl17
1 files changed, 15 insertions, 2 deletions
diff --git a/Sil/Types.dcl b/Sil/Types.dcl
index 5fd159e..d44a373 100644
--- a/Sil/Types.dcl
+++ b/Sil/Types.dcl
@@ -1,10 +1,12 @@
definition module Sil.Types
-from StdOverloaded import class ==, class toString, class zero
+from StdOverloaded import class ==, class +, class toString, class zero
from Data.Error import :: MaybeError
from Data.Maybe import :: Maybe
+from ABC.Assembler import :: BasicType
+
from Sil.Syntax import :: Expression, :: Function, :: Name, :: Op1, :: Op2
:: Type
@@ -16,15 +18,26 @@ from Sil.Syntax import :: Expression, :: Function, :: Name, :: Op1, :: Op2
:: TypeError
= IllegalApplication Type Type
+:: TypeSize =
+ { asize :: Int
+ , bsize :: Int
+ , btypes :: [BasicType]
+ }
+
instance == Type
instance toString Type
instance toString TypeError
+instance zero TypeSize
+
/**
* Size of an expression on the stack
*/
-typeSize :: Type -> Int
+typeSize :: Type -> TypeSize
+
+(+~) infixl 6 :: TypeSize TypeSize -> TypeSize
+(-~) infixl 6 :: TypeSize TypeSize -> TypeSize
:: TypeResolver :== Name -> Maybe (MaybeError TypeError Type)