Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
ACC-project
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Haley Sapphie Owsianko
ACC-project
Merge requests
!1
Begin optimiser implementation
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Begin optimiser implementation
optimiser
into
master
Overview
0
Commits
1
Pipelines
0
Changes
1
Merged
Haley Sapphie Owsianko
requested to merge
optimiser
into
master
3 years ago
Overview
0
Commits
1
Pipelines
0
Changes
1
Expand
0
0
Merge request reports
Viewing commit
07caad17
Show latest version
1 file
+
67
−
13
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
07caad17
Begin optimiser implementation
· 07caad17
Sapphie
authored
3 years ago
compiler/src/l3/CPSOptimizer.scala
+
67
−
13
Options
@@ -276,28 +276,82 @@ object CPSOptimizerHigh extends CPSOptimizer(SymbolicCPSTreeModule)
protected
val
unstable
:
ValuePrimitive
=>
Boolean
=
???
protected
val
blockAllocTag
:
PartialFunction
[
ValuePrimitive
,
Literal
]
=
???
protected
val
blockTag
:
ValuePrimitive
=
???
protected
val
blockLength
:
ValuePrimitive
=
???
protected
val
blockAllocTag
:
PartialFunction
[
ValuePrimitive
,
Literal
]
=
{
case
BlockAlloc
(
t
)
=>
t
}
protected
val
blockTag
:
ValuePrimitive
=
BlockTag
protected
val
blockLength
:
ValuePrimitive
=
BlockLength
protected
val
identity
:
ValuePrimitive
=
???
protected
val
identity
:
ValuePrimitive
=
Id
protected
val
leftNeutral
:
Set
[(
Literal
,
ValuePrimitive
)]
=
???
protected
val
rightNeutral
:
Set
[(
ValuePrimitive
,
Literal
)]
=
???
protected
val
leftNeutral
:
Set
[(
Literal
,
ValuePrimitive
)]
=
Set
(
(
IntLit
(
L3Int
(
0
)),
IntAdd
),
(
IntLit
(
L3Int
(
1
)),
IntMul
),
(
IntLit
(
L3Int
((-
1
<<
1
)
>>
1
)),
IntBitwiseAnd
),
(
IntLit
(
L3Int
(
0
)),
IntBitwiseOr
),
(
IntLit
(
L3Int
(
0
)),
IntBitwiseXOr
)
)
protected
val
rightNeutral
:
Set
[(
ValuePrimitive
,
Literal
)]
=
Set
(
(
IntAdd
,
IntLit
(
L3Int
(
0
))),
(
IntSub
,
IntLit
(
L3Int
(
0
))),
(
IntMul
,
IntLit
(
L3Int
(
1
))),
(
IntDiv
,
IntLit
(
L3Int
(
1
))),
(
IntShiftLeft
,
IntLit
(
L3Int
(
0
))),
(
IntShiftRight
,
IntLit
(
L3Int
(
0
))),
(
IntBitwiseAnd
,
IntLit
(
L3Int
((-
1
<<
1
)
>>
1
))),
(
IntBitwiseOr
,
IntLit
(
L3Int
(
0
))),
(
IntBitwiseXOr
,
IntLit
(
L3Int
(
0
))),
)
protected
val
leftAbsorbing
:
Set
[(
Literal
,
ValuePrimitive
)]
=
Set
(
(
IntLit
(
L3Int
(
0
)),
IntMul
),
(
IntLit
(
L3Int
(
0
)),
IntMod
),
(
IntLit
(
L3Int
(
0
)),
IntBitwiseAnd
),
(
IntLit
(
L3Int
((-
1
<<
1
)
>>
1
)),
IntBitwiseOr
),
(
IntLit
(
L3Int
(
0
)),
IntShiftLeft
),
(
IntLit
(
L3Int
(
0
)),
IntShiftRight
)
)
protected
val
rightAbsorbing
:
Set
[(
ValuePrimitive
,
Literal
)]
=
Set
(
(
IntMul
,
IntLit
(
L3Int
(
0
))),
(
IntBitwiseAnd
,
IntLit
(
L3Int
(
0
))),
(
IntBitwiseOr
,
IntLit
(
L3Int
((-
1
<<
1
)
>>
1
)))
)
protected
val
leftAbsorbing
:
Set
[(
Literal
,
ValuePrimitive
)]
=
???
protected
val
rightAbsorbing
:
Set
[(
ValuePrimitive
,
Literal
)]
=
???
protected
val
sameArgReduce
:
PartialFunction
[(
ValuePrimitive
,
Atom
)
,
Atom
]
=
{
case
(
IntBitwiseAnd
|
IntBitwiseOr
,
a
)
=>
a
case
(
IntSub
|
IntBitwiseXOr
|
IntMod
,
_
)
=>
AtomL
(
IntLit
(
L3Int
(
0
)))
case
(
IntDiv
,
_
)
=>
AtomL
(
IntLit
(
L3Int
(
1
)))
}
protected
val
sameArgReduce
:
PartialFunction
[(
ValuePrimitive
,
Atom
)
,
Atom
]
=
???
protected
val
sameArgReduceC
:
PartialFunction
[
TestPrimitive
,
Boolean
]
=
???
protected
val
sameArgReduceC
:
PartialFunction
[
TestPrimitive
,
Boolean
]
=
{
case
IntLt
=>
false
case
IntLe
|
Eq
=>
true
}
protected
val
vEvaluator
:
PartialFunction
[(
ValuePrimitive
,
Seq
[
Literal
])
,
Literal
]
=
???
Literal
]
=
{
case
(
vPrim
,
Seq
(
IntLit
(
x
),
IntLit
(
y
)))
=>
vPrim
match
{
case
IntAdd
=>
IntLit
(
x
+
y
)
case
IntSub
=>
IntLit
(
x
-
y
)
case
IntMod
=>
IntLit
(
x
%
y
)
case
IntDiv
=>
IntLit
(
x
/
y
)
case
IntMul
=>
IntLit
(
x
*
y
)
case
IntBitwiseAnd
=>
IntLit
(
x
&
y
)
case
IntBitwiseOr
=>
IntLit
(
x
|
y
)
case
IntBitwiseXOr
=>
IntLit
(
x
^
y
)
case
IntShiftLeft
=>
IntLit
(
x
<<
y
)
case
IntShiftRight
=>
IntLit
(
x
>>
y
)
}
}
protected
val
cEvaluator
:
PartialFunction
[(
TestPrimitive
,
Seq
[
Literal
])
,
Boolean
]
=
???
Boolean
]
=
{
case
(
IntLe
,
Seq
(
IntLit
(
x
),
IntLit
(
y
)))
=>
x
<=
y
case
(
IntLt
,
Seq
(
IntLit
(
x
),
IntLit
(
y
)))
=>
x
<
y
case
(
Eq
,
Seq
(
l1
,
l2
))
=>
l1
==
l2
}
}
object
CPSOptimizerLow
extends
CPSOptimizer
(
SymbolicCPSTreeModuleLow
)
Loading