ghc-7.0.4: The GHC API

LlvmCodeGen.Base

Description

Base LLVM Code Generation module

Contains functions useful through out the code generator.

Synopsis

- type LlvmCmmTop = GenCmmTop LlvmData [CmmStatic] (ListGraph LlvmStatement)
- type LlvmBasicBlock = GenBasicBlock LlvmStatement
- type LlvmUnresData = (CLabel, Section, LlvmType, [UnresStatic])
- type LlvmData = ([LMGlobal], [LlvmType])
- type UnresLabel = CmmLit
- type UnresStatic = Either UnresLabel LlvmStatic
- type LlvmEnv = (LlvmEnvMap, LlvmEnvMap)
- initLlvmEnv :: LlvmEnv
- clearVars :: LlvmEnv -> LlvmEnv
- varLookup :: Uniquable key => key -> LlvmEnv -> Maybe LlvmType
- varInsert :: Uniquable key => key -> LlvmType -> LlvmEnv -> LlvmEnv
- funLookup :: Uniquable key => key -> LlvmEnv -> Maybe LlvmType
- funInsert :: Uniquable key => key -> LlvmType -> LlvmEnv -> LlvmEnv
- cmmToLlvmType :: CmmType -> LlvmType
- widthToLlvmFloat :: Width -> LlvmType
- widthToLlvmInt :: Width -> LlvmType
- llvmFunTy :: LlvmType
- llvmFunSig :: CLabel -> LlvmLinkageType -> LlvmFunctionDecl
- llvmStdFunAttrs :: [LlvmFuncAttr]
- llvmFunAlign :: LMAlign
- llvmInfAlign :: LMAlign
- llvmPtrBits :: Int
- mkLlvmFunc :: CLabel -> LlvmLinkageType -> LMSection -> LlvmBlocks -> LlvmFunction
- tysToParams :: [LlvmType] -> [LlvmParameter]
- strCLabel_llvm :: CLabel -> LMString
- genCmmLabelRef :: CLabel -> LMGlobal
- genStringLabelRef :: LMString -> LMGlobal

# Documentation

type LlvmCmmTop = GenCmmTop LlvmData [CmmStatic] (ListGraph LlvmStatement)Source

type LlvmBasicBlock = GenBasicBlock LlvmStatement Source

type LlvmUnresData = (CLabel, Section, LlvmType, [UnresStatic])Source

Unresolved code. Of the form: (data label, data type, unresolved data)

type LlvmData = ([LMGlobal], [LlvmType])Source

Top level LLVM Data (globals and type aliases)

type UnresLabel = CmmLit Source

An unresolved Label.

Labels are unresolved when we haven't yet determined if they are defined in the module we are currently compiling, or an external one.

type UnresStatic = Either UnresLabel LlvmStatic Source

type LlvmEnv = (LlvmEnvMap, LlvmEnvMap)Source

initLlvmEnv :: LlvmEnv Source

Get initial Llvm environment.

clearVars :: LlvmEnv -> LlvmEnv Source

Clear variables from the environment.

varLookup :: Uniquable key => key -> LlvmEnv -> Maybe LlvmType Source

varInsert :: Uniquable key => key -> LlvmType -> LlvmEnv -> LlvmEnv Source

funLookup :: Uniquable key => key -> LlvmEnv -> Maybe LlvmType Source

Lookup functions in the environment.

funInsert :: Uniquable key => key -> LlvmType -> LlvmEnv -> LlvmEnv Source

Insert functions into the environment.

cmmToLlvmType :: CmmType -> LlvmType Source

Translate a basic CmmType to an LlvmType.

widthToLlvmFloat :: Width -> LlvmType Source

Translate a Cmm Float Width to a LlvmType.

widthToLlvmInt :: Width -> LlvmType Source

Translate a Cmm Bit Width to a LlvmType.

llvmFunTy :: LlvmType Source

Llvm Function type for Cmm function

llvmFunSig :: CLabel -> LlvmLinkageType -> LlvmFunctionDecl Source

Llvm Function signature

llvmStdFunAttrs :: [LlvmFuncAttr]Source

Llvm standard fun attributes

llvmFunAlign :: LMAlign Source

Alignment to use for functions

llvmInfAlign :: LMAlign Source

Alignment to use for into tables

llvmPtrBits :: Int Source

Pointer width

mkLlvmFunc :: CLabel -> LlvmLinkageType -> LMSection -> LlvmBlocks -> LlvmFunction Source

Create a Haskell function in LLVM.

tysToParams :: [LlvmType] -> [LlvmParameter]Source

Convert a list of types to a list of function parameters (each with no parameter attributes)

strCLabel_llvm :: CLabel -> LMString Source

Pretty print a `CLabel`.

genCmmLabelRef :: CLabel -> LMGlobal Source

Create an external definition for a `CLabel` defined in another module.

genStringLabelRef :: LMString -> LMGlobal Source

As above (`genCmmLabelRef`) but taking a `LMString`, not `CLabel`.