ivory-backend-c-0.1.0.0: Ivory C backend.

Safe HaskellNone

Ivory.Compile.C.Gen

Description

Ivory backend targeting language-c-quote.

Synopsis

Documentation

data Visibility Source

Constructors

Public 
Private 

compile :: Def a -> CompileSource

Compile a top-level element.

compileExtern :: Extern -> CompileSource

Compile an extern declaration

compileStruct :: Visibility -> Struct -> CompileSource

Compile a struct.

compileAreaImport :: AreaImport -> CompileSource

Compile an external memory area reference.

extractAreaProto :: Visibility -> Area -> CompileSource

Get prototypes for memory areas.

compileArea :: Visibility -> Area -> CompileSource

Compile a memory area definition into an extern in the header, and a structure in the source.

compileUnit :: Proc -> CompileSource

Compile a definition unit.

extractProto :: Visibility -> Proc -> CompileSource

Get the prototypes.

toArgs :: [Typed Var] -> [Param]Source

Argument conversion.

toType :: Type -> TypeSource

Type conversion outside of an assignment context. This converts arrays to arrays, and carrays to pointers.

toTypeAssign :: Type -> TypeSource

Type conversion in the context of an assignment. This converts all arrays/carrays to pointers.

toTypeCxt :: (Type -> Type) -> Type -> TypeSource

C type conversion, with a special case for references and pointers.

toName :: Name -> StringSource

Call Symbols

toVar :: Var -> StringSource

Variable name mangling.

toBody :: [Cond] -> Stmt -> [BlockItem]Source

Translate statements.

typedRet :: Typed Expr -> ExpSource

Return statement.

toExpr :: Type -> Expr -> ExpSource

Translate an expression.

mkArgs :: Type -> [Expr] -> [Exp]Source

absSym :: Type -> StringSource

Emit the function name for a call to abs. This doesn't include any symbol for unsigned things, as they should be optimized out by the front end.

signumSym :: Type -> StringSource

Emit the function name for a call to signum.

toEnsure :: Expr -> Cond -> BlockItemSource

Takes the return expression, the condition, and returns a BlockItem.