adds verilog literal and illegal_instr to asmjit
This commit is contained in:
parent
fb330cddea
commit
a27850f841
|
@ -174,9 +174,17 @@ private:
|
|||
* end opcode definitions
|
||||
****************************************************************************/
|
||||
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());
|
||||
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());
|
||||
return BRANCH;
|
||||
}
|
||||
|
||||
//decoding functionality
|
||||
|
||||
void populate_decoding_tree(decoding_tree_node* root){
|
||||
|
|
|
@ -80,7 +80,7 @@ public:
|
|||
|
||||
protected:
|
||||
using super::get_ptr_for;
|
||||
using super::get_reg;
|
||||
using super::get_reg;
|
||||
using super::get_reg_for;
|
||||
using super::load_reg_from_mem;
|
||||
using super::write_reg_to_mem;
|
||||
|
@ -342,7 +342,7 @@ private:
|
|||
gen_raise(jh, 0, 2);
|
||||
}
|
||||
else{
|
||||
if(rd!= 0){
|
||||
if(rd!=0){
|
||||
cc.mov(get_ptr_for(jh, traits::X0+ rd),
|
||||
(uint32_t)((int32_t)imm));
|
||||
}
|
||||
|
@ -388,7 +388,7 @@ private:
|
|||
gen_raise(jh, 0, 2);
|
||||
}
|
||||
else{
|
||||
if(rd!= 0){
|
||||
if(rd!=0){
|
||||
cc.mov(get_ptr_for(jh, traits::X0+ rd),
|
||||
(uint32_t)(PC+(int32_t)imm));
|
||||
}
|
||||
|
@ -438,9 +438,9 @@ private:
|
|||
gen_raise(jh, 0, 0);
|
||||
}
|
||||
else{
|
||||
if(rd!= 0){
|
||||
if(rd!=0){
|
||||
cc.mov(get_ptr_for(jh, traits::X0+ rd),
|
||||
(uint32_t)(PC+ 4));
|
||||
(uint32_t)(PC+4));
|
||||
}
|
||||
auto PC_val_v = (uint32_t)(PC+(int32_t)sext<21>(imm));
|
||||
cc.mov(jh.next_pc, PC_val_v);
|
||||
|
@ -505,9 +505,9 @@ private:
|
|||
cc.jmp(label_merge);
|
||||
cc.bind(label_else);
|
||||
{
|
||||
if(rd!= 0){
|
||||
if(rd!=0){
|
||||
cc.mov(get_ptr_for(jh, traits::X0+ rd),
|
||||
(uint32_t)(PC+ 4));
|
||||
(uint32_t)(PC+4));
|
||||
}
|
||||
auto PC_val_v = new_pc;
|
||||
cc.mov(jh.next_pc, PC_val_v);
|
||||
|
@ -914,7 +914,7 @@ private:
|
|||
), 32, true);
|
||||
auto res = gen_ext(jh,
|
||||
gen_read_mem(jh, traits::MEM, load_address, 1), 8, false);
|
||||
if(rd!= 0){
|
||||
if(rd!=0){
|
||||
cc.mov(get_ptr_for(jh, traits::X0+ rd),
|
||||
gen_ext(jh,
|
||||
res, 32, true));
|
||||
|
@ -967,7 +967,7 @@ private:
|
|||
), 32, true);
|
||||
auto res = gen_ext(jh,
|
||||
gen_read_mem(jh, traits::MEM, load_address, 2), 16, false);
|
||||
if(rd!= 0){
|
||||
if(rd!=0){
|
||||
cc.mov(get_ptr_for(jh, traits::X0+ rd),
|
||||
gen_ext(jh,
|
||||
res, 32, true));
|
||||
|
@ -1020,7 +1020,7 @@ private:
|
|||
), 32, true);
|
||||
auto res = gen_ext(jh,
|
||||
gen_read_mem(jh, traits::MEM, load_address, 4), 32, false);
|
||||
if(rd!= 0){
|
||||
if(rd!=0){
|
||||
cc.mov(get_ptr_for(jh, traits::X0+ rd),
|
||||
gen_ext(jh,
|
||||
res, 32, true));
|
||||
|
@ -1072,7 +1072,7 @@ private:
|
|||
(gen_operation(jh, 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){
|
||||
if(rd!=0){
|
||||
cc.mov(get_ptr_for(jh, traits::X0+ rd),
|
||||
gen_ext(jh,
|
||||
res, 32, false));
|
||||
|
@ -1124,7 +1124,7 @@ private:
|
|||
(gen_operation(jh, 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){
|
||||
if(rd!=0){
|
||||
cc.mov(get_ptr_for(jh, traits::X0+ rd),
|
||||
gen_ext(jh,
|
||||
res, 32, false));
|
||||
|
@ -1316,7 +1316,7 @@ private:
|
|||
gen_raise(jh, 0, 2);
|
||||
}
|
||||
else{
|
||||
if(rd!= 0){
|
||||
if(rd!=0){
|
||||
cc.mov(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))
|
||||
|
@ -1365,7 +1365,7 @@ private:
|
|||
gen_raise(jh, 0, 2);
|
||||
}
|
||||
else{
|
||||
if(rd!= 0){
|
||||
if(rd!=0){
|
||||
{
|
||||
auto label_then = cc.newLabel();
|
||||
auto label_merge = cc.newLabel();
|
||||
|
@ -1373,10 +1373,10 @@ private:
|
|||
cc.cmp(gen_ext(jh,
|
||||
load_reg_from_mem(jh, traits::X0 + rs1), 32, true), (int16_t)sext<12>(imm));
|
||||
cc.jl(label_then);
|
||||
cc.mov(tmp_reg, 0);
|
||||
cc.mov(tmp_reg,0);
|
||||
cc.jmp(label_merge);
|
||||
cc.bind(label_then);
|
||||
cc.mov(tmp_reg, 1);
|
||||
cc.mov(tmp_reg,1);
|
||||
cc.bind(label_merge);
|
||||
cc.mov(get_ptr_for(jh, traits::X0+ rd),
|
||||
gen_ext(jh, tmp_reg
|
||||
|
@ -1427,17 +1427,17 @@ private:
|
|||
gen_raise(jh, 0, 2);
|
||||
}
|
||||
else{
|
||||
if(rd!= 0){
|
||||
if(rd!=0){
|
||||
{
|
||||
auto label_then = cc.newLabel();
|
||||
auto label_merge = cc.newLabel();
|
||||
auto tmp_reg = get_reg_for(jh, 1);
|
||||
cc.cmp(load_reg_from_mem(jh, traits::X0 + rs1), (uint32_t)((int16_t)sext<12>(imm)));
|
||||
cc.jb(label_then);
|
||||
cc.mov(tmp_reg, 0);
|
||||
cc.mov(tmp_reg,0);
|
||||
cc.jmp(label_merge);
|
||||
cc.bind(label_then);
|
||||
cc.mov(tmp_reg, 1);
|
||||
cc.mov(tmp_reg,1);
|
||||
cc.bind(label_merge);
|
||||
cc.mov(get_ptr_for(jh, traits::X0+ rd),
|
||||
gen_ext(jh, tmp_reg
|
||||
|
@ -1488,7 +1488,7 @@ private:
|
|||
gen_raise(jh, 0, 2);
|
||||
}
|
||||
else{
|
||||
if(rd!= 0){
|
||||
if(rd!=0){
|
||||
cc.mov(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)))
|
||||
);
|
||||
|
@ -1536,7 +1536,7 @@ private:
|
|||
gen_raise(jh, 0, 2);
|
||||
}
|
||||
else{
|
||||
if(rd!= 0){
|
||||
if(rd!=0){
|
||||
cc.mov(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)))
|
||||
);
|
||||
|
@ -1584,7 +1584,7 @@ private:
|
|||
gen_raise(jh, 0, 2);
|
||||
}
|
||||
else{
|
||||
if(rd!= 0){
|
||||
if(rd!=0){
|
||||
cc.mov(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)))
|
||||
);
|
||||
|
@ -1632,7 +1632,7 @@ private:
|
|||
gen_raise(jh, 0, 2);
|
||||
}
|
||||
else{
|
||||
if(rd!= 0){
|
||||
if(rd!=0){
|
||||
cc.mov(get_ptr_for(jh, traits::X0+ rd),
|
||||
gen_operation(jh, shl, load_reg_from_mem(jh, traits::X0 + rs1), shamt)
|
||||
);
|
||||
|
@ -1680,7 +1680,7 @@ private:
|
|||
gen_raise(jh, 0, 2);
|
||||
}
|
||||
else{
|
||||
if(rd!= 0){
|
||||
if(rd!=0){
|
||||
cc.mov(get_ptr_for(jh, traits::X0+ rd),
|
||||
gen_operation(jh, shr, load_reg_from_mem(jh, traits::X0 + rs1), shamt)
|
||||
);
|
||||
|
@ -1728,7 +1728,7 @@ private:
|
|||
gen_raise(jh, 0, 2);
|
||||
}
|
||||
else{
|
||||
if(rd!= 0){
|
||||
if(rd!=0){
|
||||
cc.mov(get_ptr_for(jh, traits::X0+ rd),
|
||||
gen_ext(jh,
|
||||
(gen_operation(jh, sar, gen_ext(jh,
|
||||
|
@ -1778,7 +1778,7 @@ private:
|
|||
gen_raise(jh, 0, 2);
|
||||
}
|
||||
else{
|
||||
if(rd!= 0){
|
||||
if(rd!=0){
|
||||
cc.mov(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))
|
||||
|
@ -1827,7 +1827,7 @@ private:
|
|||
gen_raise(jh, 0, 2);
|
||||
}
|
||||
else{
|
||||
if(rd!= 0){
|
||||
if(rd!=0){
|
||||
cc.mov(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))
|
||||
|
@ -1876,9 +1876,9 @@ private:
|
|||
gen_raise(jh, 0, 2);
|
||||
}
|
||||
else{
|
||||
if(rd!= 0){
|
||||
if(rd!=0){
|
||||
cc.mov(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<uint32_t>(traits::XLEN)- 1))
|
||||
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<uint32_t>(traits::XLEN)-1))
|
||||
))
|
||||
, 32, false));
|
||||
}
|
||||
|
@ -1925,7 +1925,7 @@ private:
|
|||
gen_raise(jh, 0, 2);
|
||||
}
|
||||
else{
|
||||
if(rd!= 0){
|
||||
if(rd!=0){
|
||||
{
|
||||
auto label_then = cc.newLabel();
|
||||
auto label_merge = cc.newLabel();
|
||||
|
@ -1934,10 +1934,10 @@ private:
|
|||
load_reg_from_mem(jh, traits::X0 + rs1), 32, true), gen_ext(jh,
|
||||
load_reg_from_mem(jh, traits::X0 + rs2), 32, true));
|
||||
cc.jl(label_then);
|
||||
cc.mov(tmp_reg, 0);
|
||||
cc.mov(tmp_reg,0);
|
||||
cc.jmp(label_merge);
|
||||
cc.bind(label_then);
|
||||
cc.mov(tmp_reg, 1);
|
||||
cc.mov(tmp_reg,1);
|
||||
cc.bind(label_merge);
|
||||
cc.mov(get_ptr_for(jh, traits::X0+ rd),
|
||||
gen_ext(jh, tmp_reg
|
||||
|
@ -1988,17 +1988,17 @@ private:
|
|||
gen_raise(jh, 0, 2);
|
||||
}
|
||||
else{
|
||||
if(rd!= 0){
|
||||
if(rd!=0){
|
||||
{
|
||||
auto label_then = cc.newLabel();
|
||||
auto label_merge = cc.newLabel();
|
||||
auto tmp_reg = get_reg_for(jh, 1);
|
||||
cc.cmp(load_reg_from_mem(jh, traits::X0 + rs1), load_reg_from_mem(jh, traits::X0 + rs2));
|
||||
cc.jb(label_then);
|
||||
cc.mov(tmp_reg, 0);
|
||||
cc.mov(tmp_reg,0);
|
||||
cc.jmp(label_merge);
|
||||
cc.bind(label_then);
|
||||
cc.mov(tmp_reg, 1);
|
||||
cc.mov(tmp_reg,1);
|
||||
cc.bind(label_merge);
|
||||
cc.mov(get_ptr_for(jh, traits::X0+ rd),
|
||||
gen_ext(jh, tmp_reg
|
||||
|
@ -2049,7 +2049,7 @@ private:
|
|||
gen_raise(jh, 0, 2);
|
||||
}
|
||||
else{
|
||||
if(rd!= 0){
|
||||
if(rd!=0){
|
||||
cc.mov(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))
|
||||
);
|
||||
|
@ -2097,9 +2097,9 @@ private:
|
|||
gen_raise(jh, 0, 2);
|
||||
}
|
||||
else{
|
||||
if(rd!= 0){
|
||||
if(rd!=0){
|
||||
cc.mov(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<uint32_t>(traits::XLEN)- 1))
|
||||
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<uint32_t>(traits::XLEN)-1))
|
||||
))
|
||||
, 32, false));
|
||||
}
|
||||
|
@ -2146,11 +2146,11 @@ private:
|
|||
gen_raise(jh, 0, 2);
|
||||
}
|
||||
else{
|
||||
if(rd!= 0){
|
||||
if(rd!=0){
|
||||
cc.mov(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<uint32_t>(traits::XLEN)- 1))
|
||||
load_reg_from_mem(jh, traits::X0 + rs1), 32, true), (gen_operation(jh, band, load_reg_from_mem(jh, traits::X0 + rs2), (static_cast<uint32_t>(traits::XLEN)-1))
|
||||
))
|
||||
, 32, true)), 32, true));
|
||||
}
|
||||
|
@ -2197,7 +2197,7 @@ private:
|
|||
gen_raise(jh, 0, 2);
|
||||
}
|
||||
else{
|
||||
if(rd!= 0){
|
||||
if(rd!=0){
|
||||
cc.mov(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))
|
||||
);
|
||||
|
@ -2245,7 +2245,7 @@ private:
|
|||
gen_raise(jh, 0, 2);
|
||||
}
|
||||
else{
|
||||
if(rd!= 0){
|
||||
if(rd!=0){
|
||||
cc.mov(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))
|
||||
);
|
||||
|
@ -2291,7 +2291,7 @@ private:
|
|||
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);
|
||||
gen_write_mem(jh, traits::FENCE, static_cast<uint32_t>(traits::fence), (uint8_t)pred<<4|succ, 4);
|
||||
auto returnValue = CONT;
|
||||
|
||||
gen_instr_epilogue(jh);
|
||||
|
@ -2475,7 +2475,7 @@ private:
|
|||
}
|
||||
else{
|
||||
auto xrs1 = load_reg_from_mem(jh, traits::X0 + rs1);
|
||||
if(rd!= 0){
|
||||
if(rd!=0){
|
||||
auto xrd = gen_read_mem(jh, traits::CSR, csr, 4);
|
||||
gen_write_mem(jh, traits::CSR, csr, xrs1, 4);
|
||||
cc.mov(get_ptr_for(jh, traits::X0+ rd),
|
||||
|
@ -2529,11 +2529,11 @@ private:
|
|||
else{
|
||||
auto xrd = gen_read_mem(jh, traits::CSR, csr, 4);
|
||||
auto xrs1 = load_reg_from_mem(jh, traits::X0 + rs1);
|
||||
if(rs1!= 0){
|
||||
if(rs1!=0){
|
||||
gen_write_mem(jh, traits::CSR, csr, gen_operation(jh, bor, xrd, xrs1)
|
||||
, 4);
|
||||
}
|
||||
if(rd!= 0){
|
||||
if(rd!=0){
|
||||
cc.mov(get_ptr_for(jh, traits::X0+ rd),
|
||||
xrd);
|
||||
}
|
||||
|
@ -2582,11 +2582,11 @@ private:
|
|||
else{
|
||||
auto xrd = gen_read_mem(jh, traits::CSR, csr, 4);
|
||||
auto xrs1 = load_reg_from_mem(jh, traits::X0 + rs1);
|
||||
if(rs1!= 0){
|
||||
if(rs1!=0){
|
||||
gen_write_mem(jh, traits::CSR, csr, gen_operation(jh, band, xrd, gen_operation(jh, bnot, xrs1))
|
||||
, 4);
|
||||
}
|
||||
if(rd!= 0){
|
||||
if(rd!=0){
|
||||
cc.mov(get_ptr_for(jh, traits::X0+ rd),
|
||||
xrd);
|
||||
}
|
||||
|
@ -2635,7 +2635,7 @@ private:
|
|||
else{
|
||||
auto xrd = gen_read_mem(jh, traits::CSR, csr, 4);
|
||||
gen_write_mem(jh, traits::CSR, csr, (uint32_t)zimm, 4);
|
||||
if(rd!= 0){
|
||||
if(rd!=0){
|
||||
cc.mov(get_ptr_for(jh, traits::X0+ rd),
|
||||
xrd);
|
||||
}
|
||||
|
@ -2683,11 +2683,11 @@ private:
|
|||
}
|
||||
else{
|
||||
auto xrd = gen_read_mem(jh, traits::CSR, csr, 4);
|
||||
if(zimm!= 0){
|
||||
if(zimm!=0){
|
||||
gen_write_mem(jh, traits::CSR, csr, gen_operation(jh, bor, xrd, (uint32_t)zimm)
|
||||
, 4);
|
||||
}
|
||||
if(rd!= 0){
|
||||
if(rd!=0){
|
||||
cc.mov(get_ptr_for(jh, traits::X0+ rd),
|
||||
xrd);
|
||||
}
|
||||
|
@ -2735,11 +2735,11 @@ private:
|
|||
}
|
||||
else{
|
||||
auto xrd = gen_read_mem(jh, traits::CSR, csr, 4);
|
||||
if(zimm!= 0){
|
||||
if(zimm!=0){
|
||||
gen_write_mem(jh, traits::CSR, csr, gen_operation(jh, band, xrd, ~ ((uint32_t)zimm))
|
||||
, 4);
|
||||
}
|
||||
if(rd!= 0){
|
||||
if(rd!=0){
|
||||
cc.mov(get_ptr_for(jh, traits::X0+ rd),
|
||||
xrd);
|
||||
}
|
||||
|
@ -2826,11 +2826,11 @@ private:
|
|||
}
|
||||
else{
|
||||
auto res = gen_ext(jh,
|
||||
(gen_operation(jh, imul,
|
||||
(gen_operation(jh, imul, gen_ext(jh,
|
||||
gen_ext(jh,
|
||||
gen_ext(jh, load_reg_from_mem(jh, traits::X0 + rs1), 32, true), 64, true),
|
||||
load_reg_from_mem(jh, traits::X0 + rs1), 32, true), 64, true), gen_ext(jh,
|
||||
gen_ext(jh,
|
||||
gen_ext(jh, load_reg_from_mem(jh, traits::X0 + rs2), 32, true), 64, true))
|
||||
load_reg_from_mem(jh, traits::X0 + rs2), 32, true), 64, true))
|
||||
), 64, true);
|
||||
if(rd!=0){
|
||||
cc.mov(get_ptr_for(jh, traits::X0+ rd),
|
||||
|
@ -3049,7 +3049,7 @@ private:
|
|||
load_reg_from_mem(jh, traits::X0 + rs1), 32, false);
|
||||
auto divisor = gen_ext(jh,
|
||||
load_reg_from_mem(jh, traits::X0 + rs2), 32, false);
|
||||
if(rd!= 0){
|
||||
if(rd!=0){
|
||||
auto label_merge = cc.newLabel();
|
||||
cc.cmp(gen_operation(jh, ne, divisor, 0)
|
||||
,0);
|
||||
|
@ -3342,7 +3342,7 @@ private:
|
|||
cc.comment("//behavior:");
|
||||
/*generate behavior*/
|
||||
if(imm){
|
||||
cc.mov(get_ptr_for(jh, traits::X0+ rd+ 8),
|
||||
cc.mov(get_ptr_for(jh, traits::X0+ rd+8),
|
||||
gen_ext(jh,
|
||||
(gen_operation(jh, add, load_reg_from_mem(jh, traits::X0 + 2), imm)
|
||||
), 32, false));
|
||||
|
@ -3389,9 +3389,9 @@ private:
|
|||
cc.comment("//behavior:");
|
||||
/*generate behavior*/
|
||||
auto offs = gen_ext(jh,
|
||||
(gen_operation(jh, add, load_reg_from_mem(jh, traits::X0 + rs1+ 8), uimm)
|
||||
(gen_operation(jh, add, load_reg_from_mem(jh, traits::X0 + rs1+8), uimm)
|
||||
), 32, false);
|
||||
cc.mov(get_ptr_for(jh, traits::X0+ rd+ 8),
|
||||
cc.mov(get_ptr_for(jh, traits::X0+ rd+8),
|
||||
gen_ext(jh,
|
||||
gen_ext(jh,
|
||||
gen_read_mem(jh, traits::MEM, offs, 4), 32, false), 32, true));
|
||||
|
@ -3434,10 +3434,10 @@ private:
|
|||
cc.comment("//behavior:");
|
||||
/*generate behavior*/
|
||||
auto offs = gen_ext(jh,
|
||||
(gen_operation(jh, add, load_reg_from_mem(jh, traits::X0 + rs1+ 8), uimm)
|
||||
(gen_operation(jh, add, load_reg_from_mem(jh, traits::X0 + rs1+8), uimm)
|
||||
), 32, false);
|
||||
gen_write_mem(jh, traits::MEM, offs, gen_ext(jh,
|
||||
load_reg_from_mem(jh, traits::X0 + rs2+ 8), 32, false), 4);
|
||||
load_reg_from_mem(jh, traits::X0 + rs2+8), 32, false), 4);
|
||||
auto returnValue = CONT;
|
||||
|
||||
gen_instr_epilogue(jh);
|
||||
|
@ -3479,7 +3479,7 @@ private:
|
|||
gen_raise(jh, 0, 2);
|
||||
}
|
||||
else{
|
||||
if(rs1!= 0){
|
||||
if(rs1!=0){
|
||||
cc.mov(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))
|
||||
|
@ -3558,7 +3558,7 @@ private:
|
|||
cc.comment("//behavior:");
|
||||
/*generate behavior*/
|
||||
cc.mov(get_ptr_for(jh, traits::X0+ 1),
|
||||
(uint32_t)(PC+ 2));
|
||||
(uint32_t)(PC+2));
|
||||
auto PC_val_v = (uint32_t)(PC+(int16_t)sext<12>(imm));
|
||||
cc.mov(jh.next_pc, PC_val_v);
|
||||
cc.mov(get_ptr_for(jh, traits::LAST_BRANCH), 32U);
|
||||
|
@ -3603,7 +3603,7 @@ private:
|
|||
gen_raise(jh, 0, 2);
|
||||
}
|
||||
else{
|
||||
if(rd!= 0){
|
||||
if(rd!=0){
|
||||
cc.mov(get_ptr_for(jh, traits::X0+ rd),
|
||||
(uint32_t)((int8_t)sext<6>(imm)));
|
||||
}
|
||||
|
@ -3645,10 +3645,10 @@ private:
|
|||
gen_instr_prologue(jh);
|
||||
cc.comment("//behavior:");
|
||||
/*generate behavior*/
|
||||
if(imm== 0||rd>=static_cast<uint32_t>(traits::RFS)){
|
||||
if(imm==0||rd>=static_cast<uint32_t>(traits::RFS)){
|
||||
gen_raise(jh, 0, 2);
|
||||
}
|
||||
if(rd!= 0){
|
||||
if(rd!=0){
|
||||
cc.mov(get_ptr_for(jh, traits::X0+ rd),
|
||||
(uint32_t)((int32_t)sext<18>(imm)));
|
||||
}
|
||||
|
@ -3770,8 +3770,8 @@ private:
|
|||
gen_instr_prologue(jh);
|
||||
cc.comment("//behavior:");
|
||||
/*generate behavior*/
|
||||
cc.mov(get_ptr_for(jh, traits::X0+ rs1+ 8),
|
||||
gen_operation(jh, shr, load_reg_from_mem(jh, traits::X0 + rs1+ 8), shamt)
|
||||
cc.mov(get_ptr_for(jh, traits::X0+ rs1+8),
|
||||
gen_operation(jh, shr, load_reg_from_mem(jh, traits::X0 + rs1+8), shamt)
|
||||
);
|
||||
auto returnValue = CONT;
|
||||
|
||||
|
@ -3811,18 +3811,18 @@ private:
|
|||
cc.comment("//behavior:");
|
||||
/*generate behavior*/
|
||||
if(shamt){
|
||||
cc.mov(get_ptr_for(jh, traits::X0+ rs1+ 8),
|
||||
cc.mov(get_ptr_for(jh, traits::X0+ rs1+8),
|
||||
gen_ext(jh,
|
||||
(gen_operation(jh, sar, (gen_ext(jh,
|
||||
load_reg_from_mem(jh, traits::X0 + rs1+ 8), 32, false)), shamt)
|
||||
load_reg_from_mem(jh, traits::X0 + rs1+8), 32, false)), shamt)
|
||||
), 32, true));
|
||||
}
|
||||
else{
|
||||
if(static_cast<uint32_t>(traits::XLEN)== 128){
|
||||
cc.mov(get_ptr_for(jh, traits::X0+ rs1+ 8),
|
||||
if(static_cast<uint32_t>(traits::XLEN)==128){
|
||||
cc.mov(get_ptr_for(jh, traits::X0+ rs1+8),
|
||||
gen_ext(jh,
|
||||
(gen_operation(jh, sar, (gen_ext(jh,
|
||||
load_reg_from_mem(jh, traits::X0 + rs1+ 8), 32, false)), 64)
|
||||
load_reg_from_mem(jh, traits::X0 + rs1+8), 32, false)), 64)
|
||||
), 32, true));
|
||||
}
|
||||
}
|
||||
|
@ -3863,9 +3863,9 @@ private:
|
|||
gen_instr_prologue(jh);
|
||||
cc.comment("//behavior:");
|
||||
/*generate behavior*/
|
||||
cc.mov(get_ptr_for(jh, traits::X0+ rs1+ 8),
|
||||
cc.mov(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_operation(jh, band, load_reg_from_mem(jh, traits::X0 + rs1+8), (int8_t)sext<6>(imm))
|
||||
), 32, true));
|
||||
auto returnValue = CONT;
|
||||
|
||||
|
@ -3904,9 +3904,9 @@ private:
|
|||
gen_instr_prologue(jh);
|
||||
cc.comment("//behavior:");
|
||||
/*generate behavior*/
|
||||
cc.mov(get_ptr_for(jh, traits::X0+ rd+ 8),
|
||||
cc.mov(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_operation(jh, sub, load_reg_from_mem(jh, traits::X0 + rd+8), load_reg_from_mem(jh, traits::X0 + rs2+8))
|
||||
), 32, true));
|
||||
auto returnValue = CONT;
|
||||
|
||||
|
@ -3945,8 +3945,8 @@ private:
|
|||
gen_instr_prologue(jh);
|
||||
cc.comment("//behavior:");
|
||||
/*generate behavior*/
|
||||
cc.mov(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))
|
||||
cc.mov(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))
|
||||
);
|
||||
auto returnValue = CONT;
|
||||
|
||||
|
@ -3985,8 +3985,8 @@ private:
|
|||
gen_instr_prologue(jh);
|
||||
cc.comment("//behavior:");
|
||||
/*generate behavior*/
|
||||
cc.mov(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))
|
||||
cc.mov(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))
|
||||
);
|
||||
auto returnValue = CONT;
|
||||
|
||||
|
@ -4025,8 +4025,8 @@ private:
|
|||
gen_instr_prologue(jh);
|
||||
cc.comment("//behavior:");
|
||||
/*generate behavior*/
|
||||
cc.mov(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))
|
||||
cc.mov(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))
|
||||
);
|
||||
auto returnValue = CONT;
|
||||
|
||||
|
@ -4105,7 +4105,7 @@ private:
|
|||
cc.comment("//behavior:");
|
||||
/*generate behavior*/
|
||||
auto label_merge = cc.newLabel();
|
||||
cc.cmp(gen_operation(jh, eq, load_reg_from_mem(jh, traits::X0 + rs1+ 8), 0)
|
||||
cc.cmp(gen_operation(jh, eq, load_reg_from_mem(jh, traits::X0 + rs1+8), 0)
|
||||
,0);
|
||||
cc.je(label_merge);
|
||||
{
|
||||
|
@ -4152,7 +4152,7 @@ private:
|
|||
cc.comment("//behavior:");
|
||||
/*generate behavior*/
|
||||
auto label_merge = cc.newLabel();
|
||||
cc.cmp(gen_operation(jh, ne, load_reg_from_mem(jh, traits::X0 + rs1+ 8), 0)
|
||||
cc.cmp(gen_operation(jh, ne, load_reg_from_mem(jh, traits::X0 + rs1+8), 0)
|
||||
,0);
|
||||
cc.je(label_merge);
|
||||
{
|
||||
|
@ -4202,7 +4202,7 @@ private:
|
|||
gen_raise(jh, 0, 2);
|
||||
}
|
||||
else{
|
||||
if(rs1!= 0){
|
||||
if(rs1!=0){
|
||||
cc.mov(get_ptr_for(jh, traits::X0+ rs1),
|
||||
gen_operation(jh, shl, load_reg_from_mem(jh, traits::X0 + rs1), nzuimm)
|
||||
);
|
||||
|
@ -4245,7 +4245,7 @@ private:
|
|||
gen_instr_prologue(jh);
|
||||
cc.comment("//behavior:");
|
||||
/*generate behavior*/
|
||||
if(rd>=static_cast<uint32_t>(traits::RFS)||rd== 0){
|
||||
if(rd>=static_cast<uint32_t>(traits::RFS)||rd==0){
|
||||
gen_raise(jh, 0, 2);
|
||||
}
|
||||
else{
|
||||
|
@ -4298,7 +4298,7 @@ private:
|
|||
gen_raise(jh, 0, 2);
|
||||
}
|
||||
else{
|
||||
if(rd!= 0){
|
||||
if(rd!=0){
|
||||
cc.mov(get_ptr_for(jh, traits::X0+ rd),
|
||||
load_reg_from_mem(jh, traits::X0 + rs2));
|
||||
}
|
||||
|
@ -4340,7 +4340,7 @@ private:
|
|||
cc.comment("//behavior:");
|
||||
/*generate behavior*/
|
||||
if(rs1&&rs1<static_cast<uint32_t>(traits::RFS)){
|
||||
auto PC_val_v = gen_operation(jh, band, load_reg_from_mem(jh, traits::X0 + rs1%static_cast<uint32_t>(traits::RFS)), ~ 0x1)
|
||||
auto PC_val_v = gen_operation(jh, band, load_reg_from_mem(jh, traits::X0 + rs1%static_cast<uint32_t>(traits::RFS)), ~ 1)
|
||||
;
|
||||
cc.mov(jh.next_pc, PC_val_v);
|
||||
cc.mov(get_ptr_for(jh, traits::LAST_BRANCH), 32U);
|
||||
|
@ -4424,7 +4424,7 @@ private:
|
|||
gen_raise(jh, 0, 2);
|
||||
}
|
||||
else{
|
||||
if(rd!= 0){
|
||||
if(rd!=0){
|
||||
cc.mov(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))
|
||||
|
@ -4473,8 +4473,8 @@ private:
|
|||
else{
|
||||
auto new_pc = load_reg_from_mem(jh, traits::X0 + rs1);
|
||||
cc.mov(get_ptr_for(jh, traits::X0+ 1),
|
||||
(uint32_t)(PC+ 2));
|
||||
auto PC_val_v = gen_operation(jh, band, new_pc, ~ 0x1)
|
||||
(uint32_t)(PC+2));
|
||||
auto PC_val_v = gen_operation(jh, band, new_pc, ~ 1)
|
||||
;
|
||||
cc.mov(jh.next_pc, PC_val_v);
|
||||
cc.mov(get_ptr_for(jh, traits::LAST_BRANCH), 32U);
|
||||
|
@ -4607,7 +4607,14 @@ private:
|
|||
* end opcode definitions
|
||||
****************************************************************************/
|
||||
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());
|
||||
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());
|
||||
return BRANCH;
|
||||
}
|
||||
//decoding functionality
|
||||
|
|
Loading…
Reference in New Issue