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
1a0e7463
Commit
1a0e7463
authored
Mar 17, 2021
by
Tom Zhao
Browse files
xz1919: resolved all issues related to array, all array test passed except printRef
parent
d97ca391
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/backend/intel/IntelInstructionGenerator.java
View file @
1a0e7463
...
...
@@ -136,7 +136,7 @@ public class IntelInstructionGenerator extends InstructionGenerator<IntelInstruc
visit
(
index
);
indexReg
=
intelRegAllocator
.
curr
();
if
(
isLhs
)
{
instructions
.
add
(
new
Mov
(
new
IntelAddress
(
indexReg
),
indexReg
));
instructions
.
add
(
new
Mov
(
new
IntelAddress
(
indexReg
),
indexReg
.
withSize
(
intToIntelSize
.
get
(
index
.
getType
().
getSize
()))
));
}
}
else
{
indexReg
=
intelRegAllocator
.
allocate
();
...
...
@@ -300,16 +300,13 @@ public class IntelInstructionGenerator extends InstructionGenerator<IntelInstruc
int
offset
=
currSymbolTable
.
getStackOffset
(
node
.
getName
(),
node
.
getSymbol
())
-
currParamListSize
+
stackOffset
;
System
.
out
.
println
(
node
.
getName
());
System
.
out
.
println
(
offset
);
/* if is lhs, then only put address in register */
if
(
isLhs
)
{
instructions
.
add
(
new
Lea
(
new
IntelAddress
(
rbp
,
-
offset
),
intelRegAllocator
.
allocate
()));
}
else
{
/* otherwise, put value in register */
Map
<
Integer
,
IntelMovType
>
m
=
Map
.
of
(
8
,
IntelMovType
.
MOV
,
4
,
IntelMovType
.
MOV
,
1
,
IntelMovType
.
MOVZBQ
);
instructions
.
add
(
new
Mov
(
new
IntelAddress
(
rbp
,
-
offset
),
intelRegAllocator
.
allocate
(),
m
.
get
(
identTypeSize
)));
instructions
.
add
(
new
Mov
(
new
IntelAddress
(
rbp
,
-
offset
),
intelRegAllocator
.
allocate
()
.
withSize
(
intToIntelSize
.
get
(
identTypeSize
))
,
m
.
get
(
identTypeSize
)));
}
return
null
;
}
...
...
src/backend/intel/instructions/Mov.java
View file @
1a0e7463
...
...
@@ -46,7 +46,7 @@ public class Mov extends MovInstruction implements IntelInstruction {
boolean
isNormalMov
=
type
.
equals
(
IntelMovType
.
MOV
);
if
(!
isNormalMov
)
{
str
.
append
(
type
.
name
().
toLowerCase
(
Locale
.
ROOT
));
str
.
append
(
type
.
name
().
toLowerCase
());
}
String
size
=
""
;
...
...
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