Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
cs164_lab3_cg
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
recolic-hust
cs164_lab3_cg
Commits
d3829caa
There was an error fetching the commit references. Please try again later.
Unverified
Commit
d3829caa
authored
6 years ago
by
Shivane Sabharwal
Committed by
GitHub
6 years ago
Browse files
Options
Downloads
Plain Diff
Merge branch 'master' into op_logical
parents
68e5bf02
24ef9eb3
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Makefile
+8
-2
8 additions, 2 deletions
Makefile
src/main/java/chocopy/pa3/CodeGenImpl.java
+2
-1
2 additions, 1 deletion
src/main/java/chocopy/pa3/CodeGenImpl.java
with
10 additions
and
3 deletions
Makefile
+
8
−
2
View file @
d3829caa
CLEAN
=
mvn clean package
CLEAN
=
mvn clean package
TEST
=
java
-cp
"chocopy-ref.jar:target/assignment.jar"
chocopy.ChocoPy
--pass
=
..s
--run
--dir
src/test/data/pa3/sample/
--test
TEST
=
java
-cp
"chocopy-ref.jar:target/assignment.jar"
chocopy.ChocoPy
--pass
=
..s
--run
--dir
src/test/data/pa3/sample/
--test
FILE
=
op_cmp_int
CHECKPOINTS
=
src/test/data/pa3/sample/literal_bool.py src/test/data/pa3/sample/literal_int.py src/test/data/pa3/sample/literal_str.py src/test/data/pa3/sample/id_global.py src/test/data/pa3/sample/id_local.py src/test/data/pa3/sample/var_assign.py src/test/data/pa3/sample/call.py src/test/data/pa3/sample/call_with_args.py src/test/data/pa3/sample/nested.py src/test/data/pa3/sample/nested2.py src/test/data/pa3/sample/op_add.py src/test/data/pa3/sample/op_cmp_bool.py src/test/data/pa3/sample/op_cmp_int.py src/test/data/pa3/sample/op_div_mod.py src/test/data/pa3/sample/op_logical.py src/test/data/pa3/sample/op_mul.py src/test/data/pa3/sample/op_negate.py src/test/data/pa3/sample/op_sub.py src/test/data/pa3/sample/stmt_if.py src/test/data/pa3/sample/stmt_while.py src/test/data/pa3/sample/stmt_return_early.py src/test/data/pa3/benchmarks/exp.py src/test/data/pa3/benchmarks/prime.py
TESTB
=
java
-cp
"chocopy-ref.jar:target/assignment.jar"
chocopy.ChocoPy
--pass
=
..s
--run
--dir
src/test/data/pa3/benchmarks/
--test
FILE
=
op_logical
clean
:
clean
:
$(
CLEAN
)
$(
CLEAN
)
test
:
test
:
...
@@ -17,3 +17,9 @@ assembly:
...
@@ -17,3 +17,9 @@ assembly:
java
-cp
"chocopy-ref.jar:target/assignment.jar"
chocopy.ChocoPy
--pass
=
..s src/test/data/pa3/sample/
$(
FILE
)
.py.ast.typed
--out
src/test/data/pa3/sample/
$(
FILE
)
.py.s
java
-cp
"chocopy-ref.jar:target/assignment.jar"
chocopy.ChocoPy
--pass
=
..s src/test/data/pa3/sample/
$(
FILE
)
.py.ast.typed
--out
src/test/data/pa3/sample/
$(
FILE
)
.py.s
reference-assembly
:
reference-assembly
:
java
-cp
"chocopy-ref.jar:target/assignment.jar"
chocopy.ChocoPy
--pass
=
..r src/test/data/pa3/sample/
$(
FILE
)
.py.ast.typed
--out
src/test/data/pa3/sample/
$(
FILE
)
.py.s
java
-cp
"chocopy-ref.jar:target/assignment.jar"
chocopy.ChocoPy
--pass
=
..r src/test/data/pa3/sample/
$(
FILE
)
.py.ast.typed
--out
src/test/data/pa3/sample/
$(
FILE
)
.py.s
testb
:
$(
TESTB
)
clean-testb
:
$(
CLEAN
)
;
$(
TESTB
)
This diff is collapsed.
Click to expand it.
src/main/java/chocopy/pa3/CodeGenImpl.java
+
2
−
1
View file @
d3829caa
...
@@ -316,6 +316,7 @@ public class CodeGenImpl extends CodeGenBase {
...
@@ -316,6 +316,7 @@ public class CodeGenImpl extends CodeGenBase {
@Override
@Override
public
Void
analyze
(
AssignStmt
node
)
{
public
Void
analyze
(
AssignStmt
node
)
{
backend
.
emitADDI
(
SP
,
SP
,
-
4
,
"Increment stack ptr by 1 for Condition"
);
node
.
value
.
dispatch
(
this
);
node
.
value
.
dispatch
(
this
);
RiscVBackend
.
Register
tmpReg
=
/*regMgr.borrowOneTmp()*/
T6
;
RiscVBackend
.
Register
tmpReg
=
/*regMgr.borrowOneTmp()*/
T6
;
RiscVBackend
.
Register
tmpReg2
=
/*regMgr.borrowOneTmp()*/
T5
;
RiscVBackend
.
Register
tmpReg2
=
/*regMgr.borrowOneTmp()*/
T5
;
...
@@ -371,7 +372,7 @@ public class CodeGenImpl extends CodeGenBase {
...
@@ -371,7 +372,7 @@ public class CodeGenImpl extends CodeGenBase {
@Override
@Override
public
Void
analyze
(
IfStmt
node
)
{
public
Void
analyze
(
IfStmt
node
)
{
backend
.
emitADDI
(
SP
,
SP
,
-
4
,
"Increment by 1 for
c
ondition"
);
backend
.
emitADDI
(
SP
,
SP
,
-
4
,
"Increment
stack ptr
by 1 for
C
ondition"
);
node
.
condition
.
dispatch
(
this
);
node
.
condition
.
dispatch
(
this
);
RiscVBackend
.
Register
tmpReg
=
/*regMgr.borrowTmp()*/
T6
;
RiscVBackend
.
Register
tmpReg
=
/*regMgr.borrowTmp()*/
T6
;
betterBackend
.
emitPop
(
tmpReg
,
"IfStmt: Get condition"
);
betterBackend
.
emitPop
(
tmpReg
,
"IfStmt: Get condition"
);
...
...
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