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
Commits
2ccfd18a
Commit
2ccfd18a
authored
3 years ago
by
Haley Sapphie Owsianko
Browse files
Options
Downloads
Plain Diff
Merge branch 'optimiser' into 'master'
Begin optimiser implementation See merge request
!1
parents
92317d94
07caad17
No related branches found
Branches containing commit
No related tags found
1 merge request
!1
Begin optimiser implementation
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
compiler/src/l3/CPSOptimizer.scala
+67
-13
67 additions, 13 deletions
compiler/src/l3/CPSOptimizer.scala
with
67 additions
and
13 deletions
compiler/src/l3/CPSOptimizer.scala
+
67
−
13
View file @
2ccfd18a
...
...
@@ -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
)
...
...
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