Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Haley Sapphie Owsianko
ACC-project
Commits
f1b14889
Commit
f1b14889
authored
May 25, 2021
by
Sapphie
Browse files
Small changes
parent
527efc2b
Changes
2
Hide whitespace changes
Inline
Side-by-side
compiler/src/l3/CPSValueRepresenter.scala
View file @
f1b14889
...
...
@@ -318,10 +318,10 @@ object CPSValueRepresenter extends (H.Tree => L.Tree) {
L
.
LetP
(
n
,
CPS
.
XOr
,
Seq
(
res
,
L
.
AtomL
(
1
)),
transform
(
body
))
}
case
L3
.
IntMul
=>
tempLetP
(
CPS
.
Sub
,
Seq
(
Left
(
x
),
lAtomOne
))
{
x1
=>
tempLetP
(
CPS
.
XOr
,
Seq
(
Left
(
x
),
lAtomOne
))
{
x1
=>
tempLetP
(
CPS
.
ShiftRight
,
Seq
(
Left
(
y
),
lAtomOne
))
{
y1
=>
tempLetP
(
CPS
.
Mul
,
Seq
(
Right
(
x1
),
Right
(
y1
)))
{
z
=>
L
.
LetP
(
n
,
CPS
.
Add
,
Seq
(
z
,
L
.
AtomL
(
1
)),
transform
(
body
))
L
.
LetP
(
n
,
CPS
.
XOr
,
Seq
(
z
,
L
.
AtomL
(
1
)),
transform
(
body
))
}
}
}
...
...
compiler/src/l3/Main.scala
View file @
f1b14889
...
...
@@ -20,20 +20,21 @@ object Main {
// andThen treePrinter("---------- After high optimization")
// andThen CPSInterpreterHigh
andThen
CPSValueRepresenter
// andThen treeChecker
andThen
CPSHoister
// andThen treePrinter("---------- After value representation")
//
andThen CPSOptimizerLow
andThen
CPSOptimizerLow
// andThen treePrinter("---------- After low optimization")
andThen
treeChecker
andThen
(
new
CPSInterpreterLow
(
stats
.
log
_
))
//
andThen CPSConstantNamer
//
andThen CPSRegisterAllocator
//
andThen CPSToASMTranslator
//
andThen treeChecker
//
andThen (new CPSInterpreterLow(stats.log _))
andThen
CPSConstantNamer
andThen
CPSRegisterAllocator
andThen
CPSToASMTranslator
// andThen seqPrinter("---------- After translation to assembly")
//
andThen ASMLabelResolver
andThen
ASMLabelResolver
// andThen ASMInterpreter
//
andThen ASMFileWriter(Option(System.getProperty("l3.out-asm-file"))
//
.getOrElse("out.l3a"))
andThen
ASMFileWriter
(
Option
(
System
.
getProperty
(
"l3.out-asm-file"
))
.
getOrElse
(
"out.l3a"
))
)
val
basePath
=
Paths
.
get
(
"."
).
toAbsolutePath
...
...
@@ -44,7 +45,7 @@ object Main {
.
flatMap
(
backEnd
)
match
{
case
Right
((
retCode
,
maybeMsg
))
=>
maybeMsg
foreach
println
println
(
stats
)
//
println(stats)
sys
.
exit
(
retCode
)
case
Left
(
errMsg
)
=>
println
(
s
"Error: $errMsg"
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment