Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenXiangShan
NEMU
提交
8fb07d1d
N
NEMU
项目概览
OpenXiangShan
/
NEMU
大约 1 年 前同步成功
通知
7
Star
171
Fork
67
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
N
NEMU
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
8fb07d1d
编写于
4月 20, 2020
作者:
Z
Zihao Yu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
engine,rv64,rtl-basic: allocate dest but do not load from SPM
上级
660064cb
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
31 addition
and
29 deletion
+31
-29
src/engine/rv64/rv64-backend/rtl-basic.c
src/engine/rv64/rv64-backend/rtl-basic.c
+11
-29
src/engine/rv64/spill.c
src/engine/rv64/spill.c
+20
-0
未找到文件。
src/engine/rv64/rv64-backend/rtl-basic.c
浏览文件 @
8fb07d1d
...
...
@@ -5,6 +5,8 @@
void
rv64_relop
(
uint32_t
relop
,
uint32_t
idx_dest
,
uint32_t
idx_src1
,
uint32_t
idx_src2
);
uint32_t
rtlreg2rvidx
(
DecodeExecState
*
s
,
const
rtlreg_t
*
dest
);
uint32_t
dest2rvidx
(
DecodeExecState
*
s
,
const
rtlreg_t
*
dest
);
uint32_t
src2rvidx
(
DecodeExecState
*
s
,
const
rtlreg_t
*
src
);
#ifdef REG_SPILLING
uint32_t
rtlreg2varidx
(
DecodeExecState
*
s
,
const
rtlreg_t
*
dest
);
#endif
...
...
@@ -63,15 +65,8 @@ static inline void load_imm_no_opt(uint32_t r, const sword_t imm) {
uint32_t ret = rtlreg2rvidx_pair(s, src1, true, src2, true); \
uint32_t src1_rvidx = ret >> 16; \
uint32_t src2_rvidx = ret & 0xffff; \
uint32_t dest_varidx = rtlreg2varidx(s, dest); \
if (dest_varidx & SPMIDX_MASK) { \
concat(rv64_, rv64_name) (tmp0, src1_rvidx, src2_rvidx); \
rtl_kill(s, src1); \
uint32_t dest_rvidx = rtlreg2rvidx(s, dest); \
rv64_addi(dest_rvidx, tmp0, 0); \
spill_set_dirty_rvidx(dest_rvidx); \
} \
else concat(rv64_, rv64_name) (dest_varidx, src1_rvidx, src2_rvidx); \
uint32_t dest_rvidx = dest2rvidx(s, dest); \
concat(rv64_, rv64_name) (dest_rvidx, src1_rvidx, src2_rvidx); \
}
#else
#define make_rtl_compute_reg(rtl_name, rv64_name) \
...
...
@@ -141,15 +136,8 @@ make_rtl(setrelop, uint32_t relop, rtlreg_t *dest, const rtlreg_t *src1, const r
uint32_t
ret
=
rtlreg2rvidx_pair
(
s
,
src1
,
true
,
src2
,
true
);
uint32_t
src1_rvidx
=
ret
>>
16
;
uint32_t
src2_rvidx
=
ret
&
0xffff
;
uint32_t
dest_varidx
=
rtlreg2varidx
(
s
,
dest
);
if
(
dest_varidx
&
SPMIDX_MASK
)
{
rv64_relop
(
relop
,
tmp0
,
src1_rvidx
,
src2_rvidx
);
rtl_kill
(
s
,
src1
);
uint32_t
dest_rvidx
=
rtlreg2rvidx
(
s
,
dest
);
rv64_addi
(
dest_rvidx
,
tmp0
,
0
);
spill_set_dirty_rvidx
(
dest_rvidx
);
}
else
rv64_relop
(
relop
,
dest_varidx
,
src1_rvidx
,
src2_rvidx
);
uint32_t
dest_rvidx
=
dest2rvidx
(
s
,
dest
);
rv64_relop
(
relop
,
dest_rvidx
,
src1_rvidx
,
src2_rvidx
);
}
#else
make_rtl
(
setrelop
,
uint32_t
relop
,
rtlreg_t
*
dest
,
const
rtlreg_t
*
src1
,
const
rtlreg_t
*
src2
)
{
...
...
@@ -200,12 +188,9 @@ make_rtl(mul_hi, rtlreg_t* dest, const rtlreg_t* src1, const rtlreg_t* src2) {
uint32_t
src2_rvidx
=
ret
&
0xffff
;
rv64_zextw
(
src1_rvidx
,
src1_rvidx
);
rv64_zextw
(
src2_rvidx
,
src2_rvidx
);
rv64_mul
(
tmp0
,
src1_rvidx
,
src2_rvidx
);
rtl_kill
(
s
,
src1
);
uint32_t
dest_rvidx
=
rtlreg2rvidx
(
s
,
dest
);
rv64_addi
(
dest_rvidx
,
tmp0
,
0
);
uint32_t
dest_rvidx
=
dest2rvidx
(
s
,
dest
);
rv64_mul
(
dest_rvidx
,
src1_rvidx
,
src2_rvidx
);
rv64_srai
(
dest_rvidx
,
dest_rvidx
,
32
);
spill_set_dirty_rvidx
(
dest_rvidx
);
}
make_rtl
(
imul_hi
,
rtlreg_t
*
dest
,
const
rtlreg_t
*
src1
,
const
rtlreg_t
*
src2
)
{
...
...
@@ -214,12 +199,9 @@ make_rtl(imul_hi, rtlreg_t* dest, const rtlreg_t* src1, const rtlreg_t* src2) {
uint32_t
src2_rvidx
=
ret
&
0xffff
;
rv64_sextw
(
src1_rvidx
,
src1_rvidx
);
rv64_sextw
(
src2_rvidx
,
src2_rvidx
);
rv64_mul
(
tmp0
,
src1_rvidx
,
src2_rvidx
);
rtl_kill
(
s
,
src1
);
uint32_t
dest_rvidx
=
rtlreg2rvidx
(
s
,
dest
);
rv64_addi
(
dest_rvidx
,
tmp0
,
0
);
uint32_t
dest_rvidx
=
dest2rvidx
(
s
,
dest
);
rv64_mul
(
dest_rvidx
,
src1_rvidx
,
src2_rvidx
);
rv64_srai
(
dest_rvidx
,
dest_rvidx
,
32
);
spill_set_dirty_rvidx
(
dest_rvidx
);
}
#else
make_rtl
(
mul_hi
,
rtlreg_t
*
dest
,
const
rtlreg_t
*
src1
,
const
rtlreg_t
*
src2
)
{
...
...
@@ -419,7 +401,7 @@ make_rtl(j, vaddr_t target) {
}
make_rtl
(
jr
,
rtlreg_t
*
target
)
{
uint32_t
rvidx
=
rtlreg
2rvidx
(
s
,
target
);
uint32_t
rvidx
=
src
2rvidx
(
s
,
target
);
rv64_addi
(
tmp0
,
rvidx
,
0
);
#ifdef REG_SPILLING
spill_writeback_all
();
...
...
src/engine/rv64/spill.c
浏览文件 @
8fb07d1d
...
...
@@ -99,6 +99,26 @@ uint32_t spill_alloc(uint32_t spmidx, int load_val) {
}
uint32_t
rtlreg2varidx
(
DecodeExecState
*
s
,
const
rtlreg_t
*
dest
);
static
uint32_t
rtlreg2rvidx_internal
(
DecodeExecState
*
s
,
const
rtlreg_t
*
r
,
int
is_dest
)
{
uint32_t
varidx
=
rtlreg2varidx
(
s
,
r
);
if
(
varidx
&
SPMIDX_MASK
)
{
uint32_t
tmpidx
=
spmidx2tmpidx
(
varidx
);
if
(
tmpidx
==
-
1
)
tmpidx
=
spill_alloc
(
varidx
,
!
is_dest
);
varidx
=
tmp_regs
[
tmpidx
].
rvidx
;
tmp_regs
[
tmpidx
].
dirty
=
is_dest
;
}
return
varidx
;
}
uint32_t
src2rvidx
(
DecodeExecState
*
s
,
const
rtlreg_t
*
src
)
{
return
rtlreg2rvidx_internal
(
s
,
src
,
false
);
}
uint32_t
dest2rvidx
(
DecodeExecState
*
s
,
const
rtlreg_t
*
dest
)
{
return
rtlreg2rvidx_internal
(
s
,
dest
,
true
);
}
uint32_t
rtlreg2rvidx_pair
(
DecodeExecState
*
s
,
const
rtlreg_t
*
src1
,
int
load_src1
,
const
rtlreg_t
*
src2
,
int
load_src2
)
{
uint32_t
src1_varidx
=
rtlreg2varidx
(
s
,
src1
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录