Added .equiv directives. Need to fix runtime exceptions

master
Sanjar Ahmadov 4 years ago
parent c0e7c2a878
commit 3c4eeb2fdc

@ -1,4 +1,3 @@
<<<<<<< HEAD
# Box integer # Box integer
addi sp, sp, -8 addi sp, sp, -8
sw ra, 4(sp) sw ra, 4(sp)
@ -9,17 +8,4 @@
sw t0, @.__int__(a0) sw t0, @.__int__(a0)
lw ra, 4(sp) lw ra, 4(sp)
addi sp, sp, 8 addi sp, sp, 8
jr ra jr ra
=======
addi sp, sp, -8
sw ra, 4(sp)
sw a0, 0(sp)
la a0, $int$prototype
jal ra, alloc
lw t0, 0(sp)
sw t0, @.__int__(a0)
lw ra, 4(sp)
addi sp, sp, 8
jr ra
>>>>>>> origin/bill/merge-cond-cls

@ -56,8 +56,12 @@ public class CodeGenImpl extends CodeGenBase
/** A code generator emitting instructions to BACKEND. */ /** A code generator emitting instructions to BACKEND. */
public CodeGenImpl(RiscVBackend backend) public CodeGenImpl(RiscVBackend backend)
{ {
super(backend); super(backend);
backend.defineSym("listHeaderWords", "4");
backend.defineSym("strHeaderWords", "4");
backend.defineSym("bool.True", "const_1");
backend.defineSym("bool.False", "const_0");
} }
@ -76,6 +80,7 @@ public class CodeGenImpl extends CodeGenBase
*/ */
protected void emitTopLevel(List<Stmt> statements) protected void emitTopLevel(List<Stmt> statements)
{ {
StmtAnalyzer stmtAnalyzer = new StmtAnalyzer(null); StmtAnalyzer stmtAnalyzer = new StmtAnalyzer(null);
backend.emitADDI(SP, SP, -2 * backend.getWordSize(), "Saved FP and saved RA (unused at top level)."); backend.emitADDI(SP, SP, -2 * backend.getWordSize(), "Saved FP and saved RA (unused at top level).");
backend.emitSW(ZERO, SP, 0, "Top saved FP is 0."); backend.emitSW(ZERO, SP, 0, "Top saved FP is 0.");
@ -848,7 +853,6 @@ public class CodeGenImpl extends CodeGenBase
* to out-of-bounds error and abort"); * to out-of-bounds error and abort");
*/ */
protected void emitCustomCode() { protected void emitCustomCode() {
emitStdFunc("concat"); emitStdFunc("concat");
emitStdFunc("conslist"); emitStdFunc("conslist");
emitStdFunc("strcat"); emitStdFunc("strcat");

Loading…
Cancel
Save