Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Shen, Siran
wacc
Commits
d97ca391
Commit
d97ca391
authored
Mar 17, 2021
by
Tom Zhao
Browse files
xz1919: WIP finished debugging arrayPrint.wacc
parent
8529b90f
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/backend/intel/IntelInstructionGenerator.java
View file @
d97ca391
...
...
@@ -125,7 +125,6 @@ public class IntelInstructionGenerator extends InstructionGenerator<IntelInstruc
IntelConcreteRegister
addrReg
=
intelRegAllocator
.
allocate
();
int
offset
=
currSymbolTable
.
getStackOffset
(
node
.
getName
(),
node
.
getSymbol
())
-
(
currSymbolTable
.
getParentSymbolTable
()
==
null
?
0
:
currSymbolTable
.
getParentSymbolTable
().
getSize
())
+
stackOffset
;
instructions
.
add
(
new
Mov
(
new
IntelAddress
(
rbp
,
-
offset
),
addrReg
));
...
...
@@ -177,9 +176,11 @@ public class IntelInstructionGenerator extends InstructionGenerator<IntelInstruc
for
(
int
i
=
0
;
i
<
node
.
getLength
();
i
++)
{
visit
(
node
.
getElem
(
i
));
int
indexOffset
=
node
.
getContentSize
()
*
i
;
IntelConcreteRegister
realAddr
=
intelRegAllocator
.
allocate
();
instructions
.
add
(
new
Lea
(
new
IntelAddress
(
addrReg
,
indexOffset
),
realAddr
));
instructions
.
add
(
new
Mov
(
intelRegAllocator
.
last
(),
new
IntelAddress
(
realAddr
)));
IntelConcreteRegister
tempAddr
=
intelRegAllocator
.
allocate
();
instructions
.
add
(
new
Mov
(
addrReg
,
tempAddr
));
instructions
.
add
(
new
Add
(
indexOffset
,
IntelInstructionSize
.
Q
,
tempAddr
));
instructions
.
add
(
new
Mov
(
intelRegAllocator
.
last
().
withSize
(
intToIntelSize
.
get
(
node
.
getContentSize
()))
,
new
IntelAddress
(
tempAddr
)));
intelRegAllocator
.
free
();
intelRegAllocator
.
free
();
}
...
...
@@ -297,9 +298,9 @@ public class IntelInstructionGenerator extends InstructionGenerator<IntelInstruc
/* put pointer that point to ident's value in stack to next available register */
int
offset
=
currSymbolTable
.
getStackOffset
(
node
.
getName
(),
node
.
getSymbol
())
-
(
currSymbolTable
.
getParentSymbolTable
()
==
null
?
0
:
currSymbolTable
.
getParentSymbolTable
().
getSize
())
-
currParamListSize
+
stackOffset
;
System
.
out
.
println
(
node
.
getName
());
System
.
out
.
println
(
offset
);
/* if is lhs, then only put address in register */
...
...
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