Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

corrected error in -,/,%

  • Loading branch information...
commit 9c22c6821ab044cad1429b26ba35900d0046a52a 1 parent 40c5f3b
@vivekzhere authored
Showing with 12 additions and 3 deletions.
  1. +12 −3 spsil.h
View
15 spsil.h
@@ -601,8 +601,11 @@ void codegen(struct tree * root)
}
else
{
+ fprintf(fp,"MOV T%d,%s\n",regcount,reg1);
+ regcount++;
codegen(root->ptr2);
- fprintf(fp,"SUB T%d,%s\n",regcount-1,reg1);
+ fprintf(fp,"SUB T%d,T%d\n",regcount-2,regcount-1);
+ regcount--;
}
}
else
@@ -665,8 +668,11 @@ void codegen(struct tree * root)
}
else
{
+ fprintf(fp,"MOV T%d,%s\n",regcount,reg1);
+ regcount++;
codegen(root->ptr2);
- fprintf(fp,"DIV T%d,%s\n",regcount-1,reg1);
+ fprintf(fp,"DIV T%d,T%d\n",regcount-2,regcount-1);
+ regcount--;
}
}
else
@@ -697,8 +703,11 @@ void codegen(struct tree * root)
}
else
{
+ fprintf(fp,"MOV T%d,%s\n",regcount,reg1);
+ regcount++;
codegen(root->ptr2);
- fprintf(fp,"MOD T%d,%s\n",regcount-1,reg1);
+ fprintf(fp,"MOD T%d,T%d\n",regcount-2,regcount-1);
+ regcount--;
}
}
else
Please sign in to comment.
Something went wrong with that request. Please try again.