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
cbfda342
There was an error fetching the commit references. Please try again later.
Verified
Commit
cbfda342
authored
6 years ago
by
Recolic Keghart
Browse files
Options
Downloads
Patches
Plain Diff
[DO NOT BUILD] working on push/pop
parent
d2cc5093
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
src/main/java/chocopy/pa3/CodeGenImpl.java
+2
-4
2 additions, 4 deletions
src/main/java/chocopy/pa3/CodeGenImpl.java
with
2 additions
and
4 deletions
src/main/java/chocopy/pa3/CodeGenImpl.java
+
2
−
4
View file @
cbfda342
...
@@ -134,11 +134,9 @@ public class CodeGenImpl extends CodeGenBase {
...
@@ -134,11 +134,9 @@ public class CodeGenImpl extends CodeGenBase {
if
(
typ
.
equals
(
SymbolType
.
INT_TYPE
))
{
if
(
typ
.
equals
(
SymbolType
.
INT_TYPE
))
{
backend
.
emitLA
(
A0
,
intClass
.
getPrototypeLabel
(),
"Load prototype address"
);
backend
.
emitLA
(
A0
,
intClass
.
getPrototypeLabel
(),
"Load prototype address"
);
// save our objReg on stack before `alloc`
// save our objReg on stack before `alloc`
backend
.
emitADDI
(
SP
,
SP
,
-
4
,
"Decrement stack ptr 1"
);
betterBackend
.
emitPush
(
objReg
,
"Store the literal value"
);
backend
.
emitSW
(
objReg
,
SP
,
0
,
"Store the literal value"
);
backend
.
emitJAL
(
objectAllocLabel
,
"Allocate int"
);
backend
.
emitJAL
(
objectAllocLabel
,
"Allocate int"
);
backend
.
emitLW
(
objReg
,
SP
,
0
,
"Load literal value again"
);
betterBackend
.
emitPop
(
objReg
,
"Load literal value again"
);
backend
.
emitADDI
(
SP
,
SP
,
4
,
"Increment stack ptr 1"
);
backend
.
emitSW
(
objReg
,
A0
,
3
*
backend
.
getWordSize
(),
"Set __int__ value"
);
backend
.
emitSW
(
objReg
,
A0
,
3
*
backend
.
getWordSize
(),
"Set __int__ value"
);
}
else
if
(
typ
.
equals
(
SymbolType
.
STR_TYPE
))
{
}
else
if
(
typ
.
equals
(
SymbolType
.
STR_TYPE
))
{
// objReg already has a ptr in this case. just move to A0.
// objReg already has a ptr in this case. just move to A0.
...
...
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