ghc-9.2.8: The GHC API
Safe HaskellSafe-Inferred
LanguageHaskell2010

GHC.Cmm.MachOp

Synopsis

Documentation

data MachOp Source #

Machine-level primops; ones which we can reasonably delegate to the native code generators to handle.

Most operations are parameterised by the Width that they operate on. Some operations have separate signed and unsigned versions, and float and integer versions.

Note that there are variety of places in the native code generator where we assume that the code produced for a MachOp does not introduce new blocks.

Instances

Instances details
Show MachOp Source # 
Instance details

Defined in GHC.Cmm.MachOp

Eq MachOp Source # 
Instance details

Defined in GHC.Cmm.MachOp

Methods

(==) :: MachOp -> MachOp -> Bool #

(/=) :: MachOp -> MachOp -> Bool #

isCommutableMachOp :: MachOp -> Bool Source #

Returns True if the MachOp has commutable arguments. This is used in the platform-independent Cmm optimisations.

If in doubt, return False. This generates worse code on the native routes, but is otherwise harmless.

isAssociativeMachOp :: MachOp -> Bool Source #

Returns True if the MachOp is associative (i.e. (x+y)+z == x+(y+z)) This is used in the platform-independent Cmm optimisations.

If in doubt, return False. This generates worse code on the native routes, but is otherwise harmless.

isComparisonMachOp :: MachOp -> Bool Source #

Returns True if the MachOp is a comparison.

If in doubt, return False. This generates worse code on the native routes, but is otherwise harmless.

maybeIntComparison :: MachOp -> Maybe Width Source #

Returns Just w if the operation is an integer comparison with width w, or Nothing otherwise.

machOpResultType :: Platform -> MachOp -> [CmmType] -> CmmType Source #

Returns the MachRep of the result of a MachOp.

machOpArgReps :: Platform -> MachOp -> [Width] Source #

This function is used for debugging only: we can check whether an application of a MachOp is "type-correct" by checking that the MachReps of its arguments are the same as the MachOp expects. This is used when linting a CmmExpr.

data CallishMachOp Source #

Instances

Instances details
Show CallishMachOp Source # 
Instance details

Defined in GHC.Cmm.MachOp

Eq CallishMachOp Source # 
Instance details

Defined in GHC.Cmm.MachOp

machOpMemcpyishAlign :: CallishMachOp -> Maybe Int Source #

The alignment of a memcpy-ish operation.

data AtomicMachOp Source #

The operation to perform atomically.

Instances

Instances details
Show AtomicMachOp Source # 
Instance details

Defined in GHC.Cmm.MachOp

Eq AtomicMachOp Source # 
Instance details

Defined in GHC.Cmm.MachOp