Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
GHC
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Alexander Kaznacheev
GHC
Commits
af5fa14d
Commit
af5fa14d
authored
14 years ago
by
Simon Marlow
Committed by
Ian Lynagh
14 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Add a builtin rule for seq# when its argument is a manifest
head-normal-form, and similarly for spark#.
parent
d7aed5e6
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
compiler/prelude/PrelRules.lhs
+27
-3
27 additions, 3 deletions
compiler/prelude/PrelRules.lhs
with
27 additions
and
3 deletions
compiler/prelude/PrelRules.lhs
+
27
−
3
View file @
af5fa14d
...
...
@@ -24,9 +24,10 @@ import Id
import Literal
import PrimOp ( PrimOp(..), tagToEnumKey )
import TysWiredIn
import TysPrim
import TyCon ( tyConDataCons_maybe, isEnumerationTyCon, isNewTyCon )
import DataCon ( dataConTag, dataConTyCon, dataConWorkId, fIRST_TAG )
import CoreUtils ( cheapEqExpr )
import CoreUtils ( cheapEqExpr
, exprIsHNF
)
import CoreUnfold ( exprIsConApp_maybe )
import Type
import OccName ( occNameFS )
...
...
@@ -37,6 +38,7 @@ import Outputable
import FastString
import StaticFlags ( opt_SimplExcessPrecision )
import Constants
import BasicTypes
import Data.Bits as Bits
import Data.Int ( Int64 )
...
...
@@ -174,9 +176,10 @@ primOpRules op op_name = primop_rule op
primop_rule WordEqOp = relop (==)
primop_rule WordNeOp = relop (/=)
primop_rule
_
= []
primop_rule
SeqOp
= mkBasicRule op_name 4 seqRule
primop_rule SparkOp = mkBasicRule op_name 4 sparkRule
primop_rule _ = []
\end{code}
%************************************************************************
...
...
@@ -538,6 +541,27 @@ dataToTagRule id_unf [_, val_arg]
dataToTagRule _ _ = Nothing
\end{code}
%************************************************************************
%* *
\subsection{Rules for seq# and spark#}
%* *
%************************************************************************
\begin{code}
-- seq# :: forall a s . a -> State# s -> (# State# s, a #)
seqRule :: IdUnfoldingFun -> [CoreExpr] -> Maybe CoreExpr
seqRule _ [ty_a, Type ty_s, a, s] | exprIsHNF a
= Just (mkConApp (tupleCon Unboxed 2)
[Type (mkStatePrimTy ty_s), ty_a, s, a])
seqRule _ _ = Nothing
-- spark# :: forall a s . a -> State# s -> (# State# s, a #)
sparkRule :: IdUnfoldingFun -> [CoreExpr] -> Maybe CoreExpr
sparkRule = seqRule -- reduce on HNF, just the same
-- XXX perhaps we shouldn't do this, because a spark eliminated by
-- this rule won't be counted as a dud at runtime?
\end{code}
%************************************************************************
%* *
\subsection{Built in rules}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment