To protect your data, the CISO officer has suggested users to enable GitLab 2FA as soon as possible.

Commit 00e06707 authored by nathyong's avatar nathyong
Browse files

Fix DestinationClause and haddock comments

parent 04f618ea
......@@ -52,6 +52,7 @@ module Mu.AST (
, BasicBlock (..)
, versionedName
, dot
, (%)
, CommInst (..)
) where
......@@ -138,6 +139,12 @@ versionedName fn (Version vn) = FunctionVerName $ Name $ nameOf fn <> "." <> vn
dot :: (HasName a, IsString b) => a -> Underlying_Name_Type -> b
dot a sub = fromString $ nameOf a <> "." <> sub
-- | Infix version of 'dot'.
--
-- Possibly a bad idea to use.
(%) :: (HasName a, IsString b) => a -> Underlying_Name_Type -> b
(%) = dot
-------------------------------------------------- * Intermediate Representation
-- $ir
......@@ -251,7 +258,7 @@ instance Binary KeepAliveClause
-- | Destination clause, the call to move to a basic block e.g. %cont(%a)
data DestinationClause = DestinationClause
{ destClauseDestination :: String
{ destClauseDestination :: BasicBlockName
, destClauseArgList :: [VarName]
} deriving (Eq, Show, Generic)
instance Binary DestinationClause
......@@ -372,8 +379,8 @@ instance Binary MemoryOrder
-- | Expressions define all the operations which can be performed on Mu Data. This includes terminal instructions.
data Expression
= BinaryOperation
-- | The operation to be performed (Add, sub ...)
{ binOp :: BinaryOp
{ -- | The operation to be performed (Add, sub ...)
binOp :: BinaryOp
-- | The type of both parameters (they must be the same type)
, binType :: TypedefName
-- | The first parameter
......@@ -383,8 +390,8 @@ data Expression
-- | The optional exception clause
, execClause :: Maybe ExceptionClause}
| CompareOperation
-- | The compare operation, {EQ, SLE ... }
{ cmpOp :: CompareOp
{ -- | The compare operation, {EQ, SLE ... }
cmpOp :: CompareOp
-- | Type of both operands
, cmpType :: TypedefName
-- | first parameter
......@@ -392,8 +399,8 @@ data Expression
-- | second parameter
, cmpV2 :: VarName}
| ConvertOperation
-- | Operation to be performed {TRUNC, SEXT ...}
{ convOp :: ConvertOp
{ -- | Operation to be performed {TRUNC, SEXT ...}
convOp :: ConvertOp
-- | The source type, the type to be converted from
, convTypeSrc :: TypedefName
-- | The destination type, the type to be converted to
......@@ -403,8 +410,8 @@ data Expression
-- | optional exception clause
, convExceptionClause :: Maybe ExceptionClause}
| AtomicRMWOperation
-- | Bool indicates if Loc is a pointer
{ aRMWIsPtr :: Bool
{ -- | Bool indicates if Loc is a pointer
aRMWIsPtr :: Bool
-- | The memory order for the operation
, aRMWMemOrd :: MemoryOrder
-- | The operation to be performed
......@@ -418,8 +425,8 @@ data Expression
-- | The optional Exception clause
, aRMWExecClause :: Maybe ExceptionClause}
| CmpXchg
-- | Bool indicating if loc is a pointer
{ cmpXchgIsPtr :: Bool
{ -- | Bool indicating if loc is a pointer
cmpXchgIsPtr :: Bool
-- | Bool indicating if operation is weak
, cmpXchgIsWeak :: Bool
-- | Memory order for operation success
......@@ -437,16 +444,16 @@ data Expression
-- | Optional exception clause
, cmpXchgExecClause :: Maybe ExceptionClause}
| Fence
-- | Memory order for fence operation
{ fenceMemOrd :: MemoryOrder}
{ -- | Memory order for fence operation
fenceMemOrd :: MemoryOrder}
| New
-- | Type to allocate from heap
{ newType :: TypedefName
{ -- | Type to allocate from heap
newType :: TypedefName
-- | exception clause if operation fails
, newExecClause :: Maybe ExceptionClause}
| NewHybrid
-- | Hybrid type to alloate from heap
{ newHybridType :: TypedefName
{ -- | Hybrid type to alloate from heap
newHybridType :: TypedefName
-- | Length of hybrid type (must be int)
, newHybridLenType :: TypedefName
-- | Length of hybrid
......@@ -454,13 +461,13 @@ data Expression
-- | Exception clause if operation fails
, newHybridExecClause :: Maybe ExceptionClause}
| Alloca
-- | Type to allocate
{ allocaType :: TypedefName
{ -- | Type to allocate
allocaType :: TypedefName
-- | Exception clause if operation fails
, allocaExecClause :: Maybe ExceptionClause}
| AllocaHybrid
-- | Hybrid Type to allocate
{ allocaHybridType :: TypedefName
{ -- | Hybrid Type to allocate
allocaHybridType :: TypedefName
-- | Length of hybrid type (must be int)
, allocaHybridLenType :: TypedefName
-- | Length of hybrid
......@@ -468,14 +475,14 @@ data Expression
-- | Exception clause if operation fails
, allocaHybridExecClause :: Maybe ExceptionClause}
| Return
-- | Values to return (if any)
{ returnValues :: [VarName]}
{ -- | Values to return (if any)
returnValues :: [VarName]}
| Throw
-- | exceptional variable tor throw
{ throwException :: VarName}
{ -- | exceptional variable tor throw
throwException :: VarName}
| Call
-- | Signature of Mu Function to call
{ callSignature :: SignatureName
{ -- | Signature of Mu Function to call
callSignature :: SignatureName
-- | Variable of type funcref<@sig>
, callCallee :: VarName
-- | Arguments to pass to function
......@@ -485,8 +492,8 @@ data Expression
-- | Optional keep alive clause
, callKeepAliveClause :: Maybe KeepAliveClause}
| CCall
-- | Calling convention to follow (Mu or Other)
{ ccallCallConv :: CallConvention
{ -- | Calling convention to follow (Mu or Other)
ccallCallConv :: CallConvention
-- | type of callee (ufuncptr<@sig>)
, ccallType :: TypedefName
-- | Signature of callee
......@@ -500,25 +507,25 @@ data Expression
-- | optional keep alive clause
, ccallKeepAliveClause :: Maybe KeepAliveClause}
| TailCall
-- | signature of function to call
{ tailCallSignature :: SignatureName
{ -- | signature of function to call
tailCallSignature :: SignatureName
-- | function to call
, tailCallCallee :: VarName
-- | arguments to pass
, tailCallArgList :: [VarName]}
| Branch1
-- | BasicBlock to branch to
{ branch1Destination :: DestinationClause}
{ -- | BasicBlock to branch to
branch1Destination :: DestinationClause}
| Branch2
-- | Variable of type int<1>, condition on which to branch
{ branch2Cond :: VarName
{ -- | Variable of type int<1>, condition on which to branch
branch2Cond :: VarName
-- | Branch if condition is true
, branch2BranchTrue :: DestinationClause
-- | Branch if condition is false
, branch2BranchFalse :: DestinationClause}
| WatchPoint
-- | name of watchpoint
{ watchpointname :: VarName
{ -- | name of watchpoint
watchpointname :: VarName
-- | id of watchpoint
, watchpointId :: Int
-- | The types of the return values
......@@ -532,8 +539,8 @@ data Expression
-- | optional keep alive clause for after watchpoint is enabled
, watchpointKeepAlive :: Maybe KeepAliveClause}
| Trap
-- | name of trap
{ trapName :: VarName
{ -- | name of trap
trapName :: VarName
-- | the types of the values to return
, trapTypes :: [TypedefName]
-- | optional exception clause
......@@ -541,15 +548,15 @@ data Expression
-- | optinoal keep alive clause
, trapKeepAlive :: Maybe KeepAliveClause}
| WPBranch
-- | watchpoint id
{ wpBranchId :: Int
{ -- | watchpoint id
wpBranchId :: Int
-- | destination to jump to if watchpoint is enabled
, wpBranchDis :: DestinationClause
-- | destination to jump to if watchpoint is disabled
, wpBranchEna :: DestinationClause}
| Switch
-- | type of value to switch on
{ switchType :: TypedefName
{ -- | type of value to switch on
switchType :: TypedefName
-- | value to switch on
, switchOpnd :: VarName
-- | default destination (if all others fail)
......@@ -557,8 +564,8 @@ data Expression
-- | list of (condition, destination) pairs
, switchBlocks :: [(VarName, DestinationClause)]}
| SwapStack
-- | variable of type stackref (stack to swap to)
{ swapStackSwapee :: VarName
{ -- | variable of type stackref (stack to swap to)
swapStackSwapee :: VarName
-- | cur stack clause to use
, swapStackCurStackClause :: CurStackClause
-- | new stack clause to use
......@@ -568,15 +575,15 @@ data Expression
-- | optional keep alive clause
, swapStackKeepAliveClause :: Maybe KeepAliveClause}
| NewThread
-- | variable of type stackref (stack to bind thread to)
{ newThreadStack :: VarName
{ -- | variable of type stackref (stack to bind thread to)
newThreadStack :: VarName
-- | new stack clause to use
, newThreadStackClause :: NewStackClause
-- | optional exception clause to use
, newThreadExceptionClause :: Maybe ExceptionClause}
| Comminst
-- | operation code of the common instruction
{ comminstInst :: CommInst
{ -- | operation code of the common instruction
comminstInst :: CommInst
-- | optional flags to pass
, comminstFlags :: [Flag]
-- | types (if any) of the arguments to pass to comminst
......@@ -588,8 +595,8 @@ data Expression
-- | optional keep alive clause
, comminstKeepAliveClause :: Maybe KeepAliveClause}
| Load
-- | Bool indicating if Loc is a poiner
{ loadIsPtr :: Bool
{ -- | Bool indicating if Loc is a poiner
loadIsPtr :: Bool
-- | Optional Memory order (default NOT_ATOMIC)
, loadMemOrd :: Maybe MemoryOrder
-- | The referant type of loc
......@@ -599,8 +606,8 @@ data Expression
-- | Exception clause if operation fails
, loadExecClause :: Maybe ExceptionClause}
| Store
-- | Bool indicating if loc is a pointer
{ storeIsPtr :: Bool
{ -- | Bool indicating if loc is a pointer
storeIsPtr :: Bool
-- | Memory order for operation
, storeMemOrd :: Maybe MemoryOrder
-- | Type of loc
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment