adds changes due to generator being more inline with others
This commit is contained in:
parent
c15cdb0955
commit
4a19e27926
|
@ -510,7 +510,7 @@ private:
|
|||
auto new_pc =this->gen_ext(
|
||||
(this->builder.CreateAnd(
|
||||
(this->builder.CreateAdd(
|
||||
this->gen_ext(this->gen_reg_load(rs1+ traits::X0, 0), 64,false),
|
||||
this->gen_ext(this->gen_reg_load(traits::X0+ rs1), 64,false),
|
||||
this->gen_ext(this->gen_const(16,(int16_t)sext<12>(imm)), 64,true))
|
||||
),
|
||||
this->gen_ext(this->gen_const(32,addr_mask), 64,false))
|
||||
|
@ -588,8 +588,8 @@ private:
|
|||
auto bb_merge = BasicBlock::Create(this->mod->getContext(), "bb_merge", this->func, this->leave_blk);
|
||||
auto bb_then = BasicBlock::Create(this->mod->getContext(), "bb_then", this->func, bb_merge);
|
||||
this->builder.CreateCondBr(this->gen_bool(this->builder.CreateICmp(ICmpInst::ICMP_EQ,
|
||||
this->gen_reg_load(rs1+ traits::X0, 0),
|
||||
this->gen_reg_load(rs2+ traits::X0, 0))
|
||||
this->gen_reg_load(traits::X0+ rs1),
|
||||
this->gen_reg_load(traits::X0+ rs2))
|
||||
), bb_then, bb_merge);
|
||||
this->builder.SetInsertPoint(bb_then);
|
||||
{
|
||||
|
@ -651,8 +651,8 @@ private:
|
|||
auto bb_merge = BasicBlock::Create(this->mod->getContext(), "bb_merge", this->func, this->leave_blk);
|
||||
auto bb_then = BasicBlock::Create(this->mod->getContext(), "bb_then", this->func, bb_merge);
|
||||
this->builder.CreateCondBr(this->gen_bool(this->builder.CreateICmp(ICmpInst::ICMP_NE,
|
||||
this->gen_reg_load(rs1+ traits::X0, 0),
|
||||
this->gen_reg_load(rs2+ traits::X0, 0))
|
||||
this->gen_reg_load(traits::X0+ rs1),
|
||||
this->gen_reg_load(traits::X0+ rs2))
|
||||
), bb_then, bb_merge);
|
||||
this->builder.SetInsertPoint(bb_then);
|
||||
{
|
||||
|
@ -715,10 +715,10 @@ private:
|
|||
auto bb_then = BasicBlock::Create(this->mod->getContext(), "bb_then", this->func, bb_merge);
|
||||
this->builder.CreateCondBr(this->gen_bool(this->builder.CreateICmp(ICmpInst::ICMP_SLT,
|
||||
this->gen_ext(
|
||||
this->gen_reg_load(rs1+ traits::X0, 0),
|
||||
this->gen_reg_load(traits::X0+ rs1),
|
||||
32, false),
|
||||
this->gen_ext(
|
||||
this->gen_reg_load(rs2+ traits::X0, 0),
|
||||
this->gen_reg_load(traits::X0+ rs2),
|
||||
32, false))
|
||||
), bb_then, bb_merge);
|
||||
this->builder.SetInsertPoint(bb_then);
|
||||
|
@ -782,10 +782,10 @@ private:
|
|||
auto bb_then = BasicBlock::Create(this->mod->getContext(), "bb_then", this->func, bb_merge);
|
||||
this->builder.CreateCondBr(this->gen_bool(this->builder.CreateICmp(ICmpInst::ICMP_SGE,
|
||||
this->gen_ext(
|
||||
this->gen_reg_load(rs1+ traits::X0, 0),
|
||||
this->gen_reg_load(traits::X0+ rs1),
|
||||
32, false),
|
||||
this->gen_ext(
|
||||
this->gen_reg_load(rs2+ traits::X0, 0),
|
||||
this->gen_reg_load(traits::X0+ rs2),
|
||||
32, false))
|
||||
), bb_then, bb_merge);
|
||||
this->builder.SetInsertPoint(bb_then);
|
||||
|
@ -848,8 +848,8 @@ private:
|
|||
auto bb_merge = BasicBlock::Create(this->mod->getContext(), "bb_merge", this->func, this->leave_blk);
|
||||
auto bb_then = BasicBlock::Create(this->mod->getContext(), "bb_then", this->func, bb_merge);
|
||||
this->builder.CreateCondBr(this->gen_bool(this->builder.CreateICmp(ICmpInst::ICMP_ULT,
|
||||
this->gen_reg_load(rs1+ traits::X0, 0),
|
||||
this->gen_reg_load(rs2+ traits::X0, 0))
|
||||
this->gen_reg_load(traits::X0+ rs1),
|
||||
this->gen_reg_load(traits::X0+ rs2))
|
||||
), bb_then, bb_merge);
|
||||
this->builder.SetInsertPoint(bb_then);
|
||||
{
|
||||
|
@ -911,8 +911,8 @@ private:
|
|||
auto bb_merge = BasicBlock::Create(this->mod->getContext(), "bb_merge", this->func, this->leave_blk);
|
||||
auto bb_then = BasicBlock::Create(this->mod->getContext(), "bb_then", this->func, bb_merge);
|
||||
this->builder.CreateCondBr(this->gen_bool(this->builder.CreateICmp(ICmpInst::ICMP_UGE,
|
||||
this->gen_reg_load(rs1+ traits::X0, 0),
|
||||
this->gen_reg_load(rs2+ traits::X0, 0))
|
||||
this->gen_reg_load(traits::X0+ rs1),
|
||||
this->gen_reg_load(traits::X0+ rs2))
|
||||
), bb_then, bb_merge);
|
||||
this->builder.SetInsertPoint(bb_then);
|
||||
{
|
||||
|
@ -972,7 +972,7 @@ private:
|
|||
else{
|
||||
auto load_address =this->gen_ext(
|
||||
(this->builder.CreateAdd(
|
||||
this->gen_ext(this->gen_reg_load(rs1+ traits::X0, 0), 64,false),
|
||||
this->gen_ext(this->gen_reg_load(traits::X0+ rs1), 64,false),
|
||||
this->gen_ext(this->gen_const(16,(int16_t)sext<12>(imm)), 64,true))
|
||||
),
|
||||
32, true);
|
||||
|
@ -1030,7 +1030,7 @@ private:
|
|||
else{
|
||||
auto load_address =this->gen_ext(
|
||||
(this->builder.CreateAdd(
|
||||
this->gen_ext(this->gen_reg_load(rs1+ traits::X0, 0), 64,false),
|
||||
this->gen_ext(this->gen_reg_load(traits::X0+ rs1), 64,false),
|
||||
this->gen_ext(this->gen_const(16,(int16_t)sext<12>(imm)), 64,true))
|
||||
),
|
||||
32, true);
|
||||
|
@ -1088,7 +1088,7 @@ private:
|
|||
else{
|
||||
auto load_address =this->gen_ext(
|
||||
(this->builder.CreateAdd(
|
||||
this->gen_ext(this->gen_reg_load(rs1+ traits::X0, 0), 64,false),
|
||||
this->gen_ext(this->gen_reg_load(traits::X0+ rs1), 64,false),
|
||||
this->gen_ext(this->gen_const(16,(int16_t)sext<12>(imm)), 64,true))
|
||||
),
|
||||
32, true);
|
||||
|
@ -1146,7 +1146,7 @@ private:
|
|||
else{
|
||||
auto load_address =this->gen_ext(
|
||||
(this->builder.CreateAdd(
|
||||
this->gen_ext(this->gen_reg_load(rs1+ traits::X0, 0), 64,false),
|
||||
this->gen_ext(this->gen_reg_load(traits::X0+ rs1), 64,false),
|
||||
this->gen_ext(this->gen_const(16,(int16_t)sext<12>(imm)), 64,true))
|
||||
),
|
||||
32, true);
|
||||
|
@ -1202,7 +1202,7 @@ private:
|
|||
else{
|
||||
auto load_address =this->gen_ext(
|
||||
(this->builder.CreateAdd(
|
||||
this->gen_ext(this->gen_reg_load(rs1+ traits::X0, 0), 64,false),
|
||||
this->gen_ext(this->gen_reg_load(traits::X0+ rs1), 64,false),
|
||||
this->gen_ext(this->gen_const(16,(int16_t)sext<12>(imm)), 64,true))
|
||||
),
|
||||
32, true);
|
||||
|
@ -1258,14 +1258,14 @@ private:
|
|||
else{
|
||||
auto store_address =this->gen_ext(
|
||||
(this->builder.CreateAdd(
|
||||
this->gen_ext(this->gen_reg_load(rs1+ traits::X0, 0), 64,false),
|
||||
this->gen_ext(this->gen_reg_load(traits::X0+ rs1), 64,false),
|
||||
this->gen_ext(this->gen_const(16,(int16_t)sext<12>(imm)), 64,true))
|
||||
),
|
||||
32, true);
|
||||
this->gen_write_mem(traits::MEM,
|
||||
store_address,
|
||||
this->gen_ext(
|
||||
this->gen_reg_load(rs2+ traits::X0, 0),
|
||||
this->gen_reg_load(traits::X0+ rs2),
|
||||
8, false));
|
||||
}
|
||||
bb = BasicBlock::Create(this->mod->getContext(), "entry", this->func, this->leave_blk);
|
||||
|
@ -1311,14 +1311,14 @@ private:
|
|||
else{
|
||||
auto store_address =this->gen_ext(
|
||||
(this->builder.CreateAdd(
|
||||
this->gen_ext(this->gen_reg_load(rs1+ traits::X0, 0), 64,false),
|
||||
this->gen_ext(this->gen_reg_load(traits::X0+ rs1), 64,false),
|
||||
this->gen_ext(this->gen_const(16,(int16_t)sext<12>(imm)), 64,true))
|
||||
),
|
||||
32, true);
|
||||
this->gen_write_mem(traits::MEM,
|
||||
store_address,
|
||||
this->gen_ext(
|
||||
this->gen_reg_load(rs2+ traits::X0, 0),
|
||||
this->gen_reg_load(traits::X0+ rs2),
|
||||
16, false));
|
||||
}
|
||||
bb = BasicBlock::Create(this->mod->getContext(), "entry", this->func, this->leave_blk);
|
||||
|
@ -1364,14 +1364,14 @@ private:
|
|||
else{
|
||||
auto store_address =this->gen_ext(
|
||||
(this->builder.CreateAdd(
|
||||
this->gen_ext(this->gen_reg_load(rs1+ traits::X0, 0), 64,false),
|
||||
this->gen_ext(this->gen_reg_load(traits::X0+ rs1), 64,false),
|
||||
this->gen_ext(this->gen_const(16,(int16_t)sext<12>(imm)), 64,true))
|
||||
),
|
||||
32, true);
|
||||
this->gen_write_mem(traits::MEM,
|
||||
store_address,
|
||||
this->gen_ext(
|
||||
this->gen_reg_load(rs2+ traits::X0, 0),
|
||||
this->gen_reg_load(traits::X0+ rs2),
|
||||
32, false));
|
||||
}
|
||||
bb = BasicBlock::Create(this->mod->getContext(), "entry", this->func, this->leave_blk);
|
||||
|
@ -1419,7 +1419,7 @@ private:
|
|||
this->builder.CreateStore(
|
||||
this->gen_ext(
|
||||
(this->builder.CreateAdd(
|
||||
this->gen_ext(this->gen_reg_load(rs1+ traits::X0, 0), 64,false),
|
||||
this->gen_ext(this->gen_reg_load(traits::X0+ rs1), 64,false),
|
||||
this->gen_ext(this->gen_const(16,(int16_t)sext<12>(imm)), 64,true))
|
||||
),
|
||||
32, true),
|
||||
|
@ -1471,7 +1471,7 @@ private:
|
|||
this->builder.CreateStore(
|
||||
this->gen_ext(this->gen_choose((this->builder.CreateICmp(ICmpInst::ICMP_SLT,
|
||||
this->gen_ext(
|
||||
this->gen_reg_load(rs1+ traits::X0, 0), 32,true),
|
||||
this->gen_reg_load(traits::X0+ rs1), 32,true),
|
||||
this->gen_ext(this->gen_const(16,(int16_t)sext<12>(imm)), 32,true))
|
||||
),
|
||||
this->gen_const(8,1),
|
||||
|
@ -1524,7 +1524,7 @@ private:
|
|||
if(rd!=0) {
|
||||
this->builder.CreateStore(
|
||||
this->gen_ext(this->gen_choose((this->builder.CreateICmp(ICmpInst::ICMP_ULT,
|
||||
this->gen_reg_load(rs1+ traits::X0, 0),
|
||||
this->gen_reg_load(traits::X0+ rs1),
|
||||
this->gen_const(32,(uint32_t)((int16_t)sext<12>(imm))))
|
||||
),
|
||||
this->gen_const(8,1),
|
||||
|
@ -1577,7 +1577,7 @@ private:
|
|||
if(rd!=0) {
|
||||
this->builder.CreateStore(
|
||||
this->builder.CreateXor(
|
||||
this->gen_reg_load(rs1+ traits::X0, 0),
|
||||
this->gen_reg_load(traits::X0+ rs1),
|
||||
this->gen_const(32,(uint32_t)((int16_t)sext<12>(imm))))
|
||||
,
|
||||
get_reg_ptr(rd + traits::X0), false);
|
||||
|
@ -1627,7 +1627,7 @@ private:
|
|||
if(rd!=0) {
|
||||
this->builder.CreateStore(
|
||||
this->builder.CreateOr(
|
||||
this->gen_reg_load(rs1+ traits::X0, 0),
|
||||
this->gen_reg_load(traits::X0+ rs1),
|
||||
this->gen_const(32,(uint32_t)((int16_t)sext<12>(imm))))
|
||||
,
|
||||
get_reg_ptr(rd + traits::X0), false);
|
||||
|
@ -1677,7 +1677,7 @@ private:
|
|||
if(rd!=0) {
|
||||
this->builder.CreateStore(
|
||||
this->builder.CreateAnd(
|
||||
this->gen_reg_load(rs1+ traits::X0, 0),
|
||||
this->gen_reg_load(traits::X0+ rs1),
|
||||
this->gen_const(32,(uint32_t)((int16_t)sext<12>(imm))))
|
||||
,
|
||||
get_reg_ptr(rd + traits::X0), false);
|
||||
|
@ -1727,7 +1727,7 @@ private:
|
|||
if(rd!=0) {
|
||||
this->builder.CreateStore(
|
||||
this->builder.CreateShl(
|
||||
this->gen_reg_load(rs1+ traits::X0, 0),
|
||||
this->gen_reg_load(traits::X0+ rs1),
|
||||
this->gen_ext(this->gen_const(8,shamt), 32,false))
|
||||
,
|
||||
get_reg_ptr(rd + traits::X0), false);
|
||||
|
@ -1777,7 +1777,7 @@ private:
|
|||
if(rd!=0) {
|
||||
this->builder.CreateStore(
|
||||
this->builder.CreateLShr(
|
||||
this->gen_reg_load(rs1+ traits::X0, 0),
|
||||
this->gen_reg_load(traits::X0+ rs1),
|
||||
this->gen_ext(this->gen_const(8,shamt), 32,false))
|
||||
,
|
||||
get_reg_ptr(rd + traits::X0), false);
|
||||
|
@ -1829,7 +1829,7 @@ private:
|
|||
this->gen_ext(
|
||||
(this->builder.CreateAShr(
|
||||
this->gen_ext(
|
||||
this->gen_reg_load(rs1+ traits::X0, 0), 32,true),
|
||||
this->gen_reg_load(traits::X0+ rs1), 32,true),
|
||||
this->gen_ext(this->gen_const(8,shamt), 32,false))
|
||||
), 32,false),
|
||||
get_reg_ptr(rd + traits::X0), false);
|
||||
|
@ -1880,8 +1880,8 @@ private:
|
|||
this->builder.CreateStore(
|
||||
this->gen_ext(
|
||||
(this->builder.CreateAdd(
|
||||
this->gen_ext(this->gen_reg_load(rs1+ traits::X0, 0), 64,false),
|
||||
this->gen_ext(this->gen_reg_load(rs2+ traits::X0, 0), 64,false))
|
||||
this->gen_ext(this->gen_reg_load(traits::X0+ rs1), 64,false),
|
||||
this->gen_ext(this->gen_reg_load(traits::X0+ rs2), 64,false))
|
||||
),
|
||||
32, false),
|
||||
get_reg_ptr(rd + traits::X0), false);
|
||||
|
@ -1932,8 +1932,8 @@ private:
|
|||
this->builder.CreateStore(
|
||||
this->gen_ext(
|
||||
(this->builder.CreateSub(
|
||||
this->gen_ext(this->gen_reg_load(rs1+ traits::X0, 0), 64,false),
|
||||
this->gen_ext(this->gen_reg_load(rs2+ traits::X0, 0), 64,false))
|
||||
this->gen_ext(this->gen_reg_load(traits::X0+ rs1), 64,false),
|
||||
this->gen_ext(this->gen_reg_load(traits::X0+ rs2), 64,false))
|
||||
),
|
||||
32, true),
|
||||
get_reg_ptr(rd + traits::X0), false);
|
||||
|
@ -1983,9 +1983,9 @@ private:
|
|||
if(rd!=0) {
|
||||
this->builder.CreateStore(
|
||||
this->gen_ext(this->builder.CreateShl(
|
||||
this->gen_ext(this->gen_reg_load(rs1+ traits::X0, 0), 64,false),
|
||||
this->gen_ext(this->gen_reg_load(traits::X0+ rs1), 64,false),
|
||||
(this->builder.CreateAnd(
|
||||
this->gen_ext(this->gen_reg_load(rs2+ traits::X0, 0), 64,false),
|
||||
this->gen_ext(this->gen_reg_load(traits::X0+ rs2), 64,false),
|
||||
this->gen_const(64,(static_cast<uint32_t>(traits::XLEN)-1)))
|
||||
))
|
||||
, 32, false),
|
||||
|
@ -2037,9 +2037,9 @@ private:
|
|||
this->builder.CreateStore(
|
||||
this->gen_ext(this->gen_choose(this->builder.CreateICmp(ICmpInst::ICMP_SLT,
|
||||
this->gen_ext(
|
||||
this->gen_reg_load(rs1+ traits::X0, 0), 32,true),
|
||||
this->gen_reg_load(traits::X0+ rs1), 32,true),
|
||||
this->gen_ext(
|
||||
this->gen_reg_load(rs2+ traits::X0, 0), 32,true))
|
||||
this->gen_reg_load(traits::X0+ rs2), 32,true))
|
||||
,
|
||||
this->gen_const(8,1),
|
||||
this->gen_const(8,0),
|
||||
|
@ -2091,8 +2091,8 @@ private:
|
|||
if(rd!=0) {
|
||||
this->builder.CreateStore(
|
||||
this->gen_ext(this->gen_choose(this->builder.CreateICmp(ICmpInst::ICMP_ULT,
|
||||
this->gen_reg_load(rs1+ traits::X0, 0),
|
||||
this->gen_reg_load(rs2+ traits::X0, 0))
|
||||
this->gen_reg_load(traits::X0+ rs1),
|
||||
this->gen_reg_load(traits::X0+ rs2))
|
||||
,
|
||||
this->gen_const(8,1),
|
||||
this->gen_const(8,0),
|
||||
|
@ -2144,8 +2144,8 @@ private:
|
|||
if(rd!=0) {
|
||||
this->builder.CreateStore(
|
||||
this->builder.CreateXor(
|
||||
this->gen_reg_load(rs1+ traits::X0, 0),
|
||||
this->gen_reg_load(rs2+ traits::X0, 0))
|
||||
this->gen_reg_load(traits::X0+ rs1),
|
||||
this->gen_reg_load(traits::X0+ rs2))
|
||||
,
|
||||
get_reg_ptr(rd + traits::X0), false);
|
||||
}
|
||||
|
@ -2194,9 +2194,9 @@ private:
|
|||
if(rd!=0) {
|
||||
this->builder.CreateStore(
|
||||
this->gen_ext(this->builder.CreateLShr(
|
||||
this->gen_ext(this->gen_reg_load(rs1+ traits::X0, 0), 64,false),
|
||||
this->gen_ext(this->gen_reg_load(traits::X0+ rs1), 64,false),
|
||||
(this->builder.CreateAnd(
|
||||
this->gen_ext(this->gen_reg_load(rs2+ traits::X0, 0), 64,false),
|
||||
this->gen_ext(this->gen_reg_load(traits::X0+ rs2), 64,false),
|
||||
this->gen_const(64,(static_cast<uint32_t>(traits::XLEN)-1)))
|
||||
))
|
||||
, 32, false),
|
||||
|
@ -2249,9 +2249,9 @@ private:
|
|||
this->gen_ext(
|
||||
(this->gen_ext(this->builder.CreateAShr(
|
||||
this->gen_ext(this->gen_ext(
|
||||
this->gen_reg_load(rs1+ traits::X0, 0), 32,true), 64,true),
|
||||
this->gen_reg_load(traits::X0+ rs1), 32,true), 64,true),
|
||||
(this->builder.CreateAnd(
|
||||
this->gen_ext(this->gen_reg_load(rs2+ traits::X0, 0), 64,false),
|
||||
this->gen_ext(this->gen_reg_load(traits::X0+ rs2), 64,false),
|
||||
this->gen_const(64,(static_cast<uint32_t>(traits::XLEN)-1)))
|
||||
))
|
||||
, 32, true)),
|
||||
|
@ -2303,8 +2303,8 @@ private:
|
|||
if(rd!=0) {
|
||||
this->builder.CreateStore(
|
||||
this->builder.CreateOr(
|
||||
this->gen_reg_load(rs1+ traits::X0, 0),
|
||||
this->gen_reg_load(rs2+ traits::X0, 0))
|
||||
this->gen_reg_load(traits::X0+ rs1),
|
||||
this->gen_reg_load(traits::X0+ rs2))
|
||||
,
|
||||
get_reg_ptr(rd + traits::X0), false);
|
||||
}
|
||||
|
@ -2353,8 +2353,8 @@ private:
|
|||
if(rd!=0) {
|
||||
this->builder.CreateStore(
|
||||
this->builder.CreateAnd(
|
||||
this->gen_reg_load(rs1+ traits::X0, 0),
|
||||
this->gen_reg_load(rs2+ traits::X0, 0))
|
||||
this->gen_reg_load(traits::X0+ rs1),
|
||||
this->gen_reg_load(traits::X0+ rs2))
|
||||
,
|
||||
get_reg_ptr(rd + traits::X0), false);
|
||||
}
|
||||
|
@ -2581,7 +2581,7 @@ private:
|
|||
this->gen_raise_trap(0, static_cast<int32_t>(traits::RV_CAUSE_ILLEGAL_INSTRUCTION));
|
||||
}
|
||||
else{
|
||||
auto xrs1 =this->gen_reg_load(rs1+ traits::X0, 0);
|
||||
auto xrs1 =this->gen_reg_load(traits::X0+ rs1);
|
||||
if(rd!=0){ auto xrd =this->gen_read_mem(traits::CSR, csr, 4);
|
||||
this->gen_write_mem(traits::CSR,
|
||||
csr,
|
||||
|
@ -2638,7 +2638,7 @@ private:
|
|||
}
|
||||
else{
|
||||
auto xrd =this->gen_read_mem(traits::CSR, csr, 4);
|
||||
auto xrs1 =this->gen_reg_load(rs1+ traits::X0, 0);
|
||||
auto xrs1 =this->gen_reg_load(traits::X0+ rs1);
|
||||
if(rs1!=0) {
|
||||
this->gen_write_mem(traits::CSR,
|
||||
csr,
|
||||
|
@ -2695,7 +2695,7 @@ private:
|
|||
}
|
||||
else{
|
||||
auto xrd =this->gen_read_mem(traits::CSR, csr, 4);
|
||||
auto xrs1 =this->gen_reg_load(rs1+ traits::X0, 0);
|
||||
auto xrs1 =this->gen_reg_load(traits::X0+ rs1);
|
||||
if(rs1!=0) {
|
||||
this->gen_write_mem(traits::CSR,
|
||||
csr,
|
||||
|
@ -2956,9 +2956,9 @@ private:
|
|||
else{
|
||||
auto res =this->builder.CreateMul(
|
||||
this->gen_ext(this->gen_ext(
|
||||
this->gen_reg_load(rs1+ traits::X0, 0), 32,true), 64,true),
|
||||
this->gen_reg_load(traits::X0+ rs1), 32,true), 64,true),
|
||||
this->gen_ext(this->gen_ext(
|
||||
this->gen_reg_load(rs2+ traits::X0, 0), 32,true), 64,true))
|
||||
this->gen_reg_load(traits::X0+ rs2), 32,true), 64,true))
|
||||
;
|
||||
if(rd!=0) {
|
||||
this->builder.CreateStore(
|
||||
|
@ -3011,9 +3011,9 @@ private:
|
|||
else{
|
||||
auto res =this->builder.CreateMul(
|
||||
this->gen_ext(this->gen_ext(
|
||||
this->gen_reg_load(rs1+ traits::X0, 0), 32,true), 64,true),
|
||||
this->gen_reg_load(traits::X0+ rs1), 32,true), 64,true),
|
||||
this->gen_ext(this->gen_ext(
|
||||
this->gen_reg_load(rs2+ traits::X0, 0), 32,true), 64,true))
|
||||
this->gen_reg_load(traits::X0+ rs2), 32,true), 64,true))
|
||||
;
|
||||
if(rd!=0) {
|
||||
this->builder.CreateStore(
|
||||
|
@ -3069,8 +3069,8 @@ private:
|
|||
else{
|
||||
auto res =this->builder.CreateMul(
|
||||
this->gen_ext(this->gen_ext(
|
||||
this->gen_reg_load(rs1+ traits::X0, 0), 32,true), 64,true),
|
||||
this->gen_ext(this->gen_reg_load(rs2+ traits::X0, 0), 64,false))
|
||||
this->gen_reg_load(traits::X0+ rs1), 32,true), 64,true),
|
||||
this->gen_ext(this->gen_reg_load(traits::X0+ rs2), 64,false))
|
||||
;
|
||||
if(rd!=0) {
|
||||
this->builder.CreateStore(
|
||||
|
@ -3125,8 +3125,8 @@ private:
|
|||
}
|
||||
else{
|
||||
auto res =this->builder.CreateMul(
|
||||
this->gen_ext(this->gen_reg_load(rs1+ traits::X0, 0), 64,false),
|
||||
this->gen_ext(this->gen_reg_load(rs2+ traits::X0, 0), 64,false))
|
||||
this->gen_ext(this->gen_reg_load(traits::X0+ rs1), 64,false),
|
||||
this->gen_ext(this->gen_reg_load(traits::X0+ rs2), 64,false))
|
||||
;
|
||||
if(rd!=0) {
|
||||
this->builder.CreateStore(
|
||||
|
@ -3181,9 +3181,9 @@ private:
|
|||
}
|
||||
else{
|
||||
auto dividend =this->gen_ext(
|
||||
this->gen_reg_load(rs1+ traits::X0, 0), 32,true);
|
||||
this->gen_reg_load(traits::X0+ rs1), 32,true);
|
||||
auto divisor =this->gen_ext(
|
||||
this->gen_reg_load(rs2+ traits::X0, 0), 32,true);
|
||||
this->gen_reg_load(traits::X0+ rs2), 32,true);
|
||||
if(rd!=0){ auto bb_merge = BasicBlock::Create(this->mod->getContext(), "bb_merge", this->func, this->leave_blk);
|
||||
auto bb_then = BasicBlock::Create(this->mod->getContext(), "bb_then", this->func, bb_merge);
|
||||
auto bb_else = BasicBlock::Create(this->mod->getContext(), "bb_else", this->func, bb_merge);
|
||||
|
@ -3199,7 +3199,7 @@ private:
|
|||
auto bb_else = BasicBlock::Create(this->mod->getContext(), "bb_else", this->func, bb_merge);
|
||||
this->builder.CreateCondBr(this->gen_bool(this->builder.CreateAnd(
|
||||
this->builder.CreateICmp(ICmpInst::ICMP_EQ,
|
||||
this->gen_reg_load(rs1+ traits::X0, 0),
|
||||
this->gen_reg_load(traits::X0+ rs1),
|
||||
this->gen_const(32,MMIN))
|
||||
,
|
||||
this->builder.CreateICmp(ICmpInst::ICMP_EQ,
|
||||
|
@ -3284,7 +3284,7 @@ private:
|
|||
auto bb_then = BasicBlock::Create(this->mod->getContext(), "bb_then", this->func, bb_merge);
|
||||
auto bb_else = BasicBlock::Create(this->mod->getContext(), "bb_else", this->func, bb_merge);
|
||||
this->builder.CreateCondBr(this->gen_bool(this->builder.CreateICmp(ICmpInst::ICMP_NE,
|
||||
this->gen_reg_load(rs2+ traits::X0, 0),
|
||||
this->gen_reg_load(traits::X0+ rs2),
|
||||
this->gen_ext(this->gen_const(8,0), 32,false))
|
||||
), bb_then, bb_else);
|
||||
this->builder.SetInsertPoint(bb_then);
|
||||
|
@ -3292,8 +3292,8 @@ private:
|
|||
if(rd!=0) {
|
||||
this->builder.CreateStore(
|
||||
this->builder.CreateUDiv(
|
||||
this->gen_reg_load(rs1+ traits::X0, 0),
|
||||
this->gen_reg_load(rs2+ traits::X0, 0))
|
||||
this->gen_reg_load(traits::X0+ rs1),
|
||||
this->gen_reg_load(traits::X0+ rs2))
|
||||
,
|
||||
get_reg_ptr(rd + traits::X0), false);
|
||||
}
|
||||
|
@ -3355,7 +3355,7 @@ private:
|
|||
auto bb_then = BasicBlock::Create(this->mod->getContext(), "bb_then", this->func, bb_merge);
|
||||
auto bb_else = BasicBlock::Create(this->mod->getContext(), "bb_else", this->func, bb_merge);
|
||||
this->builder.CreateCondBr(this->gen_bool(this->builder.CreateICmp(ICmpInst::ICMP_NE,
|
||||
this->gen_reg_load(rs2+ traits::X0, 0),
|
||||
this->gen_reg_load(traits::X0+ rs2),
|
||||
this->gen_ext(this->gen_const(8,0), 32,false))
|
||||
), bb_then, bb_else);
|
||||
this->builder.SetInsertPoint(bb_then);
|
||||
|
@ -3366,12 +3366,12 @@ private:
|
|||
auto bb_else = BasicBlock::Create(this->mod->getContext(), "bb_else", this->func, bb_merge);
|
||||
this->builder.CreateCondBr(this->gen_bool(this->builder.CreateAnd(
|
||||
this->builder.CreateICmp(ICmpInst::ICMP_EQ,
|
||||
this->gen_reg_load(rs1+ traits::X0, 0),
|
||||
this->gen_reg_load(traits::X0+ rs1),
|
||||
this->gen_const(32,MMIN))
|
||||
,
|
||||
this->builder.CreateICmp(ICmpInst::ICMP_EQ,
|
||||
this->gen_ext(
|
||||
this->gen_reg_load(rs2+ traits::X0, 0),
|
||||
this->gen_reg_load(traits::X0+ rs2),
|
||||
32, false),
|
||||
this->gen_ext(this->gen_const(8,- 1), 32,true))
|
||||
)
|
||||
|
@ -3392,9 +3392,9 @@ private:
|
|||
this->gen_ext(
|
||||
(this->builder.CreateSRem(
|
||||
this->gen_ext(
|
||||
this->gen_reg_load(rs1+ traits::X0, 0), 32,true),
|
||||
this->gen_reg_load(traits::X0+ rs1), 32,true),
|
||||
this->gen_ext(
|
||||
this->gen_reg_load(rs2+ traits::X0, 0), 32,true))
|
||||
this->gen_reg_load(traits::X0+ rs2), 32,true))
|
||||
), 32,false),
|
||||
get_reg_ptr(rd + traits::X0), false);
|
||||
}
|
||||
|
@ -3407,7 +3407,7 @@ private:
|
|||
{
|
||||
if(rd!=0) {
|
||||
this->builder.CreateStore(
|
||||
this->gen_reg_load(rs1+ traits::X0, 0),
|
||||
this->gen_reg_load(traits::X0+ rs1),
|
||||
get_reg_ptr(rd + traits::X0), false);
|
||||
}
|
||||
}
|
||||
|
@ -3459,7 +3459,7 @@ private:
|
|||
auto bb_then = BasicBlock::Create(this->mod->getContext(), "bb_then", this->func, bb_merge);
|
||||
auto bb_else = BasicBlock::Create(this->mod->getContext(), "bb_else", this->func, bb_merge);
|
||||
this->builder.CreateCondBr(this->gen_bool(this->builder.CreateICmp(ICmpInst::ICMP_NE,
|
||||
this->gen_reg_load(rs2+ traits::X0, 0),
|
||||
this->gen_reg_load(traits::X0+ rs2),
|
||||
this->gen_ext(this->gen_const(8,0), 32,false))
|
||||
), bb_then, bb_else);
|
||||
this->builder.SetInsertPoint(bb_then);
|
||||
|
@ -3467,8 +3467,8 @@ private:
|
|||
if(rd!=0) {
|
||||
this->builder.CreateStore(
|
||||
this->builder.CreateURem(
|
||||
this->gen_reg_load(rs1+ traits::X0, 0),
|
||||
this->gen_reg_load(rs2+ traits::X0, 0))
|
||||
this->gen_reg_load(traits::X0+ rs1),
|
||||
this->gen_reg_load(traits::X0+ rs2))
|
||||
,
|
||||
get_reg_ptr(rd + traits::X0), false);
|
||||
}
|
||||
|
@ -3478,7 +3478,7 @@ private:
|
|||
{
|
||||
if(rd!=0) {
|
||||
this->builder.CreateStore(
|
||||
this->gen_reg_load(rs1+ traits::X0, 0),
|
||||
this->gen_reg_load(traits::X0+ rs1),
|
||||
get_reg_ptr(rd + traits::X0), false);
|
||||
}
|
||||
}
|
||||
|
@ -3525,7 +3525,7 @@ private:
|
|||
this->builder.CreateStore(
|
||||
this->gen_ext(
|
||||
(this->builder.CreateAdd(
|
||||
this->gen_ext(this->gen_reg_load(2+ traits::X0, 0), 64,false),
|
||||
this->gen_ext(this->gen_reg_load(traits::X0+ 2), 64,false),
|
||||
this->gen_ext(this->gen_const(16,imm), 64,false))
|
||||
),
|
||||
32, false),
|
||||
|
@ -3573,7 +3573,7 @@ private:
|
|||
/*generate behavior*/
|
||||
auto offs =this->gen_ext(
|
||||
(this->builder.CreateAdd(
|
||||
this->gen_ext(this->gen_reg_load(rs1+8+ traits::X0, 0), 64,false),
|
||||
this->gen_ext(this->gen_reg_load(traits::X0+ rs1+8), 64,false),
|
||||
this->gen_ext(this->gen_const(8,uimm), 64,false))
|
||||
),
|
||||
32, false);
|
||||
|
@ -3623,14 +3623,14 @@ private:
|
|||
/*generate behavior*/
|
||||
auto offs =this->gen_ext(
|
||||
(this->builder.CreateAdd(
|
||||
this->gen_ext(this->gen_reg_load(rs1+8+ traits::X0, 0), 64,false),
|
||||
this->gen_ext(this->gen_reg_load(traits::X0+ rs1+8), 64,false),
|
||||
this->gen_ext(this->gen_const(8,uimm), 64,false))
|
||||
),
|
||||
32, false);
|
||||
this->gen_write_mem(traits::MEM,
|
||||
offs,
|
||||
this->gen_ext(
|
||||
this->gen_reg_load(rs2+8+ traits::X0, 0),
|
||||
this->gen_reg_load(traits::X0+ rs2+8),
|
||||
32, false));
|
||||
bb = BasicBlock::Create(this->mod->getContext(), "entry", this->func, this->leave_blk);
|
||||
auto returnValue = std::make_tuple(CONT,bb);
|
||||
|
@ -3676,7 +3676,7 @@ private:
|
|||
this->builder.CreateStore(
|
||||
this->gen_ext(
|
||||
(this->builder.CreateAdd(
|
||||
this->gen_ext(this->gen_reg_load(rs1+ traits::X0, 0), 64,false),
|
||||
this->gen_ext(this->gen_reg_load(traits::X0+ rs1), 64,false),
|
||||
this->gen_ext(this->gen_const(8,(int8_t)sext<6>(imm)), 64,true))
|
||||
),
|
||||
32, true),
|
||||
|
@ -3888,7 +3888,7 @@ private:
|
|||
this->builder.CreateStore(
|
||||
this->gen_ext(
|
||||
(this->builder.CreateAdd(
|
||||
this->gen_ext(this->gen_reg_load(2+ traits::X0, 0), 64,false),
|
||||
this->gen_ext(this->gen_reg_load(traits::X0+ 2), 64,false),
|
||||
this->gen_ext(this->gen_const(16,(int16_t)sext<10>(nzimm)), 64,true))
|
||||
),
|
||||
32, true),
|
||||
|
@ -3970,7 +3970,7 @@ private:
|
|||
/*generate behavior*/
|
||||
this->builder.CreateStore(
|
||||
this->builder.CreateLShr(
|
||||
this->gen_reg_load(rs1+8+ traits::X0, 0),
|
||||
this->gen_reg_load(traits::X0+ rs1+8),
|
||||
this->gen_ext(this->gen_const(8,shamt), 32,false))
|
||||
,
|
||||
get_reg_ptr(rs1+8 + traits::X0), false);
|
||||
|
@ -4014,7 +4014,7 @@ private:
|
|||
this->gen_ext(
|
||||
(this->builder.CreateAShr(
|
||||
(this->gen_ext(
|
||||
this->gen_reg_load(rs1+8+ traits::X0, 0),
|
||||
this->gen_reg_load(traits::X0+ rs1+8),
|
||||
32, false)),
|
||||
this->gen_ext(this->gen_const(8,shamt), 32,false))
|
||||
),
|
||||
|
@ -4026,7 +4026,7 @@ private:
|
|||
this->gen_ext(
|
||||
(this->builder.CreateAShr(
|
||||
(this->gen_ext(
|
||||
this->gen_reg_load(rs1+8+ traits::X0, 0),
|
||||
this->gen_reg_load(traits::X0+ rs1+8),
|
||||
32, false)),
|
||||
this->gen_ext(this->gen_const(8,64), 32,false))
|
||||
),
|
||||
|
@ -4073,7 +4073,7 @@ private:
|
|||
this->builder.CreateStore(
|
||||
this->gen_ext(
|
||||
(this->builder.CreateAnd(
|
||||
this->gen_reg_load(rs1+8+ traits::X0, 0),
|
||||
this->gen_reg_load(traits::X0+ rs1+8),
|
||||
this->gen_ext(this->gen_const(8,(int8_t)sext<6>(imm)), 32,true))
|
||||
),
|
||||
32, true),
|
||||
|
@ -4117,8 +4117,8 @@ private:
|
|||
this->builder.CreateStore(
|
||||
this->gen_ext(
|
||||
(this->builder.CreateSub(
|
||||
this->gen_ext(this->gen_reg_load(rd+8+ traits::X0, 0), 64,false),
|
||||
this->gen_ext(this->gen_reg_load(rs2+8+ traits::X0, 0), 64,false))
|
||||
this->gen_ext(this->gen_reg_load(traits::X0+ rd+8), 64,false),
|
||||
this->gen_ext(this->gen_reg_load(traits::X0+ rs2+8), 64,false))
|
||||
),
|
||||
32, true),
|
||||
get_reg_ptr(rd+8 + traits::X0), false);
|
||||
|
@ -4160,8 +4160,8 @@ private:
|
|||
/*generate behavior*/
|
||||
this->builder.CreateStore(
|
||||
this->builder.CreateXor(
|
||||
this->gen_reg_load(rd+8+ traits::X0, 0),
|
||||
this->gen_reg_load(rs2+8+ traits::X0, 0))
|
||||
this->gen_reg_load(traits::X0+ rd+8),
|
||||
this->gen_reg_load(traits::X0+ rs2+8))
|
||||
,
|
||||
get_reg_ptr(rd+8 + traits::X0), false);
|
||||
bb = BasicBlock::Create(this->mod->getContext(), "entry", this->func, this->leave_blk);
|
||||
|
@ -4202,8 +4202,8 @@ private:
|
|||
/*generate behavior*/
|
||||
this->builder.CreateStore(
|
||||
this->builder.CreateOr(
|
||||
this->gen_reg_load(rd+8+ traits::X0, 0),
|
||||
this->gen_reg_load(rs2+8+ traits::X0, 0))
|
||||
this->gen_reg_load(traits::X0+ rd+8),
|
||||
this->gen_reg_load(traits::X0+ rs2+8))
|
||||
,
|
||||
get_reg_ptr(rd+8 + traits::X0), false);
|
||||
bb = BasicBlock::Create(this->mod->getContext(), "entry", this->func, this->leave_blk);
|
||||
|
@ -4244,8 +4244,8 @@ private:
|
|||
/*generate behavior*/
|
||||
this->builder.CreateStore(
|
||||
this->builder.CreateAnd(
|
||||
this->gen_reg_load(rd+8+ traits::X0, 0),
|
||||
this->gen_reg_load(rs2+8+ traits::X0, 0))
|
||||
this->gen_reg_load(traits::X0+ rd+8),
|
||||
this->gen_reg_load(traits::X0+ rs2+8))
|
||||
,
|
||||
get_reg_ptr(rd+8 + traits::X0), false);
|
||||
bb = BasicBlock::Create(this->mod->getContext(), "entry", this->func, this->leave_blk);
|
||||
|
@ -4327,7 +4327,7 @@ private:
|
|||
auto bb_merge = BasicBlock::Create(this->mod->getContext(), "bb_merge", this->func, this->leave_blk);
|
||||
auto bb_then = BasicBlock::Create(this->mod->getContext(), "bb_then", this->func, bb_merge);
|
||||
this->builder.CreateCondBr(this->gen_bool(this->builder.CreateICmp(ICmpInst::ICMP_EQ,
|
||||
this->gen_reg_load(rs1+8+ traits::X0, 0),
|
||||
this->gen_reg_load(traits::X0+ rs1+8),
|
||||
this->gen_ext(this->gen_const(8,0), 32,false))
|
||||
), bb_then, bb_merge);
|
||||
this->builder.SetInsertPoint(bb_then);
|
||||
|
@ -4378,7 +4378,7 @@ private:
|
|||
auto bb_merge = BasicBlock::Create(this->mod->getContext(), "bb_merge", this->func, this->leave_blk);
|
||||
auto bb_then = BasicBlock::Create(this->mod->getContext(), "bb_then", this->func, bb_merge);
|
||||
this->builder.CreateCondBr(this->gen_bool(this->builder.CreateICmp(ICmpInst::ICMP_NE,
|
||||
this->gen_reg_load(rs1+8+ traits::X0, 0),
|
||||
this->gen_reg_load(traits::X0+ rs1+8),
|
||||
this->gen_ext(this->gen_const(8,0), 32,false))
|
||||
), bb_then, bb_merge);
|
||||
this->builder.SetInsertPoint(bb_then);
|
||||
|
@ -4432,7 +4432,7 @@ private:
|
|||
if(rs1!=0) {
|
||||
this->builder.CreateStore(
|
||||
this->builder.CreateShl(
|
||||
this->gen_reg_load(rs1+ traits::X0, 0),
|
||||
this->gen_reg_load(traits::X0+ rs1),
|
||||
this->gen_ext(this->gen_const(8,nzuimm), 32,false))
|
||||
,
|
||||
get_reg_ptr(rs1 + traits::X0), false);
|
||||
|
@ -4480,7 +4480,7 @@ private:
|
|||
else{
|
||||
auto offs =this->gen_ext(
|
||||
(this->builder.CreateAdd(
|
||||
this->gen_ext(this->gen_reg_load(2+ traits::X0, 0), 64,false),
|
||||
this->gen_ext(this->gen_reg_load(traits::X0+ 2), 64,false),
|
||||
this->gen_ext(this->gen_const(8,uimm), 64,false))
|
||||
),
|
||||
32, false);
|
||||
|
@ -4534,7 +4534,7 @@ private:
|
|||
else{
|
||||
if(rd!=0) {
|
||||
this->builder.CreateStore(
|
||||
this->gen_reg_load(rs2+ traits::X0, 0),
|
||||
this->gen_reg_load(traits::X0+ rs2),
|
||||
get_reg_ptr(rd + traits::X0), false);
|
||||
}
|
||||
}
|
||||
|
@ -4576,7 +4576,7 @@ private:
|
|||
this->builder.CreateStore(this->gen_const(32U, static_cast<int>(NO_JUMP)), get_reg_ptr(traits::LAST_BRANCH), false);
|
||||
if(rs1&&rs1<static_cast<uint32_t>(traits::RFS)){ auto addr_mask =(uint32_t)- 2;
|
||||
auto PC_val_v = this->builder.CreateAnd(
|
||||
this->gen_reg_load(rs1%static_cast<uint32_t>(traits::RFS)+ traits::X0, 0),
|
||||
this->gen_reg_load(traits::X0+ rs1%static_cast<uint32_t>(traits::RFS)),
|
||||
this->gen_const(32,addr_mask))
|
||||
;
|
||||
this->builder.CreateStore(PC_val_v, get_reg_ptr(traits::NEXT_PC), false);
|
||||
|
@ -4663,8 +4663,8 @@ private:
|
|||
this->builder.CreateStore(
|
||||
this->gen_ext(
|
||||
(this->builder.CreateAdd(
|
||||
this->gen_ext(this->gen_reg_load(rd+ traits::X0, 0), 64,false),
|
||||
this->gen_ext(this->gen_reg_load(rs2+ traits::X0, 0), 64,false))
|
||||
this->gen_ext(this->gen_reg_load(traits::X0+ rd), 64,false),
|
||||
this->gen_ext(this->gen_reg_load(traits::X0+ rs2), 64,false))
|
||||
),
|
||||
32, false),
|
||||
get_reg_ptr(rd + traits::X0), false);
|
||||
|
@ -4711,7 +4711,7 @@ private:
|
|||
}
|
||||
else{
|
||||
auto addr_mask =(uint32_t)- 2;
|
||||
auto new_pc =this->gen_reg_load(rs1+ traits::X0, 0);
|
||||
auto new_pc =this->gen_reg_load(traits::X0+ rs1);
|
||||
this->builder.CreateStore(
|
||||
this->gen_const(32,(uint32_t)(PC+2)),
|
||||
get_reg_ptr(1 + traits::X0), false);
|
||||
|
@ -4798,14 +4798,14 @@ private:
|
|||
else{
|
||||
auto offs =this->gen_ext(
|
||||
(this->builder.CreateAdd(
|
||||
this->gen_ext(this->gen_reg_load(2+ traits::X0, 0), 64,false),
|
||||
this->gen_ext(this->gen_reg_load(traits::X0+ 2), 64,false),
|
||||
this->gen_ext(this->gen_const(8,uimm), 64,false))
|
||||
),
|
||||
32, false);
|
||||
this->gen_write_mem(traits::MEM,
|
||||
offs,
|
||||
this->gen_ext(
|
||||
this->gen_reg_load(rs2+ traits::X0, 0),
|
||||
this->gen_reg_load(traits::X0+ rs2),
|
||||
32, false));
|
||||
}
|
||||
bb = BasicBlock::Create(this->mod->getContext(), "entry", this->func, this->leave_blk);
|
||||
|
|
Loading…
Reference in New Issue