X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2FllvmGen%2FLlvm%2FAbsSyn.hs;h=93bc62c91f2968eca9e6261fc296d6087fcbdc9a;hb=86add45dbfb6f962b65e371143dd467ae783f9e7;hp=1b8527b31fb16345983656a80d010daa68dae4b1;hpb=49a8e5c021009430d373d6224b29004c7d18c408;p=ghc-hetmet.git diff --git a/compiler/llvmGen/Llvm/AbsSyn.hs b/compiler/llvmGen/Llvm/AbsSyn.hs index 1b8527b..93bc62c 100644 --- a/compiler/llvmGen/Llvm/AbsSyn.hs +++ b/compiler/llvmGen/Llvm/AbsSyn.hs @@ -23,13 +23,13 @@ data LlvmBlock = LlvmBlock { type LlvmBlocks = [LlvmBlock] --- | An LLVM Module. This is a top level contianer in LLVM. +-- | An LLVM Module. This is a top level container in LLVM. data LlvmModule = LlvmModule { -- | Comments to include at the start of the module. modComments :: [LMString], - -- | Constants to include in the module. - modConstants :: [LMConstant], + -- | LLVM Alias type definitions. + modAliases :: [LlvmAlias], -- | Global variables to include in the module. modGlobals :: [LMGlobal], @@ -44,13 +44,19 @@ data LlvmModule = LlvmModule { -- | An LLVM Function data LlvmFunction = LlvmFunction { -- | The signature of this declared function. - funcDecl :: LlvmFunctionDecl, + funcDecl :: LlvmFunctionDecl, + + -- | The functions arguments + funcArgs :: [LMString], -- | The function attributes. - funcAttrs :: [LlvmFuncAttr], + funcAttrs :: [LlvmFuncAttr], + + -- | The section to put the function into, + funcSect :: LMSection, -- | The body of the functions. - funcBody :: LlvmBlocks + funcBody :: LlvmBlocks } type LlvmFunctions = [LlvmFunction] @@ -122,10 +128,16 @@ data LlvmStatement {- | Raise an expression to a statement (if don't want result or want to use - Llvm unamed values. + Llvm unnamed values. -} | Expr LlvmExpression + {- | + A nop LLVM statement. Useful as its often more efficient to use this + then to wrap LLvmStatement in a Just or []. + -} + | Nop + deriving (Show, Eq) @@ -168,12 +180,11 @@ data LlvmExpression {- | Navigate in an structure, selecting elements + * inbound: Is the pointer inbounds? (computed pointer doesn't overflow) * ptr: Location of the structure - * indexes: A list of indexes to select the correct value. For example - the first element of the third element of the structure ptr - is selected with [3,1] (zero indexed) + * indexes: A list of indexes to select the correct value. -} - | GetElemPtr LlvmVar [Int] + | GetElemPtr Bool LlvmVar [LlvmVar] {- | Cast the variable from to the to type. This is an abstraction of three @@ -199,11 +210,24 @@ data LlvmExpression Merge variables from different basic blocks which are predecessors of this basic block in a new variable of type tp. * tp: type of the merged variable, must match the types of the - precessors variables. + predecessor variables. * precessors: A list of variables and the basic block that they originate from. -} | Phi LlvmType [(LlvmVar,LlvmVar)] + {- | + Inline assembly expression. Syntax is very similar to the style used by GCC. + * assembly: Actual inline assembly code. + * contraints: Operand constraints. + * return ty: Return type of function. + * vars: Any variables involved in the assembly code. + * sideeffect: Does the expression have side effects not visible from the + constraints list. + * alignstack: Should the stack be conservatively aligned before this + expression is executed. + -} + | Asm LMString LMString LlvmType [LlvmVar] Bool Bool + deriving (Show, Eq)