diff --git a/gen_input/templates/asmjit/CORENAME.cpp.gtl b/gen_input/templates/asmjit/CORENAME.cpp.gtl index 6a7a40e..6441884 100644 --- a/gen_input/templates/asmjit/CORENAME.cpp.gtl +++ b/gen_input/templates/asmjit/CORENAME.cpp.gtl @@ -95,6 +95,7 @@ protected: using super::gen_wait; using super::gen_leave; using super::gen_operation; + using super::gen_sync; using this_class = vm_impl; using compile_func = continuation_e (this_class::*)(virt_addr_t&, code_word_t, jit_holder&); @@ -160,7 +161,7 @@ private: } x86::Compiler& cc = jh.cc; cc.comment(fmt::format("${instr.name}_{:#x}:",pc.val).c_str()); - this->gen_sync(jh, PRE_SYNC, ${idx}); + gen_sync(jh, PRE_SYNC, ${idx}); mov(cc, jh.pc, pc.val); pc = pc+${instr.length/8}; mov(cc, jh.next_pc, pc.val); @@ -171,7 +172,7 @@ private: <%instr.behavior.eachLine{%>${it} <%}%> gen_instr_epilogue(jh); - this->gen_sync(jh, POST_SYNC, ${idx}); + gen_sync(jh, POST_SYNC, ${idx}); return returnValue; } <%}%> @@ -181,12 +182,12 @@ private: continuation_e illegal_intruction(virt_addr_t &pc, code_word_t instr, jit_holder& jh ) { x86::Compiler& cc = jh.cc; cc.comment(fmt::format("illegal_intruction{:#x}:",pc.val).c_str()); - this->gen_sync(jh, PRE_SYNC, instr_descr.size()); + gen_sync(jh, PRE_SYNC, instr_descr.size()); pc = pc + ((instr & 3) == 3 ? 4 : 2); gen_instr_prologue(jh); cc.comment("//behavior:"); gen_instr_epilogue(jh); - this->gen_sync(jh, POST_SYNC, instr_descr.size()); + gen_sync(jh, POST_SYNC, instr_descr.size()); return BRANCH; } @@ -282,7 +283,7 @@ void vm_impl::gen_instr_prologue(jit_holder& jh) { cc.comment("//gen_instr_prologue"); cc.inc(get_ptr_for(jh, traits::ICOUNT)); - x86_reg_t current_trap_state = get_reg_for(jh, traits::TRAP_STATE); + x86_reg_t current_trap_state = get_reg_for(cc, traits::TRAP_STATE); mov(cc, current_trap_state, get_ptr_for(jh, traits::TRAP_STATE)); mov(cc, get_ptr_for(jh, traits::PENDING_TRAP), current_trap_state); @@ -292,7 +293,7 @@ void vm_impl::gen_instr_epilogue(jit_holder& jh) { auto& cc = jh.cc; cc.comment("//gen_instr_epilogue"); - x86_reg_t current_trap_state = get_reg_for(jh, traits::TRAP_STATE); + x86_reg_t current_trap_state = get_reg_for(cc, traits::TRAP_STATE); mov(cc, current_trap_state, get_ptr_for(jh, traits::TRAP_STATE)); cmp(cc, current_trap_state, 0); cc.jne(jh.trap_entry); @@ -313,10 +314,10 @@ void vm_impl::gen_block_epilogue(jit_holder& jh){ this->write_back(jh); this->gen_sync(jh, POST_SYNC, -1); - x86::Gp current_trap_state = get_reg_for_Gp(jh, traits::TRAP_STATE); + x86::Gp current_trap_state = get_reg_for_Gp(cc, traits::TRAP_STATE); mov(cc, current_trap_state, get_ptr_for(jh, traits::TRAP_STATE)); - x86::Gp current_pc = get_reg_for_Gp(jh, traits::PC); + x86::Gp current_pc = get_reg_for_Gp(cc, traits::PC); mov(cc, current_pc, get_ptr_for(jh, traits::PC)); x86::Gp instr = cc.newInt32("instr"); @@ -329,7 +330,7 @@ void vm_impl::gen_block_epilogue(jit_holder& jh){ call_enter_trap->setArg(2, current_pc); call_enter_trap->setArg(3, instr); - x86_reg_t current_next_pc = get_reg_for(jh, traits::NEXT_PC); + x86_reg_t current_next_pc = get_reg_for(cc, traits::NEXT_PC); mov(cc, current_next_pc, get_ptr_for(jh, traits::NEXT_PC)); mov(cc, jh.next_pc, current_next_pc); @@ -340,7 +341,7 @@ template inline void vm_impl::gen_raise(jit_holder& jh, uint16_t trap_id, uint16_t cause) { auto& cc = jh.cc; cc.comment("//gen_raise"); - auto tmp1 = get_reg_for(jh, traits::TRAP_STATE); + auto tmp1 = get_reg_for(cc, traits::TRAP_STATE); mov(cc, tmp1, 0x80ULL << 24 | (cause << 16) | trap_id); mov(cc, get_ptr_for(jh, traits::TRAP_STATE), tmp1); mov(cc, jh.next_pc, std::numeric_limits::max()); diff --git a/src/vm/asmjit/vm_tgc5c.cpp b/src/vm/asmjit/vm_tgc5c.cpp index 4ba664e..8343ab8 100644 --- a/src/vm/asmjit/vm_tgc5c.cpp +++ b/src/vm/asmjit/vm_tgc5c.cpp @@ -95,6 +95,7 @@ protected: using super::gen_wait; using super::gen_leave; using super::gen_operation; + using super::gen_sync; using this_class = vm_impl; using compile_func = continuation_e (this_class::*)(virt_addr_t&, code_word_t, jit_holder&); @@ -335,7 +336,7 @@ private: } x86::Compiler& cc = jh.cc; cc.comment(fmt::format("LUI_{:#x}:",pc.val).c_str()); - this->gen_sync(jh, PRE_SYNC, 0); + gen_sync(jh, PRE_SYNC, 0); mov(cc, jh.pc, pc.val); pc = pc+4; mov(cc, jh.next_pc, pc.val); @@ -355,7 +356,7 @@ private: auto returnValue = CONT; gen_instr_epilogue(jh); - this->gen_sync(jh, POST_SYNC, 0); + gen_sync(jh, POST_SYNC, 0); return returnValue; } @@ -381,7 +382,7 @@ private: } x86::Compiler& cc = jh.cc; cc.comment(fmt::format("AUIPC_{:#x}:",pc.val).c_str()); - this->gen_sync(jh, PRE_SYNC, 1); + gen_sync(jh, PRE_SYNC, 1); mov(cc, jh.pc, pc.val); pc = pc+4; mov(cc, jh.next_pc, pc.val); @@ -401,7 +402,7 @@ private: auto returnValue = CONT; gen_instr_epilogue(jh); - this->gen_sync(jh, POST_SYNC, 1); + gen_sync(jh, POST_SYNC, 1); return returnValue; } @@ -427,7 +428,7 @@ private: } x86::Compiler& cc = jh.cc; cc.comment(fmt::format("JAL_{:#x}:",pc.val).c_str()); - this->gen_sync(jh, PRE_SYNC, 2); + gen_sync(jh, PRE_SYNC, 2); mov(cc, jh.pc, pc.val); pc = pc+4; mov(cc, jh.next_pc, pc.val); @@ -455,7 +456,7 @@ private: auto returnValue = BRANCH; gen_instr_epilogue(jh); - this->gen_sync(jh, POST_SYNC, 2); + gen_sync(jh, POST_SYNC, 2); return returnValue; } @@ -482,7 +483,7 @@ private: } x86::Compiler& cc = jh.cc; cc.comment(fmt::format("JALR_{:#x}:",pc.val).c_str()); - this->gen_sync(jh, PRE_SYNC, 3); + gen_sync(jh, PRE_SYNC, 3); mov(cc, jh.pc, pc.val); pc = pc+4; mov(cc, jh.next_pc, pc.val); @@ -495,12 +496,12 @@ private: } else{ auto addr_mask = (uint32_t)- 2; - auto new_pc = gen_ext(jh, - (gen_operation(jh, band, (gen_operation(jh, add, load_reg_from_mem(jh, traits::X0 + rs1), (int16_t)sext<12>(imm)) + auto new_pc = gen_ext(cc, + (gen_operation(cc, band, (gen_operation(cc, add, load_reg_from_mem(jh, traits::X0 + rs1), (int16_t)sext<12>(imm)) ), addr_mask) ), 32, true); auto label_merge = cc.newLabel(); - cmp(cc, gen_operation(jh, urem, new_pc, static_cast(traits::INSTR_ALIGNMENT)) + cmp(cc, gen_operation(cc, urem, new_pc, static_cast(traits::INSTR_ALIGNMENT)) ,0); auto label_else = cc.newLabel(); cc.je(label_else); @@ -523,7 +524,7 @@ private: auto returnValue = BRANCH; gen_instr_epilogue(jh); - this->gen_sync(jh, POST_SYNC, 3); + gen_sync(jh, POST_SYNC, 3); return returnValue; } @@ -550,7 +551,7 @@ private: } x86::Compiler& cc = jh.cc; cc.comment(fmt::format("BEQ_{:#x}:",pc.val).c_str()); - this->gen_sync(jh, PRE_SYNC, 4); + gen_sync(jh, PRE_SYNC, 4); mov(cc, jh.pc, pc.val); pc = pc+4; mov(cc, jh.next_pc, pc.val); @@ -563,7 +564,7 @@ private: } else{ auto label_merge = cc.newLabel(); - cmp(cc, gen_operation(jh, eq, load_reg_from_mem(jh, traits::X0 + rs1), load_reg_from_mem(jh, traits::X0 + rs2)) + cmp(cc, gen_operation(cc, eq, load_reg_from_mem(jh, traits::X0 + rs1), load_reg_from_mem(jh, traits::X0 + rs2)) ,0); cc.je(label_merge); { @@ -581,7 +582,7 @@ private: auto returnValue = BRANCH; gen_instr_epilogue(jh); - this->gen_sync(jh, POST_SYNC, 4); + gen_sync(jh, POST_SYNC, 4); return returnValue; } @@ -608,7 +609,7 @@ private: } x86::Compiler& cc = jh.cc; cc.comment(fmt::format("BNE_{:#x}:",pc.val).c_str()); - this->gen_sync(jh, PRE_SYNC, 5); + gen_sync(jh, PRE_SYNC, 5); mov(cc, jh.pc, pc.val); pc = pc+4; mov(cc, jh.next_pc, pc.val); @@ -621,7 +622,7 @@ private: } else{ auto label_merge = cc.newLabel(); - cmp(cc, gen_operation(jh, ne, load_reg_from_mem(jh, traits::X0 + rs1), load_reg_from_mem(jh, traits::X0 + rs2)) + cmp(cc, gen_operation(cc, ne, load_reg_from_mem(jh, traits::X0 + rs1), load_reg_from_mem(jh, traits::X0 + rs2)) ,0); cc.je(label_merge); { @@ -639,7 +640,7 @@ private: auto returnValue = BRANCH; gen_instr_epilogue(jh); - this->gen_sync(jh, POST_SYNC, 5); + gen_sync(jh, POST_SYNC, 5); return returnValue; } @@ -666,7 +667,7 @@ private: } x86::Compiler& cc = jh.cc; cc.comment(fmt::format("BLT_{:#x}:",pc.val).c_str()); - this->gen_sync(jh, PRE_SYNC, 6); + gen_sync(jh, PRE_SYNC, 6); mov(cc, jh.pc, pc.val); pc = pc+4; mov(cc, jh.next_pc, pc.val); @@ -679,8 +680,8 @@ private: } else{ auto label_merge = cc.newLabel(); - cmp(cc, gen_operation(jh, lt, gen_ext(jh, - load_reg_from_mem(jh, traits::X0 + rs1), 32, false), gen_ext(jh, + cmp(cc, gen_operation(cc, lt, gen_ext(cc, + load_reg_from_mem(jh, traits::X0 + rs1), 32, false), gen_ext(cc, load_reg_from_mem(jh, traits::X0 + rs2), 32, false)) ,0); cc.je(label_merge); @@ -699,7 +700,7 @@ private: auto returnValue = BRANCH; gen_instr_epilogue(jh); - this->gen_sync(jh, POST_SYNC, 6); + gen_sync(jh, POST_SYNC, 6); return returnValue; } @@ -726,7 +727,7 @@ private: } x86::Compiler& cc = jh.cc; cc.comment(fmt::format("BGE_{:#x}:",pc.val).c_str()); - this->gen_sync(jh, PRE_SYNC, 7); + gen_sync(jh, PRE_SYNC, 7); mov(cc, jh.pc, pc.val); pc = pc+4; mov(cc, jh.next_pc, pc.val); @@ -739,8 +740,8 @@ private: } else{ auto label_merge = cc.newLabel(); - cmp(cc, gen_operation(jh, gte, gen_ext(jh, - load_reg_from_mem(jh, traits::X0 + rs1), 32, false), gen_ext(jh, + cmp(cc, gen_operation(cc, gte, gen_ext(cc, + load_reg_from_mem(jh, traits::X0 + rs1), 32, false), gen_ext(cc, load_reg_from_mem(jh, traits::X0 + rs2), 32, false)) ,0); cc.je(label_merge); @@ -759,7 +760,7 @@ private: auto returnValue = BRANCH; gen_instr_epilogue(jh); - this->gen_sync(jh, POST_SYNC, 7); + gen_sync(jh, POST_SYNC, 7); return returnValue; } @@ -786,7 +787,7 @@ private: } x86::Compiler& cc = jh.cc; cc.comment(fmt::format("BLTU_{:#x}:",pc.val).c_str()); - this->gen_sync(jh, PRE_SYNC, 8); + gen_sync(jh, PRE_SYNC, 8); mov(cc, jh.pc, pc.val); pc = pc+4; mov(cc, jh.next_pc, pc.val); @@ -799,7 +800,7 @@ private: } else{ auto label_merge = cc.newLabel(); - cmp(cc, gen_operation(jh, ltu, load_reg_from_mem(jh, traits::X0 + rs1), load_reg_from_mem(jh, traits::X0 + rs2)) + cmp(cc, gen_operation(cc, ltu, load_reg_from_mem(jh, traits::X0 + rs1), load_reg_from_mem(jh, traits::X0 + rs2)) ,0); cc.je(label_merge); { @@ -817,7 +818,7 @@ private: auto returnValue = BRANCH; gen_instr_epilogue(jh); - this->gen_sync(jh, POST_SYNC, 8); + gen_sync(jh, POST_SYNC, 8); return returnValue; } @@ -844,7 +845,7 @@ private: } x86::Compiler& cc = jh.cc; cc.comment(fmt::format("BGEU_{:#x}:",pc.val).c_str()); - this->gen_sync(jh, PRE_SYNC, 9); + gen_sync(jh, PRE_SYNC, 9); mov(cc, jh.pc, pc.val); pc = pc+4; mov(cc, jh.next_pc, pc.val); @@ -857,7 +858,7 @@ private: } else{ auto label_merge = cc.newLabel(); - cmp(cc, gen_operation(jh, gteu, load_reg_from_mem(jh, traits::X0 + rs1), load_reg_from_mem(jh, traits::X0 + rs2)) + cmp(cc, gen_operation(cc, gteu, load_reg_from_mem(jh, traits::X0 + rs1), load_reg_from_mem(jh, traits::X0 + rs2)) ,0); cc.je(label_merge); { @@ -875,7 +876,7 @@ private: auto returnValue = BRANCH; gen_instr_epilogue(jh); - this->gen_sync(jh, POST_SYNC, 9); + gen_sync(jh, POST_SYNC, 9); return returnValue; } @@ -902,7 +903,7 @@ private: } x86::Compiler& cc = jh.cc; cc.comment(fmt::format("LB_{:#x}:",pc.val).c_str()); - this->gen_sync(jh, PRE_SYNC, 10); + gen_sync(jh, PRE_SYNC, 10); mov(cc, jh.pc, pc.val); pc = pc+4; mov(cc, jh.next_pc, pc.val); @@ -914,21 +915,21 @@ private: gen_raise(jh, 0, static_cast(traits::RV_CAUSE_ILLEGAL_INSTRUCTION)); } else{ - auto load_address = gen_ext(jh, - (gen_operation(jh, add, load_reg_from_mem(jh, traits::X0 + rs1), (int16_t)sext<12>(imm)) + auto load_address = gen_ext(cc, + (gen_operation(cc, add, load_reg_from_mem(jh, traits::X0 + rs1), (int16_t)sext<12>(imm)) ), 32, true); - auto res = gen_ext(jh, + auto res = gen_ext(cc, gen_read_mem(jh, traits::MEM, load_address, 1), 8, false); if(rd!=0){ mov(cc, get_ptr_for(jh, traits::X0+ rd), - gen_ext(jh, + gen_ext(cc, res, 32, true)); } } auto returnValue = CONT; gen_instr_epilogue(jh); - this->gen_sync(jh, POST_SYNC, 10); + gen_sync(jh, POST_SYNC, 10); return returnValue; } @@ -955,7 +956,7 @@ private: } x86::Compiler& cc = jh.cc; cc.comment(fmt::format("LH_{:#x}:",pc.val).c_str()); - this->gen_sync(jh, PRE_SYNC, 11); + gen_sync(jh, PRE_SYNC, 11); mov(cc, jh.pc, pc.val); pc = pc+4; mov(cc, jh.next_pc, pc.val); @@ -967,21 +968,21 @@ private: gen_raise(jh, 0, static_cast(traits::RV_CAUSE_ILLEGAL_INSTRUCTION)); } else{ - auto load_address = gen_ext(jh, - (gen_operation(jh, add, load_reg_from_mem(jh, traits::X0 + rs1), (int16_t)sext<12>(imm)) + auto load_address = gen_ext(cc, + (gen_operation(cc, add, load_reg_from_mem(jh, traits::X0 + rs1), (int16_t)sext<12>(imm)) ), 32, true); - auto res = gen_ext(jh, + auto res = gen_ext(cc, gen_read_mem(jh, traits::MEM, load_address, 2), 16, false); if(rd!=0){ mov(cc, get_ptr_for(jh, traits::X0+ rd), - gen_ext(jh, + gen_ext(cc, res, 32, true)); } } auto returnValue = CONT; gen_instr_epilogue(jh); - this->gen_sync(jh, POST_SYNC, 11); + gen_sync(jh, POST_SYNC, 11); return returnValue; } @@ -1008,7 +1009,7 @@ private: } x86::Compiler& cc = jh.cc; cc.comment(fmt::format("LW_{:#x}:",pc.val).c_str()); - this->gen_sync(jh, PRE_SYNC, 12); + gen_sync(jh, PRE_SYNC, 12); mov(cc, jh.pc, pc.val); pc = pc+4; mov(cc, jh.next_pc, pc.val); @@ -1020,21 +1021,21 @@ private: gen_raise(jh, 0, static_cast(traits::RV_CAUSE_ILLEGAL_INSTRUCTION)); } else{ - auto load_address = gen_ext(jh, - (gen_operation(jh, add, load_reg_from_mem(jh, traits::X0 + rs1), (int16_t)sext<12>(imm)) + auto load_address = gen_ext(cc, + (gen_operation(cc, add, load_reg_from_mem(jh, traits::X0 + rs1), (int16_t)sext<12>(imm)) ), 32, true); - auto res = gen_ext(jh, + auto res = gen_ext(cc, gen_read_mem(jh, traits::MEM, load_address, 4), 32, false); if(rd!=0){ mov(cc, get_ptr_for(jh, traits::X0+ rd), - gen_ext(jh, + gen_ext(cc, res, 32, true)); } } auto returnValue = CONT; gen_instr_epilogue(jh); - this->gen_sync(jh, POST_SYNC, 12); + gen_sync(jh, POST_SYNC, 12); return returnValue; } @@ -1061,7 +1062,7 @@ private: } x86::Compiler& cc = jh.cc; cc.comment(fmt::format("LBU_{:#x}:",pc.val).c_str()); - this->gen_sync(jh, PRE_SYNC, 13); + gen_sync(jh, PRE_SYNC, 13); mov(cc, jh.pc, pc.val); pc = pc+4; mov(cc, jh.next_pc, pc.val); @@ -1073,20 +1074,20 @@ private: gen_raise(jh, 0, static_cast(traits::RV_CAUSE_ILLEGAL_INSTRUCTION)); } else{ - auto load_address = gen_ext(jh, - (gen_operation(jh, add, load_reg_from_mem(jh, traits::X0 + rs1), (int16_t)sext<12>(imm)) + auto load_address = gen_ext(cc, + (gen_operation(cc, add, load_reg_from_mem(jh, traits::X0 + rs1), (int16_t)sext<12>(imm)) ), 32, true); auto res = gen_read_mem(jh, traits::MEM, load_address, 1); if(rd!=0){ mov(cc, get_ptr_for(jh, traits::X0+ rd), - gen_ext(jh, + gen_ext(cc, res, 32, false)); } } auto returnValue = CONT; gen_instr_epilogue(jh); - this->gen_sync(jh, POST_SYNC, 13); + gen_sync(jh, POST_SYNC, 13); return returnValue; } @@ -1113,7 +1114,7 @@ private: } x86::Compiler& cc = jh.cc; cc.comment(fmt::format("LHU_{:#x}:",pc.val).c_str()); - this->gen_sync(jh, PRE_SYNC, 14); + gen_sync(jh, PRE_SYNC, 14); mov(cc, jh.pc, pc.val); pc = pc+4; mov(cc, jh.next_pc, pc.val); @@ -1125,20 +1126,20 @@ private: gen_raise(jh, 0, static_cast(traits::RV_CAUSE_ILLEGAL_INSTRUCTION)); } else{ - auto load_address = gen_ext(jh, - (gen_operation(jh, add, load_reg_from_mem(jh, traits::X0 + rs1), (int16_t)sext<12>(imm)) + auto load_address = gen_ext(cc, + (gen_operation(cc, add, load_reg_from_mem(jh, traits::X0 + rs1), (int16_t)sext<12>(imm)) ), 32, true); auto res = gen_read_mem(jh, traits::MEM, load_address, 2); if(rd!=0){ mov(cc, get_ptr_for(jh, traits::X0+ rd), - gen_ext(jh, + gen_ext(cc, res, 32, false)); } } auto returnValue = CONT; gen_instr_epilogue(jh); - this->gen_sync(jh, POST_SYNC, 14); + gen_sync(jh, POST_SYNC, 14); return returnValue; } @@ -1165,7 +1166,7 @@ private: } x86::Compiler& cc = jh.cc; cc.comment(fmt::format("SB_{:#x}:",pc.val).c_str()); - this->gen_sync(jh, PRE_SYNC, 15); + gen_sync(jh, PRE_SYNC, 15); mov(cc, jh.pc, pc.val); pc = pc+4; mov(cc, jh.next_pc, pc.val); @@ -1177,16 +1178,16 @@ private: gen_raise(jh, 0, static_cast(traits::RV_CAUSE_ILLEGAL_INSTRUCTION)); } else{ - auto store_address = gen_ext(jh, - (gen_operation(jh, add, load_reg_from_mem(jh, traits::X0 + rs1), (int16_t)sext<12>(imm)) + auto store_address = gen_ext(cc, + (gen_operation(cc, add, load_reg_from_mem(jh, traits::X0 + rs1), (int16_t)sext<12>(imm)) ), 32, true); - gen_write_mem(jh, traits::MEM, store_address, gen_ext(jh, + gen_write_mem(jh, traits::MEM, store_address, gen_ext(cc, load_reg_from_mem(jh, traits::X0 + rs2), 8, false), 1); } auto returnValue = CONT; gen_instr_epilogue(jh); - this->gen_sync(jh, POST_SYNC, 15); + gen_sync(jh, POST_SYNC, 15); return returnValue; } @@ -1213,7 +1214,7 @@ private: } x86::Compiler& cc = jh.cc; cc.comment(fmt::format("SH_{:#x}:",pc.val).c_str()); - this->gen_sync(jh, PRE_SYNC, 16); + gen_sync(jh, PRE_SYNC, 16); mov(cc, jh.pc, pc.val); pc = pc+4; mov(cc, jh.next_pc, pc.val); @@ -1225,16 +1226,16 @@ private: gen_raise(jh, 0, static_cast(traits::RV_CAUSE_ILLEGAL_INSTRUCTION)); } else{ - auto store_address = gen_ext(jh, - (gen_operation(jh, add, load_reg_from_mem(jh, traits::X0 + rs1), (int16_t)sext<12>(imm)) + auto store_address = gen_ext(cc, + (gen_operation(cc, add, load_reg_from_mem(jh, traits::X0 + rs1), (int16_t)sext<12>(imm)) ), 32, true); - gen_write_mem(jh, traits::MEM, store_address, gen_ext(jh, + gen_write_mem(jh, traits::MEM, store_address, gen_ext(cc, load_reg_from_mem(jh, traits::X0 + rs2), 16, false), 2); } auto returnValue = CONT; gen_instr_epilogue(jh); - this->gen_sync(jh, POST_SYNC, 16); + gen_sync(jh, POST_SYNC, 16); return returnValue; } @@ -1261,7 +1262,7 @@ private: } x86::Compiler& cc = jh.cc; cc.comment(fmt::format("SW_{:#x}:",pc.val).c_str()); - this->gen_sync(jh, PRE_SYNC, 17); + gen_sync(jh, PRE_SYNC, 17); mov(cc, jh.pc, pc.val); pc = pc+4; mov(cc, jh.next_pc, pc.val); @@ -1273,16 +1274,16 @@ private: gen_raise(jh, 0, static_cast(traits::RV_CAUSE_ILLEGAL_INSTRUCTION)); } else{ - auto store_address = gen_ext(jh, - (gen_operation(jh, add, load_reg_from_mem(jh, traits::X0 + rs1), (int16_t)sext<12>(imm)) + auto store_address = gen_ext(cc, + (gen_operation(cc, add, load_reg_from_mem(jh, traits::X0 + rs1), (int16_t)sext<12>(imm)) ), 32, true); - gen_write_mem(jh, traits::MEM, store_address, gen_ext(jh, + gen_write_mem(jh, traits::MEM, store_address, gen_ext(cc, load_reg_from_mem(jh, traits::X0 + rs2), 32, false), 4); } auto returnValue = CONT; gen_instr_epilogue(jh); - this->gen_sync(jh, POST_SYNC, 17); + gen_sync(jh, POST_SYNC, 17); return returnValue; } @@ -1309,7 +1310,7 @@ private: } x86::Compiler& cc = jh.cc; cc.comment(fmt::format("ADDI_{:#x}:",pc.val).c_str()); - this->gen_sync(jh, PRE_SYNC, 18); + gen_sync(jh, PRE_SYNC, 18); mov(cc, jh.pc, pc.val); pc = pc+4; mov(cc, jh.next_pc, pc.val); @@ -1323,15 +1324,15 @@ private: else{ if(rd!=0){ mov(cc, get_ptr_for(jh, traits::X0+ rd), - gen_ext(jh, - (gen_operation(jh, add, load_reg_from_mem(jh, traits::X0 + rs1), (int16_t)sext<12>(imm)) + gen_ext(cc, + (gen_operation(cc, add, load_reg_from_mem(jh, traits::X0 + rs1), (int16_t)sext<12>(imm)) ), 32, true)); } } auto returnValue = CONT; gen_instr_epilogue(jh); - this->gen_sync(jh, POST_SYNC, 18); + gen_sync(jh, POST_SYNC, 18); return returnValue; } @@ -1358,7 +1359,7 @@ private: } x86::Compiler& cc = jh.cc; cc.comment(fmt::format("SLTI_{:#x}:",pc.val).c_str()); - this->gen_sync(jh, PRE_SYNC, 19); + gen_sync(jh, PRE_SYNC, 19); mov(cc, jh.pc, pc.val); pc = pc+4; mov(cc, jh.next_pc, pc.val); @@ -1374,8 +1375,8 @@ private: { auto label_then = cc.newLabel(); auto label_merge = cc.newLabel(); - auto tmp_reg = get_reg_for(jh, 1); - cmp(cc, gen_ext(jh, + auto tmp_reg = get_reg_for(cc, 1); + cmp(cc, gen_ext(cc, load_reg_from_mem(jh, traits::X0 + rs1), 32, true), (int16_t)sext<12>(imm)); cc.jl(label_then); mov(cc, tmp_reg,0); @@ -1384,7 +1385,7 @@ private: mov(cc, tmp_reg,1); cc.bind(label_merge); mov(cc, get_ptr_for(jh, traits::X0+ rd), - gen_ext(jh, tmp_reg + gen_ext(cc, tmp_reg , 32, false) ); } @@ -1393,7 +1394,7 @@ private: auto returnValue = CONT; gen_instr_epilogue(jh); - this->gen_sync(jh, POST_SYNC, 19); + gen_sync(jh, POST_SYNC, 19); return returnValue; } @@ -1420,7 +1421,7 @@ private: } x86::Compiler& cc = jh.cc; cc.comment(fmt::format("SLTIU_{:#x}:",pc.val).c_str()); - this->gen_sync(jh, PRE_SYNC, 20); + gen_sync(jh, PRE_SYNC, 20); mov(cc, jh.pc, pc.val); pc = pc+4; mov(cc, jh.next_pc, pc.val); @@ -1436,7 +1437,7 @@ private: { auto label_then = cc.newLabel(); auto label_merge = cc.newLabel(); - auto tmp_reg = get_reg_for(jh, 1); + auto tmp_reg = get_reg_for(cc, 1); cmp(cc, load_reg_from_mem(jh, traits::X0 + rs1), (uint32_t)((int16_t)sext<12>(imm))); cc.jb(label_then); mov(cc, tmp_reg,0); @@ -1445,7 +1446,7 @@ private: mov(cc, tmp_reg,1); cc.bind(label_merge); mov(cc, get_ptr_for(jh, traits::X0+ rd), - gen_ext(jh, tmp_reg + gen_ext(cc, tmp_reg , 32, false) ); } @@ -1454,7 +1455,7 @@ private: auto returnValue = CONT; gen_instr_epilogue(jh); - this->gen_sync(jh, POST_SYNC, 20); + gen_sync(jh, POST_SYNC, 20); return returnValue; } @@ -1481,7 +1482,7 @@ private: } x86::Compiler& cc = jh.cc; cc.comment(fmt::format("XORI_{:#x}:",pc.val).c_str()); - this->gen_sync(jh, PRE_SYNC, 21); + gen_sync(jh, PRE_SYNC, 21); mov(cc, jh.pc, pc.val); pc = pc+4; mov(cc, jh.next_pc, pc.val); @@ -1495,14 +1496,14 @@ private: else{ if(rd!=0){ mov(cc, get_ptr_for(jh, traits::X0+ rd), - gen_operation(jh, bxor, load_reg_from_mem(jh, traits::X0 + rs1), (uint32_t)((int16_t)sext<12>(imm))) + gen_operation(cc, bxor, load_reg_from_mem(jh, traits::X0 + rs1), (uint32_t)((int16_t)sext<12>(imm))) ); } } auto returnValue = CONT; gen_instr_epilogue(jh); - this->gen_sync(jh, POST_SYNC, 21); + gen_sync(jh, POST_SYNC, 21); return returnValue; } @@ -1529,7 +1530,7 @@ private: } x86::Compiler& cc = jh.cc; cc.comment(fmt::format("ORI_{:#x}:",pc.val).c_str()); - this->gen_sync(jh, PRE_SYNC, 22); + gen_sync(jh, PRE_SYNC, 22); mov(cc, jh.pc, pc.val); pc = pc+4; mov(cc, jh.next_pc, pc.val); @@ -1543,14 +1544,14 @@ private: else{ if(rd!=0){ mov(cc, get_ptr_for(jh, traits::X0+ rd), - gen_operation(jh, bor, load_reg_from_mem(jh, traits::X0 + rs1), (uint32_t)((int16_t)sext<12>(imm))) + gen_operation(cc, bor, load_reg_from_mem(jh, traits::X0 + rs1), (uint32_t)((int16_t)sext<12>(imm))) ); } } auto returnValue = CONT; gen_instr_epilogue(jh); - this->gen_sync(jh, POST_SYNC, 22); + gen_sync(jh, POST_SYNC, 22); return returnValue; } @@ -1577,7 +1578,7 @@ private: } x86::Compiler& cc = jh.cc; cc.comment(fmt::format("ANDI_{:#x}:",pc.val).c_str()); - this->gen_sync(jh, PRE_SYNC, 23); + gen_sync(jh, PRE_SYNC, 23); mov(cc, jh.pc, pc.val); pc = pc+4; mov(cc, jh.next_pc, pc.val); @@ -1591,14 +1592,14 @@ private: else{ if(rd!=0){ mov(cc, get_ptr_for(jh, traits::X0+ rd), - gen_operation(jh, band, load_reg_from_mem(jh, traits::X0 + rs1), (uint32_t)((int16_t)sext<12>(imm))) + gen_operation(cc, band, load_reg_from_mem(jh, traits::X0 + rs1), (uint32_t)((int16_t)sext<12>(imm))) ); } } auto returnValue = CONT; gen_instr_epilogue(jh); - this->gen_sync(jh, POST_SYNC, 23); + gen_sync(jh, POST_SYNC, 23); return returnValue; } @@ -1625,7 +1626,7 @@ private: } x86::Compiler& cc = jh.cc; cc.comment(fmt::format("SLLI_{:#x}:",pc.val).c_str()); - this->gen_sync(jh, PRE_SYNC, 24); + gen_sync(jh, PRE_SYNC, 24); mov(cc, jh.pc, pc.val); pc = pc+4; mov(cc, jh.next_pc, pc.val); @@ -1639,14 +1640,14 @@ private: else{ if(rd!=0){ mov(cc, get_ptr_for(jh, traits::X0+ rd), - gen_operation(jh, shl, load_reg_from_mem(jh, traits::X0 + rs1), shamt) + gen_operation(cc, shl, load_reg_from_mem(jh, traits::X0 + rs1), shamt) ); } } auto returnValue = CONT; gen_instr_epilogue(jh); - this->gen_sync(jh, POST_SYNC, 24); + gen_sync(jh, POST_SYNC, 24); return returnValue; } @@ -1673,7 +1674,7 @@ private: } x86::Compiler& cc = jh.cc; cc.comment(fmt::format("SRLI_{:#x}:",pc.val).c_str()); - this->gen_sync(jh, PRE_SYNC, 25); + gen_sync(jh, PRE_SYNC, 25); mov(cc, jh.pc, pc.val); pc = pc+4; mov(cc, jh.next_pc, pc.val); @@ -1687,14 +1688,14 @@ private: else{ if(rd!=0){ mov(cc, get_ptr_for(jh, traits::X0+ rd), - gen_operation(jh, shr, load_reg_from_mem(jh, traits::X0 + rs1), shamt) + gen_operation(cc, shr, load_reg_from_mem(jh, traits::X0 + rs1), shamt) ); } } auto returnValue = CONT; gen_instr_epilogue(jh); - this->gen_sync(jh, POST_SYNC, 25); + gen_sync(jh, POST_SYNC, 25); return returnValue; } @@ -1721,7 +1722,7 @@ private: } x86::Compiler& cc = jh.cc; cc.comment(fmt::format("SRAI_{:#x}:",pc.val).c_str()); - this->gen_sync(jh, PRE_SYNC, 26); + gen_sync(jh, PRE_SYNC, 26); mov(cc, jh.pc, pc.val); pc = pc+4; mov(cc, jh.next_pc, pc.val); @@ -1735,8 +1736,8 @@ private: else{ if(rd!=0){ mov(cc, get_ptr_for(jh, traits::X0+ rd), - gen_ext(jh, - (gen_operation(jh, sar, gen_ext(jh, + gen_ext(cc, + (gen_operation(cc, sar, gen_ext(cc, load_reg_from_mem(jh, traits::X0 + rs1), 32, true), shamt) ), 32, false)); } @@ -1744,7 +1745,7 @@ private: auto returnValue = CONT; gen_instr_epilogue(jh); - this->gen_sync(jh, POST_SYNC, 26); + gen_sync(jh, POST_SYNC, 26); return returnValue; } @@ -1771,7 +1772,7 @@ private: } x86::Compiler& cc = jh.cc; cc.comment(fmt::format("ADD_{:#x}:",pc.val).c_str()); - this->gen_sync(jh, PRE_SYNC, 27); + gen_sync(jh, PRE_SYNC, 27); mov(cc, jh.pc, pc.val); pc = pc+4; mov(cc, jh.next_pc, pc.val); @@ -1785,15 +1786,15 @@ private: else{ if(rd!=0){ mov(cc, get_ptr_for(jh, traits::X0+ rd), - gen_ext(jh, - (gen_operation(jh, add, load_reg_from_mem(jh, traits::X0 + rs1), load_reg_from_mem(jh, traits::X0 + rs2)) + gen_ext(cc, + (gen_operation(cc, add, load_reg_from_mem(jh, traits::X0 + rs1), load_reg_from_mem(jh, traits::X0 + rs2)) ), 32, false)); } } auto returnValue = CONT; gen_instr_epilogue(jh); - this->gen_sync(jh, POST_SYNC, 27); + gen_sync(jh, POST_SYNC, 27); return returnValue; } @@ -1820,7 +1821,7 @@ private: } x86::Compiler& cc = jh.cc; cc.comment(fmt::format("SUB_{:#x}:",pc.val).c_str()); - this->gen_sync(jh, PRE_SYNC, 28); + gen_sync(jh, PRE_SYNC, 28); mov(cc, jh.pc, pc.val); pc = pc+4; mov(cc, jh.next_pc, pc.val); @@ -1834,15 +1835,15 @@ private: else{ if(rd!=0){ mov(cc, get_ptr_for(jh, traits::X0+ rd), - gen_ext(jh, - (gen_operation(jh, sub, load_reg_from_mem(jh, traits::X0 + rs1), load_reg_from_mem(jh, traits::X0 + rs2)) + gen_ext(cc, + (gen_operation(cc, sub, load_reg_from_mem(jh, traits::X0 + rs1), load_reg_from_mem(jh, traits::X0 + rs2)) ), 32, true)); } } auto returnValue = CONT; gen_instr_epilogue(jh); - this->gen_sync(jh, POST_SYNC, 28); + gen_sync(jh, POST_SYNC, 28); return returnValue; } @@ -1869,7 +1870,7 @@ private: } x86::Compiler& cc = jh.cc; cc.comment(fmt::format("SLL_{:#x}:",pc.val).c_str()); - this->gen_sync(jh, PRE_SYNC, 29); + gen_sync(jh, PRE_SYNC, 29); mov(cc, jh.pc, pc.val); pc = pc+4; mov(cc, jh.next_pc, pc.val); @@ -1883,7 +1884,7 @@ private: else{ if(rd!=0){ mov(cc, get_ptr_for(jh, traits::X0+ rd), - gen_ext(jh, gen_operation(jh, shl, load_reg_from_mem(jh, traits::X0 + rs1), (gen_operation(jh, band, load_reg_from_mem(jh, traits::X0 + rs2), (static_cast(traits::XLEN)-1)) + gen_ext(cc, gen_operation(cc, shl, load_reg_from_mem(jh, traits::X0 + rs1), (gen_operation(cc, band, load_reg_from_mem(jh, traits::X0 + rs2), (static_cast(traits::XLEN)-1)) )) , 32, false)); } @@ -1891,7 +1892,7 @@ private: auto returnValue = CONT; gen_instr_epilogue(jh); - this->gen_sync(jh, POST_SYNC, 29); + gen_sync(jh, POST_SYNC, 29); return returnValue; } @@ -1918,7 +1919,7 @@ private: } x86::Compiler& cc = jh.cc; cc.comment(fmt::format("SLT_{:#x}:",pc.val).c_str()); - this->gen_sync(jh, PRE_SYNC, 30); + gen_sync(jh, PRE_SYNC, 30); mov(cc, jh.pc, pc.val); pc = pc+4; mov(cc, jh.next_pc, pc.val); @@ -1934,9 +1935,9 @@ private: { auto label_then = cc.newLabel(); auto label_merge = cc.newLabel(); - auto tmp_reg = get_reg_for(jh, 1); - cmp(cc, gen_ext(jh, - load_reg_from_mem(jh, traits::X0 + rs1), 32, true), gen_ext(jh, + auto tmp_reg = get_reg_for(cc, 1); + cmp(cc, gen_ext(cc, + load_reg_from_mem(jh, traits::X0 + rs1), 32, true), gen_ext(cc, load_reg_from_mem(jh, traits::X0 + rs2), 32, true)); cc.jl(label_then); mov(cc, tmp_reg,0); @@ -1945,7 +1946,7 @@ private: mov(cc, tmp_reg,1); cc.bind(label_merge); mov(cc, get_ptr_for(jh, traits::X0+ rd), - gen_ext(jh, tmp_reg + gen_ext(cc, tmp_reg , 32, false) ); } @@ -1954,7 +1955,7 @@ private: auto returnValue = CONT; gen_instr_epilogue(jh); - this->gen_sync(jh, POST_SYNC, 30); + gen_sync(jh, POST_SYNC, 30); return returnValue; } @@ -1981,7 +1982,7 @@ private: } x86::Compiler& cc = jh.cc; cc.comment(fmt::format("SLTU_{:#x}:",pc.val).c_str()); - this->gen_sync(jh, PRE_SYNC, 31); + gen_sync(jh, PRE_SYNC, 31); mov(cc, jh.pc, pc.val); pc = pc+4; mov(cc, jh.next_pc, pc.val); @@ -1997,7 +1998,7 @@ private: { auto label_then = cc.newLabel(); auto label_merge = cc.newLabel(); - auto tmp_reg = get_reg_for(jh, 1); + auto tmp_reg = get_reg_for(cc, 1); cmp(cc, load_reg_from_mem(jh, traits::X0 + rs1), load_reg_from_mem(jh, traits::X0 + rs2)); cc.jb(label_then); mov(cc, tmp_reg,0); @@ -2006,7 +2007,7 @@ private: mov(cc, tmp_reg,1); cc.bind(label_merge); mov(cc, get_ptr_for(jh, traits::X0+ rd), - gen_ext(jh, tmp_reg + gen_ext(cc, tmp_reg , 32, false) ); } @@ -2015,7 +2016,7 @@ private: auto returnValue = CONT; gen_instr_epilogue(jh); - this->gen_sync(jh, POST_SYNC, 31); + gen_sync(jh, POST_SYNC, 31); return returnValue; } @@ -2042,7 +2043,7 @@ private: } x86::Compiler& cc = jh.cc; cc.comment(fmt::format("XOR_{:#x}:",pc.val).c_str()); - this->gen_sync(jh, PRE_SYNC, 32); + gen_sync(jh, PRE_SYNC, 32); mov(cc, jh.pc, pc.val); pc = pc+4; mov(cc, jh.next_pc, pc.val); @@ -2056,14 +2057,14 @@ private: else{ if(rd!=0){ mov(cc, get_ptr_for(jh, traits::X0+ rd), - gen_operation(jh, bxor, load_reg_from_mem(jh, traits::X0 + rs1), load_reg_from_mem(jh, traits::X0 + rs2)) + gen_operation(cc, bxor, load_reg_from_mem(jh, traits::X0 + rs1), load_reg_from_mem(jh, traits::X0 + rs2)) ); } } auto returnValue = CONT; gen_instr_epilogue(jh); - this->gen_sync(jh, POST_SYNC, 32); + gen_sync(jh, POST_SYNC, 32); return returnValue; } @@ -2090,7 +2091,7 @@ private: } x86::Compiler& cc = jh.cc; cc.comment(fmt::format("SRL_{:#x}:",pc.val).c_str()); - this->gen_sync(jh, PRE_SYNC, 33); + gen_sync(jh, PRE_SYNC, 33); mov(cc, jh.pc, pc.val); pc = pc+4; mov(cc, jh.next_pc, pc.val); @@ -2104,7 +2105,7 @@ private: else{ if(rd!=0){ mov(cc, get_ptr_for(jh, traits::X0+ rd), - gen_ext(jh, gen_operation(jh, shr, load_reg_from_mem(jh, traits::X0 + rs1), (gen_operation(jh, band, load_reg_from_mem(jh, traits::X0 + rs2), (static_cast(traits::XLEN)-1)) + gen_ext(cc, gen_operation(cc, shr, load_reg_from_mem(jh, traits::X0 + rs1), (gen_operation(cc, band, load_reg_from_mem(jh, traits::X0 + rs2), (static_cast(traits::XLEN)-1)) )) , 32, false)); } @@ -2112,7 +2113,7 @@ private: auto returnValue = CONT; gen_instr_epilogue(jh); - this->gen_sync(jh, POST_SYNC, 33); + gen_sync(jh, POST_SYNC, 33); return returnValue; } @@ -2139,7 +2140,7 @@ private: } x86::Compiler& cc = jh.cc; cc.comment(fmt::format("SRA_{:#x}:",pc.val).c_str()); - this->gen_sync(jh, PRE_SYNC, 34); + gen_sync(jh, PRE_SYNC, 34); mov(cc, jh.pc, pc.val); pc = pc+4; mov(cc, jh.next_pc, pc.val); @@ -2153,9 +2154,9 @@ private: else{ if(rd!=0){ mov(cc, get_ptr_for(jh, traits::X0+ rd), - gen_ext(jh, - (gen_ext(jh, gen_operation(jh, sar, gen_ext(jh, - load_reg_from_mem(jh, traits::X0 + rs1), 32, true), (gen_operation(jh, band, load_reg_from_mem(jh, traits::X0 + rs2), (static_cast(traits::XLEN)-1)) + gen_ext(cc, + (gen_ext(cc, gen_operation(cc, sar, gen_ext(cc, + load_reg_from_mem(jh, traits::X0 + rs1), 32, true), (gen_operation(cc, band, load_reg_from_mem(jh, traits::X0 + rs2), (static_cast(traits::XLEN)-1)) )) , 32, true)), 32, true)); } @@ -2163,7 +2164,7 @@ private: auto returnValue = CONT; gen_instr_epilogue(jh); - this->gen_sync(jh, POST_SYNC, 34); + gen_sync(jh, POST_SYNC, 34); return returnValue; } @@ -2190,7 +2191,7 @@ private: } x86::Compiler& cc = jh.cc; cc.comment(fmt::format("OR_{:#x}:",pc.val).c_str()); - this->gen_sync(jh, PRE_SYNC, 35); + gen_sync(jh, PRE_SYNC, 35); mov(cc, jh.pc, pc.val); pc = pc+4; mov(cc, jh.next_pc, pc.val); @@ -2204,14 +2205,14 @@ private: else{ if(rd!=0){ mov(cc, get_ptr_for(jh, traits::X0+ rd), - gen_operation(jh, bor, load_reg_from_mem(jh, traits::X0 + rs1), load_reg_from_mem(jh, traits::X0 + rs2)) + gen_operation(cc, bor, load_reg_from_mem(jh, traits::X0 + rs1), load_reg_from_mem(jh, traits::X0 + rs2)) ); } } auto returnValue = CONT; gen_instr_epilogue(jh); - this->gen_sync(jh, POST_SYNC, 35); + gen_sync(jh, POST_SYNC, 35); return returnValue; } @@ -2238,7 +2239,7 @@ private: } x86::Compiler& cc = jh.cc; cc.comment(fmt::format("AND_{:#x}:",pc.val).c_str()); - this->gen_sync(jh, PRE_SYNC, 36); + gen_sync(jh, PRE_SYNC, 36); mov(cc, jh.pc, pc.val); pc = pc+4; mov(cc, jh.next_pc, pc.val); @@ -2252,14 +2253,14 @@ private: else{ if(rd!=0){ mov(cc, get_ptr_for(jh, traits::X0+ rd), - gen_operation(jh, band, load_reg_from_mem(jh, traits::X0 + rs1), load_reg_from_mem(jh, traits::X0 + rs2)) + gen_operation(cc, band, load_reg_from_mem(jh, traits::X0 + rs1), load_reg_from_mem(jh, traits::X0 + rs2)) ); } } auto returnValue = CONT; gen_instr_epilogue(jh); - this->gen_sync(jh, POST_SYNC, 36); + gen_sync(jh, POST_SYNC, 36); return returnValue; } @@ -2288,7 +2289,7 @@ private: } x86::Compiler& cc = jh.cc; cc.comment(fmt::format("FENCE_{:#x}:",pc.val).c_str()); - this->gen_sync(jh, PRE_SYNC, 37); + gen_sync(jh, PRE_SYNC, 37); mov(cc, jh.pc, pc.val); pc = pc+4; mov(cc, jh.next_pc, pc.val); @@ -2300,7 +2301,7 @@ private: auto returnValue = CONT; gen_instr_epilogue(jh); - this->gen_sync(jh, POST_SYNC, 37); + gen_sync(jh, POST_SYNC, 37); return returnValue; } @@ -2323,7 +2324,7 @@ private: } x86::Compiler& cc = jh.cc; cc.comment(fmt::format("ECALL_{:#x}:",pc.val).c_str()); - this->gen_sync(jh, PRE_SYNC, 38); + gen_sync(jh, PRE_SYNC, 38); mov(cc, jh.pc, pc.val); pc = pc+4; mov(cc, jh.next_pc, pc.val); @@ -2335,7 +2336,7 @@ private: auto returnValue = TRAP; gen_instr_epilogue(jh); - this->gen_sync(jh, POST_SYNC, 38); + gen_sync(jh, POST_SYNC, 38); return returnValue; } @@ -2358,7 +2359,7 @@ private: } x86::Compiler& cc = jh.cc; cc.comment(fmt::format("EBREAK_{:#x}:",pc.val).c_str()); - this->gen_sync(jh, PRE_SYNC, 39); + gen_sync(jh, PRE_SYNC, 39); mov(cc, jh.pc, pc.val); pc = pc+4; mov(cc, jh.next_pc, pc.val); @@ -2370,7 +2371,7 @@ private: auto returnValue = TRAP; gen_instr_epilogue(jh); - this->gen_sync(jh, POST_SYNC, 39); + gen_sync(jh, POST_SYNC, 39); return returnValue; } @@ -2393,7 +2394,7 @@ private: } x86::Compiler& cc = jh.cc; cc.comment(fmt::format("MRET_{:#x}:",pc.val).c_str()); - this->gen_sync(jh, PRE_SYNC, 40); + gen_sync(jh, PRE_SYNC, 40); mov(cc, jh.pc, pc.val); pc = pc+4; mov(cc, jh.next_pc, pc.val); @@ -2405,7 +2406,7 @@ private: auto returnValue = TRAP; gen_instr_epilogue(jh); - this->gen_sync(jh, POST_SYNC, 40); + gen_sync(jh, POST_SYNC, 40); return returnValue; } @@ -2428,7 +2429,7 @@ private: } x86::Compiler& cc = jh.cc; cc.comment(fmt::format("WFI_{:#x}:",pc.val).c_str()); - this->gen_sync(jh, PRE_SYNC, 41); + gen_sync(jh, PRE_SYNC, 41); mov(cc, jh.pc, pc.val); pc = pc+4; mov(cc, jh.next_pc, pc.val); @@ -2440,7 +2441,7 @@ private: auto returnValue = CONT; gen_instr_epilogue(jh); - this->gen_sync(jh, POST_SYNC, 41); + gen_sync(jh, POST_SYNC, 41); return returnValue; } @@ -2467,7 +2468,7 @@ private: } x86::Compiler& cc = jh.cc; cc.comment(fmt::format("CSRRW_{:#x}:",pc.val).c_str()); - this->gen_sync(jh, PRE_SYNC, 42); + gen_sync(jh, PRE_SYNC, 42); mov(cc, jh.pc, pc.val); pc = pc+4; mov(cc, jh.next_pc, pc.val); @@ -2493,7 +2494,7 @@ private: auto returnValue = CONT; gen_instr_epilogue(jh); - this->gen_sync(jh, POST_SYNC, 42); + gen_sync(jh, POST_SYNC, 42); return returnValue; } @@ -2520,7 +2521,7 @@ private: } x86::Compiler& cc = jh.cc; cc.comment(fmt::format("CSRRS_{:#x}:",pc.val).c_str()); - this->gen_sync(jh, PRE_SYNC, 43); + gen_sync(jh, PRE_SYNC, 43); mov(cc, jh.pc, pc.val); pc = pc+4; mov(cc, jh.next_pc, pc.val); @@ -2535,7 +2536,7 @@ private: auto xrd = gen_read_mem(jh, traits::CSR, csr, 4); auto xrs1 = load_reg_from_mem(jh, traits::X0 + rs1); if(rs1!=0){ - gen_write_mem(jh, traits::CSR, csr, gen_operation(jh, bor, xrd, xrs1) + gen_write_mem(jh, traits::CSR, csr, gen_operation(cc, bor, xrd, xrs1) , 4); } if(rd!=0){ @@ -2546,7 +2547,7 @@ private: auto returnValue = CONT; gen_instr_epilogue(jh); - this->gen_sync(jh, POST_SYNC, 43); + gen_sync(jh, POST_SYNC, 43); return returnValue; } @@ -2573,7 +2574,7 @@ private: } x86::Compiler& cc = jh.cc; cc.comment(fmt::format("CSRRC_{:#x}:",pc.val).c_str()); - this->gen_sync(jh, PRE_SYNC, 44); + gen_sync(jh, PRE_SYNC, 44); mov(cc, jh.pc, pc.val); pc = pc+4; mov(cc, jh.next_pc, pc.val); @@ -2588,7 +2589,7 @@ private: auto xrd = gen_read_mem(jh, traits::CSR, csr, 4); auto xrs1 = load_reg_from_mem(jh, traits::X0 + rs1); if(rs1!=0){ - gen_write_mem(jh, traits::CSR, csr, gen_operation(jh, band, xrd, gen_operation(jh, bnot, xrs1)) + gen_write_mem(jh, traits::CSR, csr, gen_operation(cc, band, xrd, gen_operation(cc, bnot, xrs1)) , 4); } if(rd!=0){ @@ -2599,7 +2600,7 @@ private: auto returnValue = CONT; gen_instr_epilogue(jh); - this->gen_sync(jh, POST_SYNC, 44); + gen_sync(jh, POST_SYNC, 44); return returnValue; } @@ -2626,7 +2627,7 @@ private: } x86::Compiler& cc = jh.cc; cc.comment(fmt::format("CSRRWI_{:#x}:",pc.val).c_str()); - this->gen_sync(jh, PRE_SYNC, 45); + gen_sync(jh, PRE_SYNC, 45); mov(cc, jh.pc, pc.val); pc = pc+4; mov(cc, jh.next_pc, pc.val); @@ -2648,7 +2649,7 @@ private: auto returnValue = CONT; gen_instr_epilogue(jh); - this->gen_sync(jh, POST_SYNC, 45); + gen_sync(jh, POST_SYNC, 45); return returnValue; } @@ -2675,7 +2676,7 @@ private: } x86::Compiler& cc = jh.cc; cc.comment(fmt::format("CSRRSI_{:#x}:",pc.val).c_str()); - this->gen_sync(jh, PRE_SYNC, 46); + gen_sync(jh, PRE_SYNC, 46); mov(cc, jh.pc, pc.val); pc = pc+4; mov(cc, jh.next_pc, pc.val); @@ -2689,7 +2690,7 @@ private: else{ auto xrd = gen_read_mem(jh, traits::CSR, csr, 4); if(zimm!=0){ - gen_write_mem(jh, traits::CSR, csr, gen_operation(jh, bor, xrd, (uint32_t)zimm) + gen_write_mem(jh, traits::CSR, csr, gen_operation(cc, bor, xrd, (uint32_t)zimm) , 4); } if(rd!=0){ @@ -2700,7 +2701,7 @@ private: auto returnValue = CONT; gen_instr_epilogue(jh); - this->gen_sync(jh, POST_SYNC, 46); + gen_sync(jh, POST_SYNC, 46); return returnValue; } @@ -2727,7 +2728,7 @@ private: } x86::Compiler& cc = jh.cc; cc.comment(fmt::format("CSRRCI_{:#x}:",pc.val).c_str()); - this->gen_sync(jh, PRE_SYNC, 47); + gen_sync(jh, PRE_SYNC, 47); mov(cc, jh.pc, pc.val); pc = pc+4; mov(cc, jh.next_pc, pc.val); @@ -2741,7 +2742,7 @@ private: else{ auto xrd = gen_read_mem(jh, traits::CSR, csr, 4); if(zimm!=0){ - gen_write_mem(jh, traits::CSR, csr, gen_operation(jh, band, xrd, ~ ((uint32_t)zimm)) + gen_write_mem(jh, traits::CSR, csr, gen_operation(cc, band, xrd, ~ ((uint32_t)zimm)) , 4); } if(rd!=0){ @@ -2752,7 +2753,7 @@ private: auto returnValue = CONT; gen_instr_epilogue(jh); - this->gen_sync(jh, POST_SYNC, 47); + gen_sync(jh, POST_SYNC, 47); return returnValue; } @@ -2779,7 +2780,7 @@ private: } x86::Compiler& cc = jh.cc; cc.comment(fmt::format("FENCE_I_{:#x}:",pc.val).c_str()); - this->gen_sync(jh, PRE_SYNC, 48); + gen_sync(jh, PRE_SYNC, 48); mov(cc, jh.pc, pc.val); pc = pc+4; mov(cc, jh.next_pc, pc.val); @@ -2791,7 +2792,7 @@ private: auto returnValue = FLUSH; gen_instr_epilogue(jh); - this->gen_sync(jh, POST_SYNC, 48); + gen_sync(jh, POST_SYNC, 48); return returnValue; } @@ -2818,7 +2819,7 @@ private: } x86::Compiler& cc = jh.cc; cc.comment(fmt::format("MUL_{:#x}:",pc.val).c_str()); - this->gen_sync(jh, PRE_SYNC, 49); + gen_sync(jh, PRE_SYNC, 49); mov(cc, jh.pc, pc.val); pc = pc+4; mov(cc, jh.next_pc, pc.val); @@ -2830,20 +2831,20 @@ private: gen_raise(jh, 0, static_cast(traits::RV_CAUSE_ILLEGAL_INSTRUCTION)); } else{ - auto res = gen_operation(jh, smul, gen_ext(jh, - load_reg_from_mem(jh, traits::X0 + rs1), 32, true), gen_ext(jh, + auto res = gen_operation(cc, smul, gen_ext(cc, + load_reg_from_mem(jh, traits::X0 + rs1), 32, true), gen_ext(cc, load_reg_from_mem(jh, traits::X0 + rs2), 32, true)) ; if(rd!=0){ mov(cc, get_ptr_for(jh, traits::X0+ rd), - gen_ext(jh, + gen_ext(cc, res, 32, true)); } } auto returnValue = CONT; gen_instr_epilogue(jh); - this->gen_sync(jh, POST_SYNC, 49); + gen_sync(jh, POST_SYNC, 49); return returnValue; } @@ -2870,7 +2871,7 @@ private: } x86::Compiler& cc = jh.cc; cc.comment(fmt::format("MULH_{:#x}:",pc.val).c_str()); - this->gen_sync(jh, PRE_SYNC, 50); + gen_sync(jh, PRE_SYNC, 50); mov(cc, jh.pc, pc.val); pc = pc+4; mov(cc, jh.next_pc, pc.val); @@ -2882,21 +2883,21 @@ private: gen_raise(jh, 0, static_cast(traits::RV_CAUSE_ILLEGAL_INSTRUCTION)); } else{ - auto res = gen_operation(jh, smul, gen_ext(jh, - load_reg_from_mem(jh, traits::X0 + rs1), 32, true), gen_ext(jh, + auto res = gen_operation(cc, smul, gen_ext(cc, + load_reg_from_mem(jh, traits::X0 + rs1), 32, true), gen_ext(cc, load_reg_from_mem(jh, traits::X0 + rs2), 32, true)) ; if(rd!=0){ mov(cc, get_ptr_for(jh, traits::X0+ rd), - gen_ext(jh, - (gen_operation(jh, sar, res, static_cast(traits::XLEN)) + gen_ext(cc, + (gen_operation(cc, sar, res, static_cast(traits::XLEN)) ), 32, true)); } } auto returnValue = CONT; gen_instr_epilogue(jh); - this->gen_sync(jh, POST_SYNC, 50); + gen_sync(jh, POST_SYNC, 50); return returnValue; } @@ -2923,7 +2924,7 @@ private: } x86::Compiler& cc = jh.cc; cc.comment(fmt::format("MULHSU_{:#x}:",pc.val).c_str()); - this->gen_sync(jh, PRE_SYNC, 51); + gen_sync(jh, PRE_SYNC, 51); mov(cc, jh.pc, pc.val); pc = pc+4; mov(cc, jh.next_pc, pc.val); @@ -2935,20 +2936,20 @@ private: gen_raise(jh, 0, static_cast(traits::RV_CAUSE_ILLEGAL_INSTRUCTION)); } else{ - auto res = gen_operation(jh, sumul, gen_ext(jh, + auto res = gen_operation(cc, sumul, gen_ext(cc, load_reg_from_mem(jh, traits::X0 + rs1), 32, true), load_reg_from_mem(jh, traits::X0 + rs2)) ; if(rd!=0){ mov(cc, get_ptr_for(jh, traits::X0+ rd), - gen_ext(jh, - (gen_operation(jh, sar, res, static_cast(traits::XLEN)) + gen_ext(cc, + (gen_operation(cc, sar, res, static_cast(traits::XLEN)) ), 32, true)); } } auto returnValue = CONT; gen_instr_epilogue(jh); - this->gen_sync(jh, POST_SYNC, 51); + gen_sync(jh, POST_SYNC, 51); return returnValue; } @@ -2975,7 +2976,7 @@ private: } x86::Compiler& cc = jh.cc; cc.comment(fmt::format("MULHU_{:#x}:",pc.val).c_str()); - this->gen_sync(jh, PRE_SYNC, 52); + gen_sync(jh, PRE_SYNC, 52); mov(cc, jh.pc, pc.val); pc = pc+4; mov(cc, jh.next_pc, pc.val); @@ -2987,19 +2988,19 @@ private: gen_raise(jh, 0, static_cast(traits::RV_CAUSE_ILLEGAL_INSTRUCTION)); } else{ - auto res = gen_operation(jh, umul, load_reg_from_mem(jh, traits::X0 + rs1), load_reg_from_mem(jh, traits::X0 + rs2)) + auto res = gen_operation(cc, umul, load_reg_from_mem(jh, traits::X0 + rs1), load_reg_from_mem(jh, traits::X0 + rs2)) ; if(rd!=0){ mov(cc, get_ptr_for(jh, traits::X0+ rd), - gen_ext(jh, - (gen_operation(jh, shr, res, static_cast(traits::XLEN)) + gen_ext(cc, + (gen_operation(cc, shr, res, static_cast(traits::XLEN)) ), 32, false)); } } auto returnValue = CONT; gen_instr_epilogue(jh); - this->gen_sync(jh, POST_SYNC, 52); + gen_sync(jh, POST_SYNC, 52); return returnValue; } @@ -3026,7 +3027,7 @@ private: } x86::Compiler& cc = jh.cc; cc.comment(fmt::format("DIV_{:#x}:",pc.val).c_str()); - this->gen_sync(jh, PRE_SYNC, 53); + gen_sync(jh, PRE_SYNC, 53); mov(cc, jh.pc, pc.val); pc = pc+4; mov(cc, jh.next_pc, pc.val); @@ -3038,21 +3039,21 @@ private: gen_raise(jh, 0, static_cast(traits::RV_CAUSE_ILLEGAL_INSTRUCTION)); } else{ - auto dividend = gen_ext(jh, + auto dividend = gen_ext(cc, load_reg_from_mem(jh, traits::X0 + rs1), 32, true); - auto divisor = gen_ext(jh, + auto divisor = gen_ext(cc, load_reg_from_mem(jh, traits::X0 + rs2), 32, true); if(rd!=0){ auto label_merge = cc.newLabel(); - cmp(cc, gen_operation(jh, ne, divisor, 0) + cmp(cc, gen_operation(cc, ne, divisor, 0) ,0); auto label_else = cc.newLabel(); cc.je(label_else); { auto MMIN = ((uint32_t)1)<<(static_cast(traits::XLEN)-1); auto label_merge = cc.newLabel(); - cmp(cc, gen_operation(jh, land, gen_operation(jh, eq, load_reg_from_mem(jh, traits::X0 + rs1), MMIN) - , gen_operation(jh, eq, divisor, - 1) + cmp(cc, gen_operation(cc, land, gen_operation(cc, eq, load_reg_from_mem(jh, traits::X0 + rs1), MMIN) + , gen_operation(cc, eq, divisor, - 1) ) ,0); auto label_else = cc.newLabel(); @@ -3065,8 +3066,8 @@ private: cc.bind(label_else); { mov(cc, get_ptr_for(jh, traits::X0+ rd), - gen_ext(jh, - (gen_operation(jh, sdiv, dividend, divisor) + gen_ext(cc, + (gen_operation(cc, sdiv, dividend, divisor) ), 32, true)); } cc.bind(label_merge); @@ -3083,7 +3084,7 @@ private: auto returnValue = CONT; gen_instr_epilogue(jh); - this->gen_sync(jh, POST_SYNC, 53); + gen_sync(jh, POST_SYNC, 53); return returnValue; } @@ -3110,7 +3111,7 @@ private: } x86::Compiler& cc = jh.cc; cc.comment(fmt::format("DIVU_{:#x}:",pc.val).c_str()); - this->gen_sync(jh, PRE_SYNC, 54); + gen_sync(jh, PRE_SYNC, 54); mov(cc, jh.pc, pc.val); pc = pc+4; mov(cc, jh.next_pc, pc.val); @@ -3123,14 +3124,14 @@ private: } else{ auto label_merge = cc.newLabel(); - cmp(cc, gen_operation(jh, ne, load_reg_from_mem(jh, traits::X0 + rs2), 0) + cmp(cc, gen_operation(cc, ne, load_reg_from_mem(jh, traits::X0 + rs2), 0) ,0); auto label_else = cc.newLabel(); cc.je(label_else); { if(rd!=0){ mov(cc, get_ptr_for(jh, traits::X0+ rd), - gen_operation(jh, udiv, load_reg_from_mem(jh, traits::X0 + rs1), load_reg_from_mem(jh, traits::X0 + rs2)) + gen_operation(cc, udiv, load_reg_from_mem(jh, traits::X0 + rs1), load_reg_from_mem(jh, traits::X0 + rs2)) ); } } @@ -3147,7 +3148,7 @@ private: auto returnValue = CONT; gen_instr_epilogue(jh); - this->gen_sync(jh, POST_SYNC, 54); + gen_sync(jh, POST_SYNC, 54); return returnValue; } @@ -3174,7 +3175,7 @@ private: } x86::Compiler& cc = jh.cc; cc.comment(fmt::format("REM_{:#x}:",pc.val).c_str()); - this->gen_sync(jh, PRE_SYNC, 55); + gen_sync(jh, PRE_SYNC, 55); mov(cc, jh.pc, pc.val); pc = pc+4; mov(cc, jh.next_pc, pc.val); @@ -3187,15 +3188,15 @@ private: } else{ auto label_merge = cc.newLabel(); - cmp(cc, gen_operation(jh, ne, load_reg_from_mem(jh, traits::X0 + rs2), 0) + cmp(cc, gen_operation(cc, ne, load_reg_from_mem(jh, traits::X0 + rs2), 0) ,0); auto label_else = cc.newLabel(); cc.je(label_else); { auto MMIN = (uint32_t)1<<(static_cast(traits::XLEN)-1); auto label_merge = cc.newLabel(); - cmp(cc, gen_operation(jh, land, gen_operation(jh, eq, load_reg_from_mem(jh, traits::X0 + rs1), MMIN) - , gen_operation(jh, eq, gen_ext(jh, + cmp(cc, gen_operation(cc, land, gen_operation(cc, eq, load_reg_from_mem(jh, traits::X0 + rs1), MMIN) + , gen_operation(cc, eq, gen_ext(cc, load_reg_from_mem(jh, traits::X0 + rs2), 32, false), - 1) ) ,0); @@ -3204,7 +3205,7 @@ private: { if(rd!=0){ mov(cc, get_ptr_for(jh, traits::X0+ rd), - gen_ext(jh, 0, 32, false) + gen_ext(cc, 0, 32, false) ); } } @@ -3213,9 +3214,9 @@ private: { if(rd!=0){ mov(cc, get_ptr_for(jh, traits::X0+ rd), - gen_ext(jh, - (gen_operation(jh, srem, gen_ext(jh, - load_reg_from_mem(jh, traits::X0 + rs1), 32, true), gen_ext(jh, + gen_ext(cc, + (gen_operation(cc, srem, gen_ext(cc, + load_reg_from_mem(jh, traits::X0 + rs1), 32, true), gen_ext(cc, load_reg_from_mem(jh, traits::X0 + rs2), 32, true)) ), 32, false)); } @@ -3235,7 +3236,7 @@ private: auto returnValue = CONT; gen_instr_epilogue(jh); - this->gen_sync(jh, POST_SYNC, 55); + gen_sync(jh, POST_SYNC, 55); return returnValue; } @@ -3262,7 +3263,7 @@ private: } x86::Compiler& cc = jh.cc; cc.comment(fmt::format("REMU_{:#x}:",pc.val).c_str()); - this->gen_sync(jh, PRE_SYNC, 56); + gen_sync(jh, PRE_SYNC, 56); mov(cc, jh.pc, pc.val); pc = pc+4; mov(cc, jh.next_pc, pc.val); @@ -3275,14 +3276,14 @@ private: } else{ auto label_merge = cc.newLabel(); - cmp(cc, gen_operation(jh, ne, load_reg_from_mem(jh, traits::X0 + rs2), 0) + cmp(cc, gen_operation(cc, ne, load_reg_from_mem(jh, traits::X0 + rs2), 0) ,0); auto label_else = cc.newLabel(); cc.je(label_else); { if(rd!=0){ mov(cc, get_ptr_for(jh, traits::X0+ rd), - gen_operation(jh, urem, load_reg_from_mem(jh, traits::X0 + rs1), load_reg_from_mem(jh, traits::X0 + rs2)) + gen_operation(cc, urem, load_reg_from_mem(jh, traits::X0 + rs1), load_reg_from_mem(jh, traits::X0 + rs2)) ); } } @@ -3299,7 +3300,7 @@ private: auto returnValue = CONT; gen_instr_epilogue(jh); - this->gen_sync(jh, POST_SYNC, 56); + gen_sync(jh, POST_SYNC, 56); return returnValue; } @@ -3325,7 +3326,7 @@ private: } x86::Compiler& cc = jh.cc; cc.comment(fmt::format("C__ADDI4SPN_{:#x}:",pc.val).c_str()); - this->gen_sync(jh, PRE_SYNC, 57); + gen_sync(jh, PRE_SYNC, 57); mov(cc, jh.pc, pc.val); pc = pc+2; mov(cc, jh.next_pc, pc.val); @@ -3335,8 +3336,8 @@ private: /*generate behavior*/ if(imm){ mov(cc, get_ptr_for(jh, traits::X0+ rd+8), - gen_ext(jh, - (gen_operation(jh, add, load_reg_from_mem(jh, traits::X0 + 2), imm) + gen_ext(cc, + (gen_operation(cc, add, load_reg_from_mem(jh, traits::X0 + 2), imm) ), 32, false)); } else{ @@ -3345,7 +3346,7 @@ private: auto returnValue = CONT; gen_instr_epilogue(jh); - this->gen_sync(jh, POST_SYNC, 57); + gen_sync(jh, POST_SYNC, 57); return returnValue; } @@ -3372,7 +3373,7 @@ private: } x86::Compiler& cc = jh.cc; cc.comment(fmt::format("C__LW_{:#x}:",pc.val).c_str()); - this->gen_sync(jh, PRE_SYNC, 58); + gen_sync(jh, PRE_SYNC, 58); mov(cc, jh.pc, pc.val); pc = pc+2; mov(cc, jh.next_pc, pc.val); @@ -3380,17 +3381,17 @@ private: gen_instr_prologue(jh); cc.comment("//behavior:"); /*generate behavior*/ - auto offs = gen_ext(jh, - (gen_operation(jh, add, load_reg_from_mem(jh, traits::X0 + rs1+8), uimm) + auto offs = gen_ext(cc, + (gen_operation(cc, add, load_reg_from_mem(jh, traits::X0 + rs1+8), uimm) ), 32, false); mov(cc, get_ptr_for(jh, traits::X0+ rd+8), - gen_ext(jh, - gen_ext(jh, + gen_ext(cc, + gen_ext(cc, gen_read_mem(jh, traits::MEM, offs, 4), 32, false), 32, true)); auto returnValue = CONT; gen_instr_epilogue(jh); - this->gen_sync(jh, POST_SYNC, 58); + gen_sync(jh, POST_SYNC, 58); return returnValue; } @@ -3417,7 +3418,7 @@ private: } x86::Compiler& cc = jh.cc; cc.comment(fmt::format("C__SW_{:#x}:",pc.val).c_str()); - this->gen_sync(jh, PRE_SYNC, 59); + gen_sync(jh, PRE_SYNC, 59); mov(cc, jh.pc, pc.val); pc = pc+2; mov(cc, jh.next_pc, pc.val); @@ -3425,15 +3426,15 @@ private: gen_instr_prologue(jh); cc.comment("//behavior:"); /*generate behavior*/ - auto offs = gen_ext(jh, - (gen_operation(jh, add, load_reg_from_mem(jh, traits::X0 + rs1+8), uimm) + auto offs = gen_ext(cc, + (gen_operation(cc, add, load_reg_from_mem(jh, traits::X0 + rs1+8), uimm) ), 32, false); - gen_write_mem(jh, traits::MEM, offs, gen_ext(jh, + gen_write_mem(jh, traits::MEM, offs, gen_ext(cc, load_reg_from_mem(jh, traits::X0 + rs2+8), 32, false), 4); auto returnValue = CONT; gen_instr_epilogue(jh); - this->gen_sync(jh, POST_SYNC, 59); + gen_sync(jh, POST_SYNC, 59); return returnValue; } @@ -3459,7 +3460,7 @@ private: } x86::Compiler& cc = jh.cc; cc.comment(fmt::format("C__ADDI_{:#x}:",pc.val).c_str()); - this->gen_sync(jh, PRE_SYNC, 60); + gen_sync(jh, PRE_SYNC, 60); mov(cc, jh.pc, pc.val); pc = pc+2; mov(cc, jh.next_pc, pc.val); @@ -3473,15 +3474,15 @@ private: else{ if(rs1!=0){ mov(cc, get_ptr_for(jh, traits::X0+ rs1), - gen_ext(jh, - (gen_operation(jh, add, load_reg_from_mem(jh, traits::X0 + rs1), (int8_t)sext<6>(imm)) + gen_ext(cc, + (gen_operation(cc, add, load_reg_from_mem(jh, traits::X0 + rs1), (int8_t)sext<6>(imm)) ), 32, true)); } } auto returnValue = CONT; gen_instr_epilogue(jh); - this->gen_sync(jh, POST_SYNC, 60); + gen_sync(jh, POST_SYNC, 60); return returnValue; } @@ -3505,7 +3506,7 @@ private: } x86::Compiler& cc = jh.cc; cc.comment(fmt::format("C__NOP_{:#x}:",pc.val).c_str()); - this->gen_sync(jh, PRE_SYNC, 61); + gen_sync(jh, PRE_SYNC, 61); mov(cc, jh.pc, pc.val); pc = pc+2; mov(cc, jh.next_pc, pc.val); @@ -3516,7 +3517,7 @@ private: auto returnValue = CONT; gen_instr_epilogue(jh); - this->gen_sync(jh, POST_SYNC, 61); + gen_sync(jh, POST_SYNC, 61); return returnValue; } @@ -3541,7 +3542,7 @@ private: } x86::Compiler& cc = jh.cc; cc.comment(fmt::format("C__JAL_{:#x}:",pc.val).c_str()); - this->gen_sync(jh, PRE_SYNC, 62); + gen_sync(jh, PRE_SYNC, 62); mov(cc, jh.pc, pc.val); pc = pc+2; mov(cc, jh.next_pc, pc.val); @@ -3557,7 +3558,7 @@ private: auto returnValue = BRANCH; gen_instr_epilogue(jh); - this->gen_sync(jh, POST_SYNC, 62); + gen_sync(jh, POST_SYNC, 62); return returnValue; } @@ -3583,7 +3584,7 @@ private: } x86::Compiler& cc = jh.cc; cc.comment(fmt::format("C__LI_{:#x}:",pc.val).c_str()); - this->gen_sync(jh, PRE_SYNC, 63); + gen_sync(jh, PRE_SYNC, 63); mov(cc, jh.pc, pc.val); pc = pc+2; mov(cc, jh.next_pc, pc.val); @@ -3603,7 +3604,7 @@ private: auto returnValue = CONT; gen_instr_epilogue(jh); - this->gen_sync(jh, POST_SYNC, 63); + gen_sync(jh, POST_SYNC, 63); return returnValue; } @@ -3629,7 +3630,7 @@ private: } x86::Compiler& cc = jh.cc; cc.comment(fmt::format("C__LUI_{:#x}:",pc.val).c_str()); - this->gen_sync(jh, PRE_SYNC, 64); + gen_sync(jh, PRE_SYNC, 64); mov(cc, jh.pc, pc.val); pc = pc+2; mov(cc, jh.next_pc, pc.val); @@ -3647,7 +3648,7 @@ private: auto returnValue = CONT; gen_instr_epilogue(jh); - this->gen_sync(jh, POST_SYNC, 64); + gen_sync(jh, POST_SYNC, 64); return returnValue; } @@ -3672,7 +3673,7 @@ private: } x86::Compiler& cc = jh.cc; cc.comment(fmt::format("C__ADDI16SP_{:#x}:",pc.val).c_str()); - this->gen_sync(jh, PRE_SYNC, 65); + gen_sync(jh, PRE_SYNC, 65); mov(cc, jh.pc, pc.val); pc = pc+2; mov(cc, jh.next_pc, pc.val); @@ -3682,8 +3683,8 @@ private: /*generate behavior*/ if(nzimm){ mov(cc, get_ptr_for(jh, traits::X0+ 2), - gen_ext(jh, - (gen_operation(jh, add, load_reg_from_mem(jh, traits::X0 + 2), (int16_t)sext<10>(nzimm)) + gen_ext(cc, + (gen_operation(cc, add, load_reg_from_mem(jh, traits::X0 + 2), (int16_t)sext<10>(nzimm)) ), 32, true)); } else{ @@ -3692,7 +3693,7 @@ private: auto returnValue = CONT; gen_instr_epilogue(jh); - this->gen_sync(jh, POST_SYNC, 65); + gen_sync(jh, POST_SYNC, 65); return returnValue; } @@ -3716,7 +3717,7 @@ private: } x86::Compiler& cc = jh.cc; cc.comment(fmt::format("__reserved_clui_{:#x}:",pc.val).c_str()); - this->gen_sync(jh, PRE_SYNC, 66); + gen_sync(jh, PRE_SYNC, 66); mov(cc, jh.pc, pc.val); pc = pc+2; mov(cc, jh.next_pc, pc.val); @@ -3728,7 +3729,7 @@ private: auto returnValue = CONT; gen_instr_epilogue(jh); - this->gen_sync(jh, POST_SYNC, 66); + gen_sync(jh, POST_SYNC, 66); return returnValue; } @@ -3754,7 +3755,7 @@ private: } x86::Compiler& cc = jh.cc; cc.comment(fmt::format("C__SRLI_{:#x}:",pc.val).c_str()); - this->gen_sync(jh, PRE_SYNC, 67); + gen_sync(jh, PRE_SYNC, 67); mov(cc, jh.pc, pc.val); pc = pc+2; mov(cc, jh.next_pc, pc.val); @@ -3763,12 +3764,12 @@ private: cc.comment("//behavior:"); /*generate behavior*/ mov(cc, get_ptr_for(jh, traits::X0+ rs1+8), - gen_operation(jh, shr, load_reg_from_mem(jh, traits::X0 + rs1+8), shamt) + gen_operation(cc, shr, load_reg_from_mem(jh, traits::X0 + rs1+8), shamt) ); auto returnValue = CONT; gen_instr_epilogue(jh); - this->gen_sync(jh, POST_SYNC, 67); + gen_sync(jh, POST_SYNC, 67); return returnValue; } @@ -3794,7 +3795,7 @@ private: } x86::Compiler& cc = jh.cc; cc.comment(fmt::format("C__SRAI_{:#x}:",pc.val).c_str()); - this->gen_sync(jh, PRE_SYNC, 68); + gen_sync(jh, PRE_SYNC, 68); mov(cc, jh.pc, pc.val); pc = pc+2; mov(cc, jh.next_pc, pc.val); @@ -3804,16 +3805,16 @@ private: /*generate behavior*/ if(shamt){ mov(cc, get_ptr_for(jh, traits::X0+ rs1+8), - gen_ext(jh, - (gen_operation(jh, sar, (gen_ext(jh, + gen_ext(cc, + (gen_operation(cc, sar, (gen_ext(cc, load_reg_from_mem(jh, traits::X0 + rs1+8), 32, false)), shamt) ), 32, true)); } else{ if(static_cast(traits::XLEN)==128){ mov(cc, get_ptr_for(jh, traits::X0+ rs1+8), - gen_ext(jh, - (gen_operation(jh, sar, (gen_ext(jh, + gen_ext(cc, + (gen_operation(cc, sar, (gen_ext(cc, load_reg_from_mem(jh, traits::X0 + rs1+8), 32, false)), 64) ), 32, true)); } @@ -3821,7 +3822,7 @@ private: auto returnValue = CONT; gen_instr_epilogue(jh); - this->gen_sync(jh, POST_SYNC, 68); + gen_sync(jh, POST_SYNC, 68); return returnValue; } @@ -3847,7 +3848,7 @@ private: } x86::Compiler& cc = jh.cc; cc.comment(fmt::format("C__ANDI_{:#x}:",pc.val).c_str()); - this->gen_sync(jh, PRE_SYNC, 69); + gen_sync(jh, PRE_SYNC, 69); mov(cc, jh.pc, pc.val); pc = pc+2; mov(cc, jh.next_pc, pc.val); @@ -3856,13 +3857,13 @@ private: cc.comment("//behavior:"); /*generate behavior*/ mov(cc, get_ptr_for(jh, traits::X0+ rs1+8), - gen_ext(jh, - (gen_operation(jh, band, load_reg_from_mem(jh, traits::X0 + rs1+8), (int8_t)sext<6>(imm)) + gen_ext(cc, + (gen_operation(cc, band, load_reg_from_mem(jh, traits::X0 + rs1+8), (int8_t)sext<6>(imm)) ), 32, true)); auto returnValue = CONT; gen_instr_epilogue(jh); - this->gen_sync(jh, POST_SYNC, 69); + gen_sync(jh, POST_SYNC, 69); return returnValue; } @@ -3888,7 +3889,7 @@ private: } x86::Compiler& cc = jh.cc; cc.comment(fmt::format("C__SUB_{:#x}:",pc.val).c_str()); - this->gen_sync(jh, PRE_SYNC, 70); + gen_sync(jh, PRE_SYNC, 70); mov(cc, jh.pc, pc.val); pc = pc+2; mov(cc, jh.next_pc, pc.val); @@ -3897,13 +3898,13 @@ private: cc.comment("//behavior:"); /*generate behavior*/ mov(cc, get_ptr_for(jh, traits::X0+ rd+8), - gen_ext(jh, - (gen_operation(jh, sub, load_reg_from_mem(jh, traits::X0 + rd+8), load_reg_from_mem(jh, traits::X0 + rs2+8)) + gen_ext(cc, + (gen_operation(cc, sub, load_reg_from_mem(jh, traits::X0 + rd+8), load_reg_from_mem(jh, traits::X0 + rs2+8)) ), 32, true)); auto returnValue = CONT; gen_instr_epilogue(jh); - this->gen_sync(jh, POST_SYNC, 70); + gen_sync(jh, POST_SYNC, 70); return returnValue; } @@ -3929,7 +3930,7 @@ private: } x86::Compiler& cc = jh.cc; cc.comment(fmt::format("C__XOR_{:#x}:",pc.val).c_str()); - this->gen_sync(jh, PRE_SYNC, 71); + gen_sync(jh, PRE_SYNC, 71); mov(cc, jh.pc, pc.val); pc = pc+2; mov(cc, jh.next_pc, pc.val); @@ -3938,12 +3939,12 @@ private: cc.comment("//behavior:"); /*generate behavior*/ mov(cc, get_ptr_for(jh, traits::X0+ rd+8), - gen_operation(jh, bxor, load_reg_from_mem(jh, traits::X0 + rd+8), load_reg_from_mem(jh, traits::X0 + rs2+8)) + gen_operation(cc, bxor, load_reg_from_mem(jh, traits::X0 + rd+8), load_reg_from_mem(jh, traits::X0 + rs2+8)) ); auto returnValue = CONT; gen_instr_epilogue(jh); - this->gen_sync(jh, POST_SYNC, 71); + gen_sync(jh, POST_SYNC, 71); return returnValue; } @@ -3969,7 +3970,7 @@ private: } x86::Compiler& cc = jh.cc; cc.comment(fmt::format("C__OR_{:#x}:",pc.val).c_str()); - this->gen_sync(jh, PRE_SYNC, 72); + gen_sync(jh, PRE_SYNC, 72); mov(cc, jh.pc, pc.val); pc = pc+2; mov(cc, jh.next_pc, pc.val); @@ -3978,12 +3979,12 @@ private: cc.comment("//behavior:"); /*generate behavior*/ mov(cc, get_ptr_for(jh, traits::X0+ rd+8), - gen_operation(jh, bor, load_reg_from_mem(jh, traits::X0 + rd+8), load_reg_from_mem(jh, traits::X0 + rs2+8)) + gen_operation(cc, bor, load_reg_from_mem(jh, traits::X0 + rd+8), load_reg_from_mem(jh, traits::X0 + rs2+8)) ); auto returnValue = CONT; gen_instr_epilogue(jh); - this->gen_sync(jh, POST_SYNC, 72); + gen_sync(jh, POST_SYNC, 72); return returnValue; } @@ -4009,7 +4010,7 @@ private: } x86::Compiler& cc = jh.cc; cc.comment(fmt::format("C__AND_{:#x}:",pc.val).c_str()); - this->gen_sync(jh, PRE_SYNC, 73); + gen_sync(jh, PRE_SYNC, 73); mov(cc, jh.pc, pc.val); pc = pc+2; mov(cc, jh.next_pc, pc.val); @@ -4018,12 +4019,12 @@ private: cc.comment("//behavior:"); /*generate behavior*/ mov(cc, get_ptr_for(jh, traits::X0+ rd+8), - gen_operation(jh, band, load_reg_from_mem(jh, traits::X0 + rd+8), load_reg_from_mem(jh, traits::X0 + rs2+8)) + gen_operation(cc, band, load_reg_from_mem(jh, traits::X0 + rd+8), load_reg_from_mem(jh, traits::X0 + rs2+8)) ); auto returnValue = CONT; gen_instr_epilogue(jh); - this->gen_sync(jh, POST_SYNC, 73); + gen_sync(jh, POST_SYNC, 73); return returnValue; } @@ -4048,7 +4049,7 @@ private: } x86::Compiler& cc = jh.cc; cc.comment(fmt::format("C__J_{:#x}:",pc.val).c_str()); - this->gen_sync(jh, PRE_SYNC, 74); + gen_sync(jh, PRE_SYNC, 74); mov(cc, jh.pc, pc.val); pc = pc+2; mov(cc, jh.next_pc, pc.val); @@ -4062,7 +4063,7 @@ private: auto returnValue = BRANCH; gen_instr_epilogue(jh); - this->gen_sync(jh, POST_SYNC, 74); + gen_sync(jh, POST_SYNC, 74); return returnValue; } @@ -4088,7 +4089,7 @@ private: } x86::Compiler& cc = jh.cc; cc.comment(fmt::format("C__BEQZ_{:#x}:",pc.val).c_str()); - this->gen_sync(jh, PRE_SYNC, 75); + gen_sync(jh, PRE_SYNC, 75); mov(cc, jh.pc, pc.val); pc = pc+2; mov(cc, jh.next_pc, pc.val); @@ -4097,7 +4098,7 @@ private: cc.comment("//behavior:"); /*generate behavior*/ auto label_merge = cc.newLabel(); - cmp(cc, gen_operation(jh, eq, load_reg_from_mem(jh, traits::X0 + rs1+8), 0) + cmp(cc, gen_operation(cc, eq, load_reg_from_mem(jh, traits::X0 + rs1+8), 0) ,0); cc.je(label_merge); { @@ -4109,7 +4110,7 @@ private: auto returnValue = BRANCH; gen_instr_epilogue(jh); - this->gen_sync(jh, POST_SYNC, 75); + gen_sync(jh, POST_SYNC, 75); return returnValue; } @@ -4135,7 +4136,7 @@ private: } x86::Compiler& cc = jh.cc; cc.comment(fmt::format("C__BNEZ_{:#x}:",pc.val).c_str()); - this->gen_sync(jh, PRE_SYNC, 76); + gen_sync(jh, PRE_SYNC, 76); mov(cc, jh.pc, pc.val); pc = pc+2; mov(cc, jh.next_pc, pc.val); @@ -4144,7 +4145,7 @@ private: cc.comment("//behavior:"); /*generate behavior*/ auto label_merge = cc.newLabel(); - cmp(cc, gen_operation(jh, ne, load_reg_from_mem(jh, traits::X0 + rs1+8), 0) + cmp(cc, gen_operation(cc, ne, load_reg_from_mem(jh, traits::X0 + rs1+8), 0) ,0); cc.je(label_merge); { @@ -4156,7 +4157,7 @@ private: auto returnValue = BRANCH; gen_instr_epilogue(jh); - this->gen_sync(jh, POST_SYNC, 76); + gen_sync(jh, POST_SYNC, 76); return returnValue; } @@ -4182,7 +4183,7 @@ private: } x86::Compiler& cc = jh.cc; cc.comment(fmt::format("C__SLLI_{:#x}:",pc.val).c_str()); - this->gen_sync(jh, PRE_SYNC, 77); + gen_sync(jh, PRE_SYNC, 77); mov(cc, jh.pc, pc.val); pc = pc+2; mov(cc, jh.next_pc, pc.val); @@ -4196,14 +4197,14 @@ private: else{ if(rs1!=0){ mov(cc, get_ptr_for(jh, traits::X0+ rs1), - gen_operation(jh, shl, load_reg_from_mem(jh, traits::X0 + rs1), nzuimm) + gen_operation(cc, shl, load_reg_from_mem(jh, traits::X0 + rs1), nzuimm) ); } } auto returnValue = CONT; gen_instr_epilogue(jh); - this->gen_sync(jh, POST_SYNC, 77); + gen_sync(jh, POST_SYNC, 77); return returnValue; } @@ -4229,7 +4230,7 @@ private: } x86::Compiler& cc = jh.cc; cc.comment(fmt::format("C__LWSP_{:#x}:",pc.val).c_str()); - this->gen_sync(jh, PRE_SYNC, 78); + gen_sync(jh, PRE_SYNC, 78); mov(cc, jh.pc, pc.val); pc = pc+2; mov(cc, jh.next_pc, pc.val); @@ -4241,18 +4242,18 @@ private: gen_raise(jh, 0, static_cast(traits::RV_CAUSE_ILLEGAL_INSTRUCTION)); } else{ - auto offs = gen_ext(jh, - (gen_operation(jh, add, load_reg_from_mem(jh, traits::X0 + 2), uimm) + auto offs = gen_ext(cc, + (gen_operation(cc, add, load_reg_from_mem(jh, traits::X0 + 2), uimm) ), 32, false); mov(cc, get_ptr_for(jh, traits::X0+ rd), - gen_ext(jh, - gen_ext(jh, + gen_ext(cc, + gen_ext(cc, gen_read_mem(jh, traits::MEM, offs, 4), 32, false), 32, true)); } auto returnValue = CONT; gen_instr_epilogue(jh); - this->gen_sync(jh, POST_SYNC, 78); + gen_sync(jh, POST_SYNC, 78); return returnValue; } @@ -4278,7 +4279,7 @@ private: } x86::Compiler& cc = jh.cc; cc.comment(fmt::format("C__MV_{:#x}:",pc.val).c_str()); - this->gen_sync(jh, PRE_SYNC, 79); + gen_sync(jh, PRE_SYNC, 79); mov(cc, jh.pc, pc.val); pc = pc+2; mov(cc, jh.next_pc, pc.val); @@ -4298,7 +4299,7 @@ private: auto returnValue = CONT; gen_instr_epilogue(jh); - this->gen_sync(jh, POST_SYNC, 79); + gen_sync(jh, POST_SYNC, 79); return returnValue; } @@ -4323,7 +4324,7 @@ private: } x86::Compiler& cc = jh.cc; cc.comment(fmt::format("C__JR_{:#x}:",pc.val).c_str()); - this->gen_sync(jh, PRE_SYNC, 80); + gen_sync(jh, PRE_SYNC, 80); mov(cc, jh.pc, pc.val); pc = pc+2; mov(cc, jh.next_pc, pc.val); @@ -4332,7 +4333,7 @@ private: cc.comment("//behavior:"); /*generate behavior*/ if(rs1&&rs1(traits::RFS)){ - auto PC_val_v = gen_operation(jh, band, load_reg_from_mem(jh, traits::X0 + rs1%static_cast(traits::RFS)), ~ 1) + auto PC_val_v = gen_operation(cc, band, load_reg_from_mem(jh, traits::X0 + rs1%static_cast(traits::RFS)), ~ 1) ; mov(cc, jh.next_pc, PC_val_v); mov(cc, get_ptr_for(jh, traits::LAST_BRANCH), 32U); @@ -4343,7 +4344,7 @@ private: auto returnValue = BRANCH; gen_instr_epilogue(jh); - this->gen_sync(jh, POST_SYNC, 80); + gen_sync(jh, POST_SYNC, 80); return returnValue; } @@ -4366,7 +4367,7 @@ private: } x86::Compiler& cc = jh.cc; cc.comment(fmt::format("__reserved_cmv_{:#x}:",pc.val).c_str()); - this->gen_sync(jh, PRE_SYNC, 81); + gen_sync(jh, PRE_SYNC, 81); mov(cc, jh.pc, pc.val); pc = pc+2; mov(cc, jh.next_pc, pc.val); @@ -4378,7 +4379,7 @@ private: auto returnValue = CONT; gen_instr_epilogue(jh); - this->gen_sync(jh, POST_SYNC, 81); + gen_sync(jh, POST_SYNC, 81); return returnValue; } @@ -4404,7 +4405,7 @@ private: } x86::Compiler& cc = jh.cc; cc.comment(fmt::format("C__ADD_{:#x}:",pc.val).c_str()); - this->gen_sync(jh, PRE_SYNC, 82); + gen_sync(jh, PRE_SYNC, 82); mov(cc, jh.pc, pc.val); pc = pc+2; mov(cc, jh.next_pc, pc.val); @@ -4418,15 +4419,15 @@ private: else{ if(rd!=0){ mov(cc, get_ptr_for(jh, traits::X0+ rd), - gen_ext(jh, - (gen_operation(jh, add, load_reg_from_mem(jh, traits::X0 + rd), load_reg_from_mem(jh, traits::X0 + rs2)) + gen_ext(cc, + (gen_operation(cc, add, load_reg_from_mem(jh, traits::X0 + rd), load_reg_from_mem(jh, traits::X0 + rs2)) ), 32, false)); } } auto returnValue = CONT; gen_instr_epilogue(jh); - this->gen_sync(jh, POST_SYNC, 82); + gen_sync(jh, POST_SYNC, 82); return returnValue; } @@ -4451,7 +4452,7 @@ private: } x86::Compiler& cc = jh.cc; cc.comment(fmt::format("C__JALR_{:#x}:",pc.val).c_str()); - this->gen_sync(jh, PRE_SYNC, 83); + gen_sync(jh, PRE_SYNC, 83); mov(cc, jh.pc, pc.val); pc = pc+2; mov(cc, jh.next_pc, pc.val); @@ -4466,7 +4467,7 @@ private: auto new_pc = load_reg_from_mem(jh, traits::X0 + rs1); mov(cc, get_ptr_for(jh, traits::X0+ 1), (uint32_t)(PC+2)); - auto PC_val_v = gen_operation(jh, band, new_pc, ~ 1) + auto PC_val_v = gen_operation(cc, band, new_pc, ~ 1) ; mov(cc, jh.next_pc, PC_val_v); mov(cc, get_ptr_for(jh, traits::LAST_BRANCH), 32U); @@ -4474,7 +4475,7 @@ private: auto returnValue = BRANCH; gen_instr_epilogue(jh); - this->gen_sync(jh, POST_SYNC, 83); + gen_sync(jh, POST_SYNC, 83); return returnValue; } @@ -4497,7 +4498,7 @@ private: } x86::Compiler& cc = jh.cc; cc.comment(fmt::format("C__EBREAK_{:#x}:",pc.val).c_str()); - this->gen_sync(jh, PRE_SYNC, 84); + gen_sync(jh, PRE_SYNC, 84); mov(cc, jh.pc, pc.val); pc = pc+2; mov(cc, jh.next_pc, pc.val); @@ -4509,7 +4510,7 @@ private: auto returnValue = CONT; gen_instr_epilogue(jh); - this->gen_sync(jh, POST_SYNC, 84); + gen_sync(jh, POST_SYNC, 84); return returnValue; } @@ -4535,7 +4536,7 @@ private: } x86::Compiler& cc = jh.cc; cc.comment(fmt::format("C__SWSP_{:#x}:",pc.val).c_str()); - this->gen_sync(jh, PRE_SYNC, 85); + gen_sync(jh, PRE_SYNC, 85); mov(cc, jh.pc, pc.val); pc = pc+2; mov(cc, jh.next_pc, pc.val); @@ -4547,16 +4548,16 @@ private: gen_raise(jh, 0, static_cast(traits::RV_CAUSE_ILLEGAL_INSTRUCTION)); } else{ - auto offs = gen_ext(jh, - (gen_operation(jh, add, load_reg_from_mem(jh, traits::X0 + 2), uimm) + auto offs = gen_ext(cc, + (gen_operation(cc, add, load_reg_from_mem(jh, traits::X0 + 2), uimm) ), 32, false); - gen_write_mem(jh, traits::MEM, offs, gen_ext(jh, + gen_write_mem(jh, traits::MEM, offs, gen_ext(cc, load_reg_from_mem(jh, traits::X0 + rs2), 32, false), 4); } auto returnValue = CONT; gen_instr_epilogue(jh); - this->gen_sync(jh, POST_SYNC, 85); + gen_sync(jh, POST_SYNC, 85); return returnValue; } @@ -4579,7 +4580,7 @@ private: } x86::Compiler& cc = jh.cc; cc.comment(fmt::format("DII_{:#x}:",pc.val).c_str()); - this->gen_sync(jh, PRE_SYNC, 86); + gen_sync(jh, PRE_SYNC, 86); mov(cc, jh.pc, pc.val); pc = pc+2; mov(cc, jh.next_pc, pc.val); @@ -4591,7 +4592,7 @@ private: auto returnValue = CONT; gen_instr_epilogue(jh); - this->gen_sync(jh, POST_SYNC, 86); + gen_sync(jh, POST_SYNC, 86); return returnValue; } @@ -4601,12 +4602,12 @@ private: continuation_e illegal_intruction(virt_addr_t &pc, code_word_t instr, jit_holder& jh ) { x86::Compiler& cc = jh.cc; cc.comment(fmt::format("illegal_intruction{:#x}:",pc.val).c_str()); - this->gen_sync(jh, PRE_SYNC, instr_descr.size()); + gen_sync(jh, PRE_SYNC, instr_descr.size()); pc = pc + ((instr & 3) == 3 ? 4 : 2); gen_instr_prologue(jh); cc.comment("//behavior:"); gen_instr_epilogue(jh); - this->gen_sync(jh, POST_SYNC, instr_descr.size()); + gen_sync(jh, POST_SYNC, instr_descr.size()); return BRANCH; } @@ -4702,7 +4703,7 @@ void vm_impl::gen_instr_prologue(jit_holder& jh) { cc.comment("//gen_instr_prologue"); cc.inc(get_ptr_for(jh, traits::ICOUNT)); - x86_reg_t current_trap_state = get_reg_for(jh, traits::TRAP_STATE); + x86_reg_t current_trap_state = get_reg_for(cc, traits::TRAP_STATE); mov(cc, current_trap_state, get_ptr_for(jh, traits::TRAP_STATE)); mov(cc, get_ptr_for(jh, traits::PENDING_TRAP), current_trap_state); @@ -4712,7 +4713,7 @@ void vm_impl::gen_instr_epilogue(jit_holder& jh) { auto& cc = jh.cc; cc.comment("//gen_instr_epilogue"); - x86_reg_t current_trap_state = get_reg_for(jh, traits::TRAP_STATE); + x86_reg_t current_trap_state = get_reg_for(cc, traits::TRAP_STATE); mov(cc, current_trap_state, get_ptr_for(jh, traits::TRAP_STATE)); cmp(cc, current_trap_state, 0); cc.jne(jh.trap_entry); @@ -4733,10 +4734,10 @@ void vm_impl::gen_block_epilogue(jit_holder& jh){ this->write_back(jh); this->gen_sync(jh, POST_SYNC, -1); - x86::Gp current_trap_state = get_reg_for_Gp(jh, traits::TRAP_STATE); + x86::Gp current_trap_state = get_reg_for_Gp(cc, traits::TRAP_STATE); mov(cc, current_trap_state, get_ptr_for(jh, traits::TRAP_STATE)); - x86::Gp current_pc = get_reg_for_Gp(jh, traits::PC); + x86::Gp current_pc = get_reg_for_Gp(cc, traits::PC); mov(cc, current_pc, get_ptr_for(jh, traits::PC)); x86::Gp instr = cc.newInt32("instr"); @@ -4749,7 +4750,7 @@ void vm_impl::gen_block_epilogue(jit_holder& jh){ call_enter_trap->setArg(2, current_pc); call_enter_trap->setArg(3, instr); - x86_reg_t current_next_pc = get_reg_for(jh, traits::NEXT_PC); + x86_reg_t current_next_pc = get_reg_for(cc, traits::NEXT_PC); mov(cc, current_next_pc, get_ptr_for(jh, traits::NEXT_PC)); mov(cc, jh.next_pc, current_next_pc); @@ -4760,7 +4761,7 @@ template inline void vm_impl::gen_raise(jit_holder& jh, uint16_t trap_id, uint16_t cause) { auto& cc = jh.cc; cc.comment("//gen_raise"); - auto tmp1 = get_reg_for(jh, traits::TRAP_STATE); + auto tmp1 = get_reg_for(cc, traits::TRAP_STATE); mov(cc, tmp1, 0x80ULL << 24 | (cause << 16) | trap_id); mov(cc, get_ptr_for(jh, traits::TRAP_STATE), tmp1); mov(cc, jh.next_pc, std::numeric_limits::max());