Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
Sutori.TAC
Description
- data TACTable = TACTable {
- tacInstructions :: [Int]
- tacTriplets :: [TAC]
- tacFunctions :: Map SutID Int
- tacLabels :: Map Int Int
- data TACAddress
- data TACType
- data TAC
- addTAC :: TAC -> SutMonad TACAddress
- genCode :: SutMonad TACTable
Documentation
The actual generated code is a list of instruction triplets and a list of pointers to them
Constructors
TACTable | Maps inc labels to their instruction number |
Fields
|
data TACAddress Source #
TACAddress for TAC Instructions
Constructors
TACGlobal SutID | An actual ID from the source code. Used for global (scope 0) variables |
TACOffset Int | An offset from the current frame pointer |
TACLit SutLiteral | A literal value either explicit in the source code or calculated on the run. |
TACID Int | The TAC number that calculated the relevant expression. |
TACLabel Int | An incremental label to some code. |
TACFun SutID | A function name/label |
Instances
A TAC Instruction to be appended to the generated intermediate code
Constructors
Basic | For simple expressions. |
Fields
| |
SysCall | Perform a syscall (IO, Mem, else) |
Copy | Copy operation, from a address to another |
Addr | Address for an indirection |
Jump | Unconditional jump, just where to. |
JumpUnless | Condition jump |
Pointed | Assign an address from a indirect pointer. |
Param | Stack a function parameter |
Call | Call a function of so many (already stacked) parameters |
Return | Return from a function (possibly a value). |
TAC Instruction