Safe Haskell | None |
---|---|
Language | Haskell2010 |
This module implements common-subexpression elimination. This module does not actually remove the duplicate, but only replaces one with a diference to the other. E.g:
let a = x + y let b = x + y
becomes:
let a = x + y let b = a
After which copy propagation in the simplifier will actually remove
the definition of b
.
Our CSE is still rather stupid. No normalisation is performed, so
the expressions x+y
and y+x
will be considered distinct.
Furthermore, no expression with its own binding will be considered
equal to any other, since the variable names will be distinct.
This affects SOACs in particular.
Synopsis
- performCSE :: (Attributes lore, CanBeAliased (Op lore), CSEInOp (OpWithAliases (Op lore))) => Bool -> Pass lore lore
- performCSEOnFunDef :: (Attributes lore, CanBeAliased (Op lore), CSEInOp (OpWithAliases (Op lore))) => Bool -> FunDef lore -> FunDef lore
- performCSEOnStms :: (Attributes lore, CanBeAliased (Op lore), CSEInOp (OpWithAliases (Op lore))) => Bool -> Stms lore -> Stms lore
- class CSEInOp op
Documentation
performCSE :: (Attributes lore, CanBeAliased (Op lore), CSEInOp (OpWithAliases (Op lore))) => Bool -> Pass lore lore Source #
Perform CSE on every function in a program.
performCSEOnFunDef :: (Attributes lore, CanBeAliased (Op lore), CSEInOp (OpWithAliases (Op lore))) => Bool -> FunDef lore -> FunDef lore Source #
Perform CSE on a single function.
performCSEOnStms :: (Attributes lore, CanBeAliased (Op lore), CSEInOp (OpWithAliases (Op lore))) => Bool -> Stms lore -> Stms lore Source #
Perform CSE on some statements.
The operations that permit CSE.
cseInOp
Instances
CSEInOp () Source # | |
Defined in Futhark.Optimise.CSE cseInOp :: () -> CSEM lore () | |
(Attributes lore, CanBeAliased (Op lore), CSEInOp (OpWithAliases (Op lore))) => CSEInOp (SOAC (Aliases lore)) Source # | |
(Attributes lore, Aliased lore, CSEInOp (Op lore)) => CSEInOp (SegOp lore) Source # | |
Defined in Futhark.Optimise.CSE | |
CSEInOp op => CSEInOp (MemOp op) Source # | |
Defined in Futhark.Optimise.CSE | |
(Attributes lore, Aliased lore, CSEInOp (Op lore), CSEInOp op) => CSEInOp (HostOp lore op) Source # | |
Defined in Futhark.Optimise.CSE |