Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- f.genInstr("", "cdq", "", "");
- f.genInstr("", "idivl", "%ecx", "");
- f.genInstr("", "movl", "%edx,%eax", " mod");
- @Override
- void genCode(CodeFile f) {//Common for all operators
- f.genInstr("", "pushl", "%eax", "");
- right.genCode(f);
- f.genInstr("", "movl", "%eax,%ecx", "");
- f.genInstr("", "popl", "%eax", "");//Special code for each operator
- if (token.equals("*")) {f.genInstr("", "imull", "%ecx,%eax", " *");} else if (token.equals("div")) {f.genInstr("", "cdq", "", "");
- f.genInstr("", "idivl", "%ecx", " /");} else if (token.equals("mod")) {f.genInstr("", "cdq", "", "");
- f.genInstr("", "idivl", "%ecx", "");
- f.genInstr("", "movl", "%edx,%eax", " mod");} else if (token.equals("and")) {f.genInstr("", "andl", "%ecx,%eax", " and");} else {
- Main.panic("Factor opr - genCode()");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement