updates asmjit template, removes lots of comments from IR
This commit is contained in:
parent
1afd77a942
commit
fe3ed49519
@ -40,7 +40,11 @@
|
||||
#include <iss/instruction_decoder.h>
|
||||
<%def fcsr = registers.find {it.name=='FCSR'}
|
||||
if(fcsr != null) {%>
|
||||
#include <vm/fp_functions.h><%}%>
|
||||
#include <vm/fp_functions.h><%}
|
||||
def aes = functions.find { it.contains('aes') }
|
||||
if(aes != null) {%>
|
||||
#include <vm/aes_sbox.h>
|
||||
<%}%>
|
||||
#ifndef FMT_HEADER_ONLY
|
||||
#define FMT_HEADER_ONLY
|
||||
#endif
|
||||
@ -49,6 +53,22 @@ if(fcsr != null) {%>
|
||||
#include <array>
|
||||
#include <iss/debugger/riscv_target_adapter.h>
|
||||
|
||||
#ifndef _MSC_VER
|
||||
using int128_t = __int128;
|
||||
using uint128_t = unsigned __int128;
|
||||
namespace std {
|
||||
template <> struct make_unsigned<__int128> { typedef unsigned __int128 type; };
|
||||
template <> class __make_unsigned_selector<__int128 unsigned, false, false> {
|
||||
public:
|
||||
typedef unsigned __int128 __type;
|
||||
};
|
||||
template <> struct is_signed<int128_t> { static constexpr bool value = true; };
|
||||
template <> struct is_signed<uint128_t> { static constexpr bool value = false; };
|
||||
template <> struct is_unsigned<int128_t> { static constexpr bool value = false; };
|
||||
template <> struct is_unsigned<uint128_t> { static constexpr bool value = true; };
|
||||
} // namespace std
|
||||
#endif
|
||||
|
||||
namespace iss {
|
||||
namespace asmjit {
|
||||
|
||||
@ -116,38 +136,14 @@ protected:
|
||||
auto sign_mask = 1ULL<<(W-1);
|
||||
return (from & mask) | ((from & sign_mask) ? ~mask : 0);
|
||||
}
|
||||
inline void raise(uint16_t trap_id, uint16_t cause){
|
||||
auto trap_val = 0x80ULL << 24 | (cause << 16) | trap_id;
|
||||
this->core.reg.trap_state = trap_val;
|
||||
}
|
||||
|
||||
<%functions.each{ it.eachLine { %>
|
||||
${it}<%}
|
||||
}
|
||||
if(fcsr != null) {%>
|
||||
x86_reg_t NaNBox16(jit_holder& jh , x86_reg_t NaNBox16_val){
|
||||
x86::Compiler& cc = jh.cc;
|
||||
if(static_cast<uint32_t>(traits::FLEN) == 16)
|
||||
return gen_ext(cc, NaNBox16_val, traits::FLEN, false);
|
||||
else {
|
||||
auto box = gen_operation(cc, bnot, (gen_ext(cc, 0, traits::FLEN, false)));
|
||||
return gen_ext(cc, (gen_operation(jh.cc, bor, gen_ext(jh.cc, gen_operation(jh.cc, shl, box, 16), traits::FLEN, false), gen_ext(jh.cc, NaNBox16_val, traits::FLEN, false))), traits::FLEN, false);
|
||||
}
|
||||
}
|
||||
x86_reg_t NaNBox32(jit_holder& jh , x86_reg_t NaNBox32_val){
|
||||
x86::Compiler& cc = jh.cc;
|
||||
if(static_cast<uint32_t>(traits::FLEN) == 32)
|
||||
return gen_ext(cc, NaNBox32_val, traits::FLEN, false);
|
||||
else {
|
||||
auto box = gen_operation(cc, bnot, (gen_ext(cc, 0, /* we need to shift for 32 so need larger dt*/ 64, false)));
|
||||
return gen_ext(cc, (gen_operation(jh.cc, bor, gen_ext(jh.cc, gen_operation(jh.cc, shl, box, 32), traits::FLEN, false), gen_ext(jh.cc, NaNBox32_val, traits::FLEN, false))), traits::FLEN, false);
|
||||
}
|
||||
}
|
||||
x86_reg_t NaNBox64(jit_holder& jh , x86_reg_t NaNBox64_val){
|
||||
x86::Compiler& cc = jh.cc;
|
||||
if(static_cast<uint32_t>(traits::FLEN) == 64)
|
||||
return gen_ext(cc, NaNBox64_val, traits::FLEN, false);
|
||||
else {
|
||||
auto box = gen_operation(cc, bnot, (gen_ext(cc, 0, /* we need to shift for 32 so need larger dt*/ 128, false)));
|
||||
return gen_ext(cc, (gen_operation(jh.cc, bor, gen_ext(jh.cc, gen_operation(jh.cc, shl, box, 64), traits::FLEN, false), gen_ext(jh.cc, NaNBox64_val, traits::FLEN, false))), traits::FLEN, false);
|
||||
}
|
||||
}
|
||||
<%}%>
|
||||
}%>
|
||||
private:
|
||||
/****************************************************************************
|
||||
* start opcode definitions
|
||||
@ -195,7 +191,6 @@ private:
|
||||
mov(cc, jh.next_pc, pc.val);
|
||||
|
||||
gen_instr_prologue(jh);
|
||||
cc.comment("//behavior:");
|
||||
/*generate behavior*/
|
||||
<%instr.behavior.eachLine{%>${it}
|
||||
<%}%>
|
||||
@ -226,7 +221,6 @@ private:
|
||||
pc = pc + ((instr & 3) == 3 ? 4 : 2);
|
||||
mov(cc, jh.next_pc, pc.val);
|
||||
gen_instr_prologue(jh);
|
||||
cc.comment("//behavior:");
|
||||
gen_raise(jh, 0, 2);
|
||||
gen_sync(jh, POST_SYNC, instr_descr.size());
|
||||
gen_instr_epilogue(jh);
|
||||
@ -272,24 +266,25 @@ template <typename ARCH>
|
||||
void vm_impl<ARCH>::gen_instr_prologue(jit_holder& jh) {
|
||||
auto& cc = jh.cc;
|
||||
|
||||
cc.comment("//gen_instr_prologue");
|
||||
|
||||
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);
|
||||
cc.comment("//Instruction prologue end");
|
||||
|
||||
}
|
||||
template <typename ARCH>
|
||||
void vm_impl<ARCH>::gen_instr_epilogue(jit_holder& jh) {
|
||||
auto& cc = jh.cc;
|
||||
|
||||
cc.comment("//gen_instr_epilogue");
|
||||
cc.comment("//Instruction epilogue begin");
|
||||
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);
|
||||
cc.inc(get_ptr_for(jh, traits::ICOUNT));
|
||||
cc.inc(get_ptr_for(jh, traits::CYCLE));
|
||||
cc.comment("//Instruction epilogue end");
|
||||
|
||||
}
|
||||
template <typename ARCH>
|
||||
void vm_impl<ARCH>::gen_block_prologue(jit_holder& jh){
|
||||
@ -301,7 +296,7 @@ void vm_impl<ARCH>::gen_block_prologue(jit_holder& jh){
|
||||
template <typename ARCH>
|
||||
void vm_impl<ARCH>::gen_block_epilogue(jit_holder& jh){
|
||||
x86::Compiler& cc = jh.cc;
|
||||
cc.comment("//gen_block_epilogue");
|
||||
cc.comment("//block epilogue begin");
|
||||
cc.ret(jh.next_pc);
|
||||
|
||||
cc.bind(jh.trap_entry);
|
||||
@ -313,7 +308,6 @@ void vm_impl<ARCH>::gen_block_epilogue(jit_holder& jh){
|
||||
x86::Gp current_pc = get_reg_for_Gp(cc, traits::PC);
|
||||
mov(cc, current_pc, get_ptr_for(jh, traits::PC));
|
||||
|
||||
cc.comment("//enter trap call;");
|
||||
InvokeNode* call_enter_trap;
|
||||
cc.invoke(&call_enter_trap, &enter_trap, FuncSignature::build<uint64_t, void*, uint64_t, uint64_t, uint64_t>());
|
||||
call_enter_trap->setArg(0, jh.arch_if_ptr);
|
||||
@ -331,7 +325,6 @@ void vm_impl<ARCH>::gen_block_epilogue(jit_holder& jh){
|
||||
template <typename ARCH>
|
||||
inline void vm_impl<ARCH>::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(cc, traits::TRAP_STATE);
|
||||
mov(cc, tmp1, 0x80ULL << 24 | (cause << 16) | trap_id);
|
||||
mov(cc, get_ptr_for(jh, traits::TRAP_STATE), tmp1);
|
||||
|
@ -47,6 +47,22 @@
|
||||
#include <array>
|
||||
#include <iss/debugger/riscv_target_adapter.h>
|
||||
|
||||
#ifndef _MSC_VER
|
||||
using int128_t = __int128;
|
||||
using uint128_t = unsigned __int128;
|
||||
namespace std {
|
||||
template <> struct make_unsigned<__int128> { typedef unsigned __int128 type; };
|
||||
template <> class __make_unsigned_selector<__int128 unsigned, false, false> {
|
||||
public:
|
||||
typedef unsigned __int128 __type;
|
||||
};
|
||||
template <> struct is_signed<int128_t> { static constexpr bool value = true; };
|
||||
template <> struct is_signed<uint128_t> { static constexpr bool value = false; };
|
||||
template <> struct is_unsigned<int128_t> { static constexpr bool value = false; };
|
||||
template <> struct is_unsigned<uint128_t> { static constexpr bool value = true; };
|
||||
} // namespace std
|
||||
#endif
|
||||
|
||||
namespace iss {
|
||||
namespace asmjit {
|
||||
|
||||
@ -112,6 +128,11 @@ protected:
|
||||
auto sign_mask = 1ULL<<(W-1);
|
||||
return (from & mask) | ((from & sign_mask) ? ~mask : 0);
|
||||
}
|
||||
inline void raise(uint16_t trap_id, uint16_t cause){
|
||||
auto trap_val = 0x80ULL << 24 | (cause << 16) | trap_id;
|
||||
this->core.reg.trap_state = trap_val;
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
/****************************************************************************
|
||||
@ -335,7 +356,6 @@ private:
|
||||
mov(cc, jh.next_pc, pc.val);
|
||||
|
||||
gen_instr_prologue(jh);
|
||||
cc.comment("//behavior:");
|
||||
/*generate behavior*/
|
||||
if(rd>=static_cast<uint32_t>(traits::RFS)){
|
||||
gen_raise(jh, 0, static_cast<uint32_t>(traits::RV_CAUSE_ILLEGAL_INSTRUCTION));
|
||||
@ -382,7 +402,6 @@ private:
|
||||
mov(cc, jh.next_pc, pc.val);
|
||||
|
||||
gen_instr_prologue(jh);
|
||||
cc.comment("//behavior:");
|
||||
/*generate behavior*/
|
||||
if(rd>=static_cast<uint32_t>(traits::RFS)){
|
||||
gen_raise(jh, 0, static_cast<uint32_t>(traits::RV_CAUSE_ILLEGAL_INSTRUCTION));
|
||||
@ -429,7 +448,6 @@ private:
|
||||
mov(cc, jh.next_pc, pc.val);
|
||||
|
||||
gen_instr_prologue(jh);
|
||||
cc.comment("//behavior:");
|
||||
/*generate behavior*/
|
||||
mov(jh.cc, get_ptr_for(jh, traits::LAST_BRANCH), static_cast<int>(NO_JUMP));
|
||||
if(rd>=static_cast<uint32_t>(traits::RFS)){
|
||||
@ -488,7 +506,6 @@ private:
|
||||
mov(cc, jh.next_pc, pc.val);
|
||||
|
||||
gen_instr_prologue(jh);
|
||||
cc.comment("//behavior:");
|
||||
/*generate behavior*/
|
||||
mov(jh.cc, get_ptr_for(jh, traits::LAST_BRANCH), static_cast<int>(NO_JUMP));
|
||||
if(rd>=static_cast<uint32_t>(traits::RFS)||rs1>=static_cast<uint32_t>(traits::RFS)){
|
||||
@ -561,7 +578,6 @@ private:
|
||||
mov(cc, jh.next_pc, pc.val);
|
||||
|
||||
gen_instr_prologue(jh);
|
||||
cc.comment("//behavior:");
|
||||
/*generate behavior*/
|
||||
mov(jh.cc, get_ptr_for(jh, traits::LAST_BRANCH), static_cast<int>(NO_JUMP));
|
||||
if(rs2>=static_cast<uint32_t>(traits::RFS)||rs1>=static_cast<uint32_t>(traits::RFS)){
|
||||
@ -625,7 +641,6 @@ private:
|
||||
mov(cc, jh.next_pc, pc.val);
|
||||
|
||||
gen_instr_prologue(jh);
|
||||
cc.comment("//behavior:");
|
||||
/*generate behavior*/
|
||||
mov(jh.cc, get_ptr_for(jh, traits::LAST_BRANCH), static_cast<int>(NO_JUMP));
|
||||
if(rs2>=static_cast<uint32_t>(traits::RFS)||rs1>=static_cast<uint32_t>(traits::RFS)){
|
||||
@ -689,7 +704,6 @@ private:
|
||||
mov(cc, jh.next_pc, pc.val);
|
||||
|
||||
gen_instr_prologue(jh);
|
||||
cc.comment("//behavior:");
|
||||
/*generate behavior*/
|
||||
mov(jh.cc, get_ptr_for(jh, traits::LAST_BRANCH), static_cast<int>(NO_JUMP));
|
||||
if(rs2>=static_cast<uint32_t>(traits::RFS)||rs1>=static_cast<uint32_t>(traits::RFS)){
|
||||
@ -755,7 +769,6 @@ private:
|
||||
mov(cc, jh.next_pc, pc.val);
|
||||
|
||||
gen_instr_prologue(jh);
|
||||
cc.comment("//behavior:");
|
||||
/*generate behavior*/
|
||||
mov(jh.cc, get_ptr_for(jh, traits::LAST_BRANCH), static_cast<int>(NO_JUMP));
|
||||
if(rs2>=static_cast<uint32_t>(traits::RFS)||rs1>=static_cast<uint32_t>(traits::RFS)){
|
||||
@ -821,7 +834,6 @@ private:
|
||||
mov(cc, jh.next_pc, pc.val);
|
||||
|
||||
gen_instr_prologue(jh);
|
||||
cc.comment("//behavior:");
|
||||
/*generate behavior*/
|
||||
mov(jh.cc, get_ptr_for(jh, traits::LAST_BRANCH), static_cast<int>(NO_JUMP));
|
||||
if(rs2>=static_cast<uint32_t>(traits::RFS)||rs1>=static_cast<uint32_t>(traits::RFS)){
|
||||
@ -885,7 +897,6 @@ private:
|
||||
mov(cc, jh.next_pc, pc.val);
|
||||
|
||||
gen_instr_prologue(jh);
|
||||
cc.comment("//behavior:");
|
||||
/*generate behavior*/
|
||||
mov(jh.cc, get_ptr_for(jh, traits::LAST_BRANCH), static_cast<int>(NO_JUMP));
|
||||
if(rs2>=static_cast<uint32_t>(traits::RFS)||rs1>=static_cast<uint32_t>(traits::RFS)){
|
||||
@ -949,7 +960,6 @@ private:
|
||||
mov(cc, jh.next_pc, pc.val);
|
||||
|
||||
gen_instr_prologue(jh);
|
||||
cc.comment("//behavior:");
|
||||
/*generate behavior*/
|
||||
if(rd>=static_cast<uint32_t>(traits::RFS)||rs1>=static_cast<uint32_t>(traits::RFS)){
|
||||
gen_raise(jh, 0, static_cast<uint32_t>(traits::RV_CAUSE_ILLEGAL_INSTRUCTION));
|
||||
@ -1003,7 +1013,6 @@ private:
|
||||
mov(cc, jh.next_pc, pc.val);
|
||||
|
||||
gen_instr_prologue(jh);
|
||||
cc.comment("//behavior:");
|
||||
/*generate behavior*/
|
||||
if(rd>=static_cast<uint32_t>(traits::RFS)||rs1>=static_cast<uint32_t>(traits::RFS)){
|
||||
gen_raise(jh, 0, static_cast<uint32_t>(traits::RV_CAUSE_ILLEGAL_INSTRUCTION));
|
||||
@ -1057,7 +1066,6 @@ private:
|
||||
mov(cc, jh.next_pc, pc.val);
|
||||
|
||||
gen_instr_prologue(jh);
|
||||
cc.comment("//behavior:");
|
||||
/*generate behavior*/
|
||||
if(rd>=static_cast<uint32_t>(traits::RFS)||rs1>=static_cast<uint32_t>(traits::RFS)){
|
||||
gen_raise(jh, 0, static_cast<uint32_t>(traits::RV_CAUSE_ILLEGAL_INSTRUCTION));
|
||||
@ -1111,7 +1119,6 @@ private:
|
||||
mov(cc, jh.next_pc, pc.val);
|
||||
|
||||
gen_instr_prologue(jh);
|
||||
cc.comment("//behavior:");
|
||||
/*generate behavior*/
|
||||
if(rd>=static_cast<uint32_t>(traits::RFS)||rs1>=static_cast<uint32_t>(traits::RFS)){
|
||||
gen_raise(jh, 0, static_cast<uint32_t>(traits::RV_CAUSE_ILLEGAL_INSTRUCTION));
|
||||
@ -1164,7 +1171,6 @@ private:
|
||||
mov(cc, jh.next_pc, pc.val);
|
||||
|
||||
gen_instr_prologue(jh);
|
||||
cc.comment("//behavior:");
|
||||
/*generate behavior*/
|
||||
if(rd>=static_cast<uint32_t>(traits::RFS)||rs1>=static_cast<uint32_t>(traits::RFS)){
|
||||
gen_raise(jh, 0, static_cast<uint32_t>(traits::RV_CAUSE_ILLEGAL_INSTRUCTION));
|
||||
@ -1217,7 +1223,6 @@ private:
|
||||
mov(cc, jh.next_pc, pc.val);
|
||||
|
||||
gen_instr_prologue(jh);
|
||||
cc.comment("//behavior:");
|
||||
/*generate behavior*/
|
||||
if(rs2>=static_cast<uint32_t>(traits::RFS)||rs1>=static_cast<uint32_t>(traits::RFS)){
|
||||
gen_raise(jh, 0, static_cast<uint32_t>(traits::RV_CAUSE_ILLEGAL_INSTRUCTION));
|
||||
@ -1266,7 +1271,6 @@ private:
|
||||
mov(cc, jh.next_pc, pc.val);
|
||||
|
||||
gen_instr_prologue(jh);
|
||||
cc.comment("//behavior:");
|
||||
/*generate behavior*/
|
||||
if(rs2>=static_cast<uint32_t>(traits::RFS)||rs1>=static_cast<uint32_t>(traits::RFS)){
|
||||
gen_raise(jh, 0, static_cast<uint32_t>(traits::RV_CAUSE_ILLEGAL_INSTRUCTION));
|
||||
@ -1315,7 +1319,6 @@ private:
|
||||
mov(cc, jh.next_pc, pc.val);
|
||||
|
||||
gen_instr_prologue(jh);
|
||||
cc.comment("//behavior:");
|
||||
/*generate behavior*/
|
||||
if(rs2>=static_cast<uint32_t>(traits::RFS)||rs1>=static_cast<uint32_t>(traits::RFS)){
|
||||
gen_raise(jh, 0, static_cast<uint32_t>(traits::RV_CAUSE_ILLEGAL_INSTRUCTION));
|
||||
@ -1364,7 +1367,6 @@ private:
|
||||
mov(cc, jh.next_pc, pc.val);
|
||||
|
||||
gen_instr_prologue(jh);
|
||||
cc.comment("//behavior:");
|
||||
/*generate behavior*/
|
||||
if(rd>=static_cast<uint32_t>(traits::RFS)||rs1>=static_cast<uint32_t>(traits::RFS)){
|
||||
gen_raise(jh, 0, static_cast<uint32_t>(traits::RV_CAUSE_ILLEGAL_INSTRUCTION));
|
||||
@ -1414,7 +1416,6 @@ private:
|
||||
mov(cc, jh.next_pc, pc.val);
|
||||
|
||||
gen_instr_prologue(jh);
|
||||
cc.comment("//behavior:");
|
||||
/*generate behavior*/
|
||||
if(rd>=static_cast<uint32_t>(traits::RFS)||rs1>=static_cast<uint32_t>(traits::RFS)){
|
||||
gen_raise(jh, 0, static_cast<uint32_t>(traits::RV_CAUSE_ILLEGAL_INSTRUCTION));
|
||||
@ -1475,7 +1476,6 @@ private:
|
||||
mov(cc, jh.next_pc, pc.val);
|
||||
|
||||
gen_instr_prologue(jh);
|
||||
cc.comment("//behavior:");
|
||||
/*generate behavior*/
|
||||
if(rd>=static_cast<uint32_t>(traits::RFS)||rs1>=static_cast<uint32_t>(traits::RFS)){
|
||||
gen_raise(jh, 0, static_cast<uint32_t>(traits::RV_CAUSE_ILLEGAL_INSTRUCTION));
|
||||
@ -1535,7 +1535,6 @@ private:
|
||||
mov(cc, jh.next_pc, pc.val);
|
||||
|
||||
gen_instr_prologue(jh);
|
||||
cc.comment("//behavior:");
|
||||
/*generate behavior*/
|
||||
if(rd>=static_cast<uint32_t>(traits::RFS)||rs1>=static_cast<uint32_t>(traits::RFS)){
|
||||
gen_raise(jh, 0, static_cast<uint32_t>(traits::RV_CAUSE_ILLEGAL_INSTRUCTION));
|
||||
@ -1584,7 +1583,6 @@ private:
|
||||
mov(cc, jh.next_pc, pc.val);
|
||||
|
||||
gen_instr_prologue(jh);
|
||||
cc.comment("//behavior:");
|
||||
/*generate behavior*/
|
||||
if(rd>=static_cast<uint32_t>(traits::RFS)||rs1>=static_cast<uint32_t>(traits::RFS)){
|
||||
gen_raise(jh, 0, static_cast<uint32_t>(traits::RV_CAUSE_ILLEGAL_INSTRUCTION));
|
||||
@ -1633,7 +1631,6 @@ private:
|
||||
mov(cc, jh.next_pc, pc.val);
|
||||
|
||||
gen_instr_prologue(jh);
|
||||
cc.comment("//behavior:");
|
||||
/*generate behavior*/
|
||||
if(rd>=static_cast<uint32_t>(traits::RFS)||rs1>=static_cast<uint32_t>(traits::RFS)){
|
||||
gen_raise(jh, 0, static_cast<uint32_t>(traits::RV_CAUSE_ILLEGAL_INSTRUCTION));
|
||||
@ -1682,7 +1679,6 @@ private:
|
||||
mov(cc, jh.next_pc, pc.val);
|
||||
|
||||
gen_instr_prologue(jh);
|
||||
cc.comment("//behavior:");
|
||||
/*generate behavior*/
|
||||
if(rd>=static_cast<uint32_t>(traits::RFS)||rs1>=static_cast<uint32_t>(traits::RFS)){
|
||||
gen_raise(jh, 0, static_cast<uint32_t>(traits::RV_CAUSE_ILLEGAL_INSTRUCTION));
|
||||
@ -1731,7 +1727,6 @@ private:
|
||||
mov(cc, jh.next_pc, pc.val);
|
||||
|
||||
gen_instr_prologue(jh);
|
||||
cc.comment("//behavior:");
|
||||
/*generate behavior*/
|
||||
if(rd>=static_cast<uint32_t>(traits::RFS)||rs1>=static_cast<uint32_t>(traits::RFS)){
|
||||
gen_raise(jh, 0, static_cast<uint32_t>(traits::RV_CAUSE_ILLEGAL_INSTRUCTION));
|
||||
@ -1780,7 +1775,6 @@ private:
|
||||
mov(cc, jh.next_pc, pc.val);
|
||||
|
||||
gen_instr_prologue(jh);
|
||||
cc.comment("//behavior:");
|
||||
/*generate behavior*/
|
||||
if(rd>=static_cast<uint32_t>(traits::RFS)||rs1>=static_cast<uint32_t>(traits::RFS)){
|
||||
gen_raise(jh, 0, static_cast<uint32_t>(traits::RV_CAUSE_ILLEGAL_INSTRUCTION));
|
||||
@ -1831,7 +1825,6 @@ private:
|
||||
mov(cc, jh.next_pc, pc.val);
|
||||
|
||||
gen_instr_prologue(jh);
|
||||
cc.comment("//behavior:");
|
||||
/*generate behavior*/
|
||||
if(rd>=static_cast<uint32_t>(traits::RFS)||rs1>=static_cast<uint32_t>(traits::RFS)||rs2>=static_cast<uint32_t>(traits::RFS)){
|
||||
gen_raise(jh, 0, static_cast<uint32_t>(traits::RV_CAUSE_ILLEGAL_INSTRUCTION));
|
||||
@ -1881,7 +1874,6 @@ private:
|
||||
mov(cc, jh.next_pc, pc.val);
|
||||
|
||||
gen_instr_prologue(jh);
|
||||
cc.comment("//behavior:");
|
||||
/*generate behavior*/
|
||||
if(rd>=static_cast<uint32_t>(traits::RFS)||rs1>=static_cast<uint32_t>(traits::RFS)||rs2>=static_cast<uint32_t>(traits::RFS)){
|
||||
gen_raise(jh, 0, static_cast<uint32_t>(traits::RV_CAUSE_ILLEGAL_INSTRUCTION));
|
||||
@ -1931,7 +1923,6 @@ private:
|
||||
mov(cc, jh.next_pc, pc.val);
|
||||
|
||||
gen_instr_prologue(jh);
|
||||
cc.comment("//behavior:");
|
||||
/*generate behavior*/
|
||||
if(rd>=static_cast<uint32_t>(traits::RFS)||rs1>=static_cast<uint32_t>(traits::RFS)||rs2>=static_cast<uint32_t>(traits::RFS)){
|
||||
gen_raise(jh, 0, static_cast<uint32_t>(traits::RV_CAUSE_ILLEGAL_INSTRUCTION));
|
||||
@ -1981,7 +1972,6 @@ private:
|
||||
mov(cc, jh.next_pc, pc.val);
|
||||
|
||||
gen_instr_prologue(jh);
|
||||
cc.comment("//behavior:");
|
||||
/*generate behavior*/
|
||||
if(rd>=static_cast<uint32_t>(traits::RFS)||rs1>=static_cast<uint32_t>(traits::RFS)||rs2>=static_cast<uint32_t>(traits::RFS)){
|
||||
gen_raise(jh, 0, static_cast<uint32_t>(traits::RV_CAUSE_ILLEGAL_INSTRUCTION));
|
||||
@ -2043,7 +2033,6 @@ private:
|
||||
mov(cc, jh.next_pc, pc.val);
|
||||
|
||||
gen_instr_prologue(jh);
|
||||
cc.comment("//behavior:");
|
||||
/*generate behavior*/
|
||||
if(rd>=static_cast<uint32_t>(traits::RFS)||rs1>=static_cast<uint32_t>(traits::RFS)||rs2>=static_cast<uint32_t>(traits::RFS)){
|
||||
gen_raise(jh, 0, static_cast<uint32_t>(traits::RV_CAUSE_ILLEGAL_INSTRUCTION));
|
||||
@ -2103,7 +2092,6 @@ private:
|
||||
mov(cc, jh.next_pc, pc.val);
|
||||
|
||||
gen_instr_prologue(jh);
|
||||
cc.comment("//behavior:");
|
||||
/*generate behavior*/
|
||||
if(rd>=static_cast<uint32_t>(traits::RFS)||rs1>=static_cast<uint32_t>(traits::RFS)||rs2>=static_cast<uint32_t>(traits::RFS)){
|
||||
gen_raise(jh, 0, static_cast<uint32_t>(traits::RV_CAUSE_ILLEGAL_INSTRUCTION));
|
||||
@ -2152,7 +2140,6 @@ private:
|
||||
mov(cc, jh.next_pc, pc.val);
|
||||
|
||||
gen_instr_prologue(jh);
|
||||
cc.comment("//behavior:");
|
||||
/*generate behavior*/
|
||||
if(rd>=static_cast<uint32_t>(traits::RFS)||rs1>=static_cast<uint32_t>(traits::RFS)||rs2>=static_cast<uint32_t>(traits::RFS)){
|
||||
gen_raise(jh, 0, static_cast<uint32_t>(traits::RV_CAUSE_ILLEGAL_INSTRUCTION));
|
||||
@ -2202,7 +2189,6 @@ private:
|
||||
mov(cc, jh.next_pc, pc.val);
|
||||
|
||||
gen_instr_prologue(jh);
|
||||
cc.comment("//behavior:");
|
||||
/*generate behavior*/
|
||||
if(rd>=static_cast<uint32_t>(traits::RFS)||rs1>=static_cast<uint32_t>(traits::RFS)||rs2>=static_cast<uint32_t>(traits::RFS)){
|
||||
gen_raise(jh, 0, static_cast<uint32_t>(traits::RV_CAUSE_ILLEGAL_INSTRUCTION));
|
||||
@ -2254,7 +2240,6 @@ private:
|
||||
mov(cc, jh.next_pc, pc.val);
|
||||
|
||||
gen_instr_prologue(jh);
|
||||
cc.comment("//behavior:");
|
||||
/*generate behavior*/
|
||||
if(rd>=static_cast<uint32_t>(traits::RFS)||rs1>=static_cast<uint32_t>(traits::RFS)||rs2>=static_cast<uint32_t>(traits::RFS)){
|
||||
gen_raise(jh, 0, static_cast<uint32_t>(traits::RV_CAUSE_ILLEGAL_INSTRUCTION));
|
||||
@ -2303,7 +2288,6 @@ private:
|
||||
mov(cc, jh.next_pc, pc.val);
|
||||
|
||||
gen_instr_prologue(jh);
|
||||
cc.comment("//behavior:");
|
||||
/*generate behavior*/
|
||||
if(rd>=static_cast<uint32_t>(traits::RFS)||rs1>=static_cast<uint32_t>(traits::RFS)||rs2>=static_cast<uint32_t>(traits::RFS)){
|
||||
gen_raise(jh, 0, static_cast<uint32_t>(traits::RV_CAUSE_ILLEGAL_INSTRUCTION));
|
||||
@ -2354,7 +2338,6 @@ private:
|
||||
mov(cc, jh.next_pc, pc.val);
|
||||
|
||||
gen_instr_prologue(jh);
|
||||
cc.comment("//behavior:");
|
||||
/*generate behavior*/
|
||||
gen_write_mem(jh, traits::FENCE, static_cast<uint32_t>(traits::fence), (uint8_t)pred<<4|succ, 4);
|
||||
auto returnValue = CONT;
|
||||
@ -2390,7 +2373,6 @@ private:
|
||||
mov(cc, jh.next_pc, pc.val);
|
||||
|
||||
gen_instr_prologue(jh);
|
||||
cc.comment("//behavior:");
|
||||
/*generate behavior*/
|
||||
mov(jh.cc, get_ptr_for(jh, traits::LAST_BRANCH), static_cast<int>(NO_JUMP));
|
||||
gen_raise(jh, 0, 11);
|
||||
@ -2427,7 +2409,6 @@ private:
|
||||
mov(cc, jh.next_pc, pc.val);
|
||||
|
||||
gen_instr_prologue(jh);
|
||||
cc.comment("//behavior:");
|
||||
/*generate behavior*/
|
||||
mov(jh.cc, get_ptr_for(jh, traits::LAST_BRANCH), static_cast<int>(NO_JUMP));
|
||||
gen_raise(jh, 0, 3);
|
||||
@ -2464,7 +2445,6 @@ private:
|
||||
mov(cc, jh.next_pc, pc.val);
|
||||
|
||||
gen_instr_prologue(jh);
|
||||
cc.comment("//behavior:");
|
||||
/*generate behavior*/
|
||||
mov(jh.cc, get_ptr_for(jh, traits::LAST_BRANCH), static_cast<int>(NO_JUMP));
|
||||
gen_leave(jh, 3);
|
||||
@ -2501,11 +2481,9 @@ private:
|
||||
mov(cc, jh.next_pc, pc.val);
|
||||
|
||||
gen_instr_prologue(jh);
|
||||
cc.comment("//behavior:");
|
||||
/*generate behavior*/
|
||||
InvokeNode* call_wait_5;
|
||||
jh.cc.comment("//call_wait");
|
||||
jh.cc.invoke(&call_wait_5, &wait, FuncSignature::build<void, uint32_t>());
|
||||
jh.cc.invoke(&call_wait_5, &wait, FuncSignature::build<void, uint32_t>());
|
||||
setArg(call_wait_5, 0, 1);
|
||||
auto returnValue = CONT;
|
||||
|
||||
@ -2544,7 +2522,6 @@ private:
|
||||
mov(cc, jh.next_pc, pc.val);
|
||||
|
||||
gen_instr_prologue(jh);
|
||||
cc.comment("//behavior:");
|
||||
/*generate behavior*/
|
||||
if(rd>=static_cast<uint32_t>(traits::RFS)||rs1>=static_cast<uint32_t>(traits::RFS)){
|
||||
gen_raise(jh, 0, static_cast<uint32_t>(traits::RV_CAUSE_ILLEGAL_INSTRUCTION));
|
||||
@ -2598,7 +2575,6 @@ private:
|
||||
mov(cc, jh.next_pc, pc.val);
|
||||
|
||||
gen_instr_prologue(jh);
|
||||
cc.comment("//behavior:");
|
||||
/*generate behavior*/
|
||||
if(rd>=static_cast<uint32_t>(traits::RFS)||rs1>=static_cast<uint32_t>(traits::RFS)){
|
||||
gen_raise(jh, 0, static_cast<uint32_t>(traits::RV_CAUSE_ILLEGAL_INSTRUCTION));
|
||||
@ -2652,7 +2628,6 @@ private:
|
||||
mov(cc, jh.next_pc, pc.val);
|
||||
|
||||
gen_instr_prologue(jh);
|
||||
cc.comment("//behavior:");
|
||||
/*generate behavior*/
|
||||
if(rd>=static_cast<uint32_t>(traits::RFS)||rs1>=static_cast<uint32_t>(traits::RFS)){
|
||||
gen_raise(jh, 0, static_cast<uint32_t>(traits::RV_CAUSE_ILLEGAL_INSTRUCTION));
|
||||
@ -2706,7 +2681,6 @@ private:
|
||||
mov(cc, jh.next_pc, pc.val);
|
||||
|
||||
gen_instr_prologue(jh);
|
||||
cc.comment("//behavior:");
|
||||
/*generate behavior*/
|
||||
if(rd>=static_cast<uint32_t>(traits::RFS)){
|
||||
gen_raise(jh, 0, static_cast<uint32_t>(traits::RV_CAUSE_ILLEGAL_INSTRUCTION));
|
||||
@ -2756,7 +2730,6 @@ private:
|
||||
mov(cc, jh.next_pc, pc.val);
|
||||
|
||||
gen_instr_prologue(jh);
|
||||
cc.comment("//behavior:");
|
||||
/*generate behavior*/
|
||||
if(rd>=static_cast<uint32_t>(traits::RFS)){
|
||||
gen_raise(jh, 0, static_cast<uint32_t>(traits::RV_CAUSE_ILLEGAL_INSTRUCTION));
|
||||
@ -2809,7 +2782,6 @@ private:
|
||||
mov(cc, jh.next_pc, pc.val);
|
||||
|
||||
gen_instr_prologue(jh);
|
||||
cc.comment("//behavior:");
|
||||
/*generate behavior*/
|
||||
if(rd>=static_cast<uint32_t>(traits::RFS)){
|
||||
gen_raise(jh, 0, static_cast<uint32_t>(traits::RV_CAUSE_ILLEGAL_INSTRUCTION));
|
||||
@ -2862,7 +2834,6 @@ private:
|
||||
mov(cc, jh.next_pc, pc.val);
|
||||
|
||||
gen_instr_prologue(jh);
|
||||
cc.comment("//behavior:");
|
||||
/*generate behavior*/
|
||||
gen_write_mem(jh, traits::FENCE, static_cast<uint32_t>(traits::fencei), imm, 4);
|
||||
auto returnValue = FLUSH;
|
||||
@ -2902,7 +2873,6 @@ private:
|
||||
mov(cc, jh.next_pc, pc.val);
|
||||
|
||||
gen_instr_prologue(jh);
|
||||
cc.comment("//behavior:");
|
||||
/*generate behavior*/
|
||||
if(rd>=static_cast<uint32_t>(traits::RFS)||rs1>=static_cast<uint32_t>(traits::RFS)||rs2>=static_cast<uint32_t>(traits::RFS)){
|
||||
gen_raise(jh, 0, static_cast<uint32_t>(traits::RV_CAUSE_ILLEGAL_INSTRUCTION));
|
||||
@ -2955,7 +2925,6 @@ private:
|
||||
mov(cc, jh.next_pc, pc.val);
|
||||
|
||||
gen_instr_prologue(jh);
|
||||
cc.comment("//behavior:");
|
||||
/*generate behavior*/
|
||||
if(rd>=static_cast<uint32_t>(traits::RFS)||rs1>=static_cast<uint32_t>(traits::RFS)||rs2>=static_cast<uint32_t>(traits::RFS)){
|
||||
gen_raise(jh, 0, static_cast<uint32_t>(traits::RV_CAUSE_ILLEGAL_INSTRUCTION));
|
||||
@ -3009,7 +2978,6 @@ private:
|
||||
mov(cc, jh.next_pc, pc.val);
|
||||
|
||||
gen_instr_prologue(jh);
|
||||
cc.comment("//behavior:");
|
||||
/*generate behavior*/
|
||||
if(rd>=static_cast<uint32_t>(traits::RFS)||rs1>=static_cast<uint32_t>(traits::RFS)||rs2>=static_cast<uint32_t>(traits::RFS)){
|
||||
gen_raise(jh, 0, static_cast<uint32_t>(traits::RV_CAUSE_ILLEGAL_INSTRUCTION));
|
||||
@ -3062,7 +3030,6 @@ private:
|
||||
mov(cc, jh.next_pc, pc.val);
|
||||
|
||||
gen_instr_prologue(jh);
|
||||
cc.comment("//behavior:");
|
||||
/*generate behavior*/
|
||||
if(rd>=static_cast<uint32_t>(traits::RFS)||rs1>=static_cast<uint32_t>(traits::RFS)||rs2>=static_cast<uint32_t>(traits::RFS)){
|
||||
gen_raise(jh, 0, static_cast<uint32_t>(traits::RV_CAUSE_ILLEGAL_INSTRUCTION));
|
||||
@ -3114,7 +3081,6 @@ private:
|
||||
mov(cc, jh.next_pc, pc.val);
|
||||
|
||||
gen_instr_prologue(jh);
|
||||
cc.comment("//behavior:");
|
||||
/*generate behavior*/
|
||||
if(rd>=static_cast<uint32_t>(traits::RFS)||rs1>=static_cast<uint32_t>(traits::RFS)||rs2>=static_cast<uint32_t>(traits::RFS)){
|
||||
gen_raise(jh, 0, static_cast<uint32_t>(traits::RV_CAUSE_ILLEGAL_INSTRUCTION));
|
||||
@ -3203,7 +3169,6 @@ private:
|
||||
mov(cc, jh.next_pc, pc.val);
|
||||
|
||||
gen_instr_prologue(jh);
|
||||
cc.comment("//behavior:");
|
||||
/*generate behavior*/
|
||||
if(rd>=static_cast<uint32_t>(traits::RFS)||rs1>=static_cast<uint32_t>(traits::RFS)||rs2>=static_cast<uint32_t>(traits::RFS)){
|
||||
gen_raise(jh, 0, static_cast<uint32_t>(traits::RV_CAUSE_ILLEGAL_INSTRUCTION));
|
||||
@ -3270,7 +3235,6 @@ private:
|
||||
mov(cc, jh.next_pc, pc.val);
|
||||
|
||||
gen_instr_prologue(jh);
|
||||
cc.comment("//behavior:");
|
||||
/*generate behavior*/
|
||||
if(rd>=static_cast<uint32_t>(traits::RFS)||rs1>=static_cast<uint32_t>(traits::RFS)||rs2>=static_cast<uint32_t>(traits::RFS)){
|
||||
gen_raise(jh, 0, static_cast<uint32_t>(traits::RV_CAUSE_ILLEGAL_INSTRUCTION));
|
||||
@ -3363,7 +3327,6 @@ private:
|
||||
mov(cc, jh.next_pc, pc.val);
|
||||
|
||||
gen_instr_prologue(jh);
|
||||
cc.comment("//behavior:");
|
||||
/*generate behavior*/
|
||||
if(rd>=static_cast<uint32_t>(traits::RFS)||rs1>=static_cast<uint32_t>(traits::RFS)||rs2>=static_cast<uint32_t>(traits::RFS)){
|
||||
gen_raise(jh, 0, static_cast<uint32_t>(traits::RV_CAUSE_ILLEGAL_INSTRUCTION));
|
||||
@ -3429,7 +3392,6 @@ private:
|
||||
mov(cc, jh.next_pc, pc.val);
|
||||
|
||||
gen_instr_prologue(jh);
|
||||
cc.comment("//behavior:");
|
||||
/*generate behavior*/
|
||||
if(imm){
|
||||
mov(cc, get_ptr_for(jh, traits::X0+ rd+8),
|
||||
@ -3477,7 +3439,6 @@ private:
|
||||
mov(cc, jh.next_pc, pc.val);
|
||||
|
||||
gen_instr_prologue(jh);
|
||||
cc.comment("//behavior:");
|
||||
/*generate behavior*/
|
||||
auto offs = gen_ext(cc,
|
||||
(gen_operation(cc, add, load_reg_from_mem(jh, traits::X0 + rs1+8), uimm)
|
||||
@ -3523,7 +3484,6 @@ private:
|
||||
mov(cc, jh.next_pc, pc.val);
|
||||
|
||||
gen_instr_prologue(jh);
|
||||
cc.comment("//behavior:");
|
||||
/*generate behavior*/
|
||||
auto offs = gen_ext(cc,
|
||||
(gen_operation(cc, add, load_reg_from_mem(jh, traits::X0 + rs1+8), uimm)
|
||||
@ -3566,7 +3526,6 @@ private:
|
||||
mov(cc, jh.next_pc, pc.val);
|
||||
|
||||
gen_instr_prologue(jh);
|
||||
cc.comment("//behavior:");
|
||||
/*generate behavior*/
|
||||
if(rs1>=static_cast<uint32_t>(traits::RFS)){
|
||||
gen_raise(jh, 0, static_cast<uint32_t>(traits::RV_CAUSE_ILLEGAL_INSTRUCTION));
|
||||
@ -3613,7 +3572,6 @@ private:
|
||||
mov(cc, jh.next_pc, pc.val);
|
||||
|
||||
gen_instr_prologue(jh);
|
||||
cc.comment("//behavior:");
|
||||
/*generate behavior*/
|
||||
auto returnValue = CONT;
|
||||
|
||||
@ -3650,7 +3608,6 @@ private:
|
||||
mov(cc, jh.next_pc, pc.val);
|
||||
|
||||
gen_instr_prologue(jh);
|
||||
cc.comment("//behavior:");
|
||||
/*generate behavior*/
|
||||
mov(jh.cc, get_ptr_for(jh, traits::LAST_BRANCH), static_cast<int>(NO_JUMP));
|
||||
mov(cc, get_ptr_for(jh, traits::X0+ 1),
|
||||
@ -3694,7 +3651,6 @@ private:
|
||||
mov(cc, jh.next_pc, pc.val);
|
||||
|
||||
gen_instr_prologue(jh);
|
||||
cc.comment("//behavior:");
|
||||
/*generate behavior*/
|
||||
if(rd>=static_cast<uint32_t>(traits::RFS)){
|
||||
gen_raise(jh, 0, static_cast<uint32_t>(traits::RV_CAUSE_ILLEGAL_INSTRUCTION));
|
||||
@ -3741,7 +3697,6 @@ private:
|
||||
mov(cc, jh.next_pc, pc.val);
|
||||
|
||||
gen_instr_prologue(jh);
|
||||
cc.comment("//behavior:");
|
||||
/*generate behavior*/
|
||||
if(imm==0||rd>=static_cast<uint32_t>(traits::RFS)){
|
||||
gen_raise(jh, 0, static_cast<uint32_t>(traits::RV_CAUSE_ILLEGAL_INSTRUCTION));
|
||||
@ -3785,7 +3740,6 @@ private:
|
||||
mov(cc, jh.next_pc, pc.val);
|
||||
|
||||
gen_instr_prologue(jh);
|
||||
cc.comment("//behavior:");
|
||||
/*generate behavior*/
|
||||
if(nzimm){
|
||||
mov(cc, get_ptr_for(jh, traits::X0+ 2),
|
||||
@ -3830,7 +3784,6 @@ private:
|
||||
mov(cc, jh.next_pc, pc.val);
|
||||
|
||||
gen_instr_prologue(jh);
|
||||
cc.comment("//behavior:");
|
||||
/*generate behavior*/
|
||||
gen_raise(jh, 0, static_cast<uint32_t>(traits::RV_CAUSE_ILLEGAL_INSTRUCTION));
|
||||
auto returnValue = CONT;
|
||||
@ -3869,7 +3822,6 @@ private:
|
||||
mov(cc, jh.next_pc, pc.val);
|
||||
|
||||
gen_instr_prologue(jh);
|
||||
cc.comment("//behavior:");
|
||||
/*generate behavior*/
|
||||
mov(cc, get_ptr_for(jh, traits::X0+ rs1+8),
|
||||
gen_operation(cc, shr, load_reg_from_mem(jh, traits::X0 + rs1+8), shamt)
|
||||
@ -3910,7 +3862,6 @@ private:
|
||||
mov(cc, jh.next_pc, pc.val);
|
||||
|
||||
gen_instr_prologue(jh);
|
||||
cc.comment("//behavior:");
|
||||
/*generate behavior*/
|
||||
if(shamt){
|
||||
mov(cc, get_ptr_for(jh, traits::X0+ rs1+8),
|
||||
@ -3964,7 +3915,6 @@ private:
|
||||
mov(cc, jh.next_pc, pc.val);
|
||||
|
||||
gen_instr_prologue(jh);
|
||||
cc.comment("//behavior:");
|
||||
/*generate behavior*/
|
||||
mov(cc, get_ptr_for(jh, traits::X0+ rs1+8),
|
||||
gen_ext(cc,
|
||||
@ -4006,7 +3956,6 @@ private:
|
||||
mov(cc, jh.next_pc, pc.val);
|
||||
|
||||
gen_instr_prologue(jh);
|
||||
cc.comment("//behavior:");
|
||||
/*generate behavior*/
|
||||
mov(cc, get_ptr_for(jh, traits::X0+ rd+8),
|
||||
gen_ext(cc,
|
||||
@ -4048,7 +3997,6 @@ private:
|
||||
mov(cc, jh.next_pc, pc.val);
|
||||
|
||||
gen_instr_prologue(jh);
|
||||
cc.comment("//behavior:");
|
||||
/*generate behavior*/
|
||||
mov(cc, get_ptr_for(jh, traits::X0+ rd+8),
|
||||
gen_operation(cc, bxor, load_reg_from_mem(jh, traits::X0 + rd+8), load_reg_from_mem(jh, traits::X0 + rs2+8))
|
||||
@ -4089,7 +4037,6 @@ private:
|
||||
mov(cc, jh.next_pc, pc.val);
|
||||
|
||||
gen_instr_prologue(jh);
|
||||
cc.comment("//behavior:");
|
||||
/*generate behavior*/
|
||||
mov(cc, get_ptr_for(jh, traits::X0+ rd+8),
|
||||
gen_operation(cc, bor, load_reg_from_mem(jh, traits::X0 + rd+8), load_reg_from_mem(jh, traits::X0 + rs2+8))
|
||||
@ -4130,7 +4077,6 @@ private:
|
||||
mov(cc, jh.next_pc, pc.val);
|
||||
|
||||
gen_instr_prologue(jh);
|
||||
cc.comment("//behavior:");
|
||||
/*generate behavior*/
|
||||
mov(cc, get_ptr_for(jh, traits::X0+ rd+8),
|
||||
gen_operation(cc, band, load_reg_from_mem(jh, traits::X0 + rd+8), load_reg_from_mem(jh, traits::X0 + rs2+8))
|
||||
@ -4170,7 +4116,6 @@ private:
|
||||
mov(cc, jh.next_pc, pc.val);
|
||||
|
||||
gen_instr_prologue(jh);
|
||||
cc.comment("//behavior:");
|
||||
/*generate behavior*/
|
||||
mov(jh.cc, get_ptr_for(jh, traits::LAST_BRANCH), static_cast<int>(NO_JUMP));
|
||||
auto PC_val_v = (uint32_t)(PC+(int16_t)sext<12>(imm));
|
||||
@ -4212,7 +4157,6 @@ private:
|
||||
mov(cc, jh.next_pc, pc.val);
|
||||
|
||||
gen_instr_prologue(jh);
|
||||
cc.comment("//behavior:");
|
||||
/*generate behavior*/
|
||||
mov(jh.cc, get_ptr_for(jh, traits::LAST_BRANCH), static_cast<int>(NO_JUMP));
|
||||
{
|
||||
@ -4263,7 +4207,6 @@ private:
|
||||
mov(cc, jh.next_pc, pc.val);
|
||||
|
||||
gen_instr_prologue(jh);
|
||||
cc.comment("//behavior:");
|
||||
/*generate behavior*/
|
||||
mov(jh.cc, get_ptr_for(jh, traits::LAST_BRANCH), static_cast<int>(NO_JUMP));
|
||||
{
|
||||
@ -4314,7 +4257,6 @@ private:
|
||||
mov(cc, jh.next_pc, pc.val);
|
||||
|
||||
gen_instr_prologue(jh);
|
||||
cc.comment("//behavior:");
|
||||
/*generate behavior*/
|
||||
if(rs1>=static_cast<uint32_t>(traits::RFS)){
|
||||
gen_raise(jh, 0, static_cast<uint32_t>(traits::RV_CAUSE_ILLEGAL_INSTRUCTION));
|
||||
@ -4362,7 +4304,6 @@ private:
|
||||
mov(cc, jh.next_pc, pc.val);
|
||||
|
||||
gen_instr_prologue(jh);
|
||||
cc.comment("//behavior:");
|
||||
/*generate behavior*/
|
||||
if(rd>=static_cast<uint32_t>(traits::RFS)||rd==0){
|
||||
gen_raise(jh, 0, static_cast<uint32_t>(traits::RV_CAUSE_ILLEGAL_INSTRUCTION));
|
||||
@ -4412,7 +4353,6 @@ private:
|
||||
mov(cc, jh.next_pc, pc.val);
|
||||
|
||||
gen_instr_prologue(jh);
|
||||
cc.comment("//behavior:");
|
||||
/*generate behavior*/
|
||||
if(rd>=static_cast<uint32_t>(traits::RFS)){
|
||||
gen_raise(jh, 0, static_cast<uint32_t>(traits::RV_CAUSE_ILLEGAL_INSTRUCTION));
|
||||
@ -4458,7 +4398,6 @@ private:
|
||||
mov(cc, jh.next_pc, pc.val);
|
||||
|
||||
gen_instr_prologue(jh);
|
||||
cc.comment("//behavior:");
|
||||
/*generate behavior*/
|
||||
mov(jh.cc, get_ptr_for(jh, traits::LAST_BRANCH), static_cast<int>(NO_JUMP));
|
||||
if(rs1&&rs1<static_cast<uint32_t>(traits::RFS)){
|
||||
@ -4504,7 +4443,6 @@ private:
|
||||
mov(cc, jh.next_pc, pc.val);
|
||||
|
||||
gen_instr_prologue(jh);
|
||||
cc.comment("//behavior:");
|
||||
/*generate behavior*/
|
||||
gen_raise(jh, 0, 2);
|
||||
auto returnValue = CONT;
|
||||
@ -4543,7 +4481,6 @@ private:
|
||||
mov(cc, jh.next_pc, pc.val);
|
||||
|
||||
gen_instr_prologue(jh);
|
||||
cc.comment("//behavior:");
|
||||
/*generate behavior*/
|
||||
if(rd>=static_cast<uint32_t>(traits::RFS)){
|
||||
gen_raise(jh, 0, static_cast<uint32_t>(traits::RV_CAUSE_ILLEGAL_INSTRUCTION));
|
||||
@ -4591,7 +4528,6 @@ private:
|
||||
mov(cc, jh.next_pc, pc.val);
|
||||
|
||||
gen_instr_prologue(jh);
|
||||
cc.comment("//behavior:");
|
||||
/*generate behavior*/
|
||||
mov(jh.cc, get_ptr_for(jh, traits::LAST_BRANCH), static_cast<int>(NO_JUMP));
|
||||
if(rs1>=static_cast<uint32_t>(traits::RFS)){
|
||||
@ -4640,7 +4576,6 @@ private:
|
||||
mov(cc, jh.next_pc, pc.val);
|
||||
|
||||
gen_instr_prologue(jh);
|
||||
cc.comment("//behavior:");
|
||||
/*generate behavior*/
|
||||
gen_raise(jh, 0, 3);
|
||||
auto returnValue = CONT;
|
||||
@ -4679,7 +4614,6 @@ private:
|
||||
mov(cc, jh.next_pc, pc.val);
|
||||
|
||||
gen_instr_prologue(jh);
|
||||
cc.comment("//behavior:");
|
||||
/*generate behavior*/
|
||||
if(rs2>=static_cast<uint32_t>(traits::RFS)){
|
||||
gen_raise(jh, 0, static_cast<uint32_t>(traits::RV_CAUSE_ILLEGAL_INSTRUCTION));
|
||||
@ -4724,7 +4658,6 @@ private:
|
||||
mov(cc, jh.next_pc, pc.val);
|
||||
|
||||
gen_instr_prologue(jh);
|
||||
cc.comment("//behavior:");
|
||||
/*generate behavior*/
|
||||
gen_raise(jh, 0, static_cast<uint32_t>(traits::RV_CAUSE_ILLEGAL_INSTRUCTION));
|
||||
auto returnValue = CONT;
|
||||
@ -4756,7 +4689,6 @@ private:
|
||||
pc = pc + ((instr & 3) == 3 ? 4 : 2);
|
||||
mov(cc, jh.next_pc, pc.val);
|
||||
gen_instr_prologue(jh);
|
||||
cc.comment("//behavior:");
|
||||
gen_raise(jh, 0, 2);
|
||||
gen_sync(jh, POST_SYNC, instr_descr.size());
|
||||
gen_instr_epilogue(jh);
|
||||
@ -4802,24 +4734,25 @@ template <typename ARCH>
|
||||
void vm_impl<ARCH>::gen_instr_prologue(jit_holder& jh) {
|
||||
auto& cc = jh.cc;
|
||||
|
||||
cc.comment("//gen_instr_prologue");
|
||||
|
||||
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);
|
||||
cc.comment("//Instruction prologue end");
|
||||
|
||||
}
|
||||
template <typename ARCH>
|
||||
void vm_impl<ARCH>::gen_instr_epilogue(jit_holder& jh) {
|
||||
auto& cc = jh.cc;
|
||||
|
||||
cc.comment("//gen_instr_epilogue");
|
||||
cc.comment("//Instruction epilogue begin");
|
||||
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);
|
||||
cc.inc(get_ptr_for(jh, traits::ICOUNT));
|
||||
cc.inc(get_ptr_for(jh, traits::CYCLE));
|
||||
cc.comment("//Instruction epilogue end");
|
||||
|
||||
}
|
||||
template <typename ARCH>
|
||||
void vm_impl<ARCH>::gen_block_prologue(jit_holder& jh){
|
||||
@ -4831,7 +4764,7 @@ void vm_impl<ARCH>::gen_block_prologue(jit_holder& jh){
|
||||
template <typename ARCH>
|
||||
void vm_impl<ARCH>::gen_block_epilogue(jit_holder& jh){
|
||||
x86::Compiler& cc = jh.cc;
|
||||
cc.comment("//gen_block_epilogue");
|
||||
cc.comment("//block epilogue begin");
|
||||
cc.ret(jh.next_pc);
|
||||
|
||||
cc.bind(jh.trap_entry);
|
||||
@ -4843,7 +4776,6 @@ void vm_impl<ARCH>::gen_block_epilogue(jit_holder& jh){
|
||||
x86::Gp current_pc = get_reg_for_Gp(cc, traits::PC);
|
||||
mov(cc, current_pc, get_ptr_for(jh, traits::PC));
|
||||
|
||||
cc.comment("//enter trap call;");
|
||||
InvokeNode* call_enter_trap;
|
||||
cc.invoke(&call_enter_trap, &enter_trap, FuncSignature::build<uint64_t, void*, uint64_t, uint64_t, uint64_t>());
|
||||
call_enter_trap->setArg(0, jh.arch_if_ptr);
|
||||
@ -4861,7 +4793,6 @@ void vm_impl<ARCH>::gen_block_epilogue(jit_holder& jh){
|
||||
template <typename ARCH>
|
||||
inline void vm_impl<ARCH>::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(cc, traits::TRAP_STATE);
|
||||
mov(cc, tmp1, 0x80ULL << 24 | (cause << 16) | trap_id);
|
||||
mov(cc, get_ptr_for(jh, traits::TRAP_STATE), tmp1);
|
||||
|
Loading…
x
Reference in New Issue
Block a user