language-c-0.10.1: Analysis and generation of C code

Safe Haskell | None
Language | Haskell2010

Language.C.Analysis.ConstEval

Synopsis

- data MachineDesc = MachineDesc {
  - iSize :: IntType -> Integer
  - fSize :: FloatType -> Integer
  - builtinSize :: BuiltinType -> Integer
  - ptrSize :: Integer
  - voidSize :: Integer
  - iAlign :: IntType -> Integer
  - fAlign :: FloatType -> Integer
  - builtinAlign :: BuiltinType -> Integer
  - ptrAlign :: Integer
  - voidAlign :: Integer
  }
- intExpr :: (Pos n, MonadName m) => n -> Integer -> m CExpr
- sizeofType :: (MonadTrav m, CNode n) => MachineDesc -> n -> Type -> m Integer
- alignofType :: (MonadTrav m, CNode n) => MachineDesc -> n -> Type -> m Integer
- compSizeAndAlign :: MonadTrav m => MachineDesc -> CompTypeRef -> m (Integer, Integer)
- roundToAlignment :: Integer -> Integer -> Integer
- intOp :: CBinaryOp -> Integer -> Integer -> Integer
- intUnOp :: CUnaryOp -> Integer -> Maybe Integer
- withWordBytes :: Int -> Integer -> Integer
- boolValue :: CExpr -> Maybe Bool
- intValue :: CExpr -> Maybe Integer
- constEval :: MonadTrav m => MachineDesc -> Map Ident CExpr -> CExpr -> m CExpr

# Documentation

data MachineDesc Source #

Constructors

MachineDesc |

Fields

- iSize :: IntType -> Integer
- fSize :: FloatType -> Integer
- builtinSize :: BuiltinType -> Integer
- ptrSize :: Integer
- voidSize :: Integer
- iAlign :: IntType -> Integer
- fAlign :: FloatType -> Integer
- builtinAlign :: BuiltinType -> Integer
- ptrAlign :: Integer
- voidAlign :: Integer

intExpr :: (Pos n, MonadName m) => n -> Integer -> m CExpr Source #

sizeofType :: (MonadTrav m, CNode n) => MachineDesc -> n -> Type -> m Integer Source #

alignofType :: (MonadTrav m, CNode n) => MachineDesc -> n -> Type -> m Integer Source #

compSizeAndAlign Source #

Arguments

:: MonadTrav m |
=> MachineDesc |
-> CompTypeRef |
-> m (Integer, Integer) | (size, alignment)

roundToAlignment Source #

Arguments

:: Integer | The alignment
-> Integer | The value to align
-> Integer | The next multiple of alignment

Find the next multiple of an alignment

intOp :: CBinaryOp -> Integer -> Integer -> Integer Source #

intUnOp :: CUnaryOp -> Integer -> Maybe Integer Source #

withWordBytes :: Int -> Integer -> Integer Source #

boolValue :: CExpr -> Maybe Bool Source #

intValue :: CExpr -> Maybe Integer Source #

constEval :: MonadTrav m => MachineDesc -> Map Ident CExpr -> CExpr -> m CExpr Source #