Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
2bda3b7a
R
Rust
项目概览
int
/
Rust
接近 1 年 前同步成功
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
Rust
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
2bda3b7a
编写于
12月 18, 2016
作者:
M
Mark Simulacrum
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Inline and simplify init_cpad
上级
4c7041ea
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
20 addition
and
35 deletion
+20
-35
src/librustc_trans/mir/block.rs
src/librustc_trans/mir/block.rs
+1
-27
src/librustc_trans/mir/mod.rs
src/librustc_trans/mir/mod.rs
+19
-8
未找到文件。
src/librustc_trans/mir/block.rs
浏览文件 @
2bda3b7a
...
...
@@ -863,32 +863,6 @@ fn landing_pad_to(&mut self, target_bb: mir::BasicBlock) -> BasicBlockRef {
bcx
.llbb
()
}
pub
fn
init_cpad
(
&
mut
self
,
bb
:
mir
::
BasicBlock
,
funclets
:
&
mut
IndexVec
<
mir
::
BasicBlock
,
Option
<
Funclet
>>
)
{
let
bcx
=
self
.build_block
(
bb
);
let
data
=
&
self
.mir
[
bb
];
debug!
(
"init_cpad({:?})"
,
data
);
match
self
.cleanup_kinds
[
bb
]
{
CleanupKind
::
NotCleanup
=>
{
funclets
[
bb
]
=
None
;
}
_
if
!
base
::
wants_msvc_seh
(
bcx
.sess
())
=>
{
funclets
[
bb
]
=
Funclet
::
gnu
();
}
CleanupKind
::
Internal
{
funclet
:
_
}
=>
{
// FIXME: is this needed?
bcx
.set_personality_fn
(
self
.fcx
.eh_personality
());
funclets
[
bb
]
=
None
;
}
CleanupKind
::
Funclet
=>
{
bcx
.set_personality_fn
(
self
.fcx
.eh_personality
());
let
cleanup_pad
=
bcx
.cleanup_pad
(
None
,
&
[]);
funclets
[
bb
]
=
Funclet
::
msvc
(
cleanup_pad
);
}
};
}
fn
unreachable_block
(
&
mut
self
)
->
BasicBlockRef
{
self
.unreachable_block
.unwrap_or_else
(||
{
let
bl
=
self
.fcx
.build_new_block
(
"unreachable"
);
...
...
@@ -898,7 +872,7 @@ fn unreachable_block(&mut self) -> BasicBlockRef {
})
}
fn
build_block
(
&
self
,
bb
:
mir
::
BasicBlock
)
->
BlockAndBuilder
<
'a
,
'tcx
>
{
pub
fn
build_block
(
&
self
,
bb
:
mir
::
BasicBlock
)
->
BlockAndBuilder
<
'a
,
'tcx
>
{
BlockAndBuilder
::
new
(
self
.blocks
[
bb
],
self
.fcx
)
}
...
...
src/librustc_trans/mir/mod.rs
浏览文件 @
2bda3b7a
...
...
@@ -36,6 +36,7 @@
pub
use
self
::
constant
::
trans_static_initializer
;
use
self
::
analyze
::
CleanupKind
;
use
self
::
lvalue
::{
LvalueRef
};
use
rustc
::
mir
::
traversal
;
...
...
@@ -315,18 +316,28 @@ pub fn trans_mir<'a, 'tcx: 'a>(
// emitting should be enabled.
debuginfo
::
start_emitting_source_locations
(
&
mircx
);
let
mut
visited
=
BitVector
::
new
(
mir
.basic_blocks
()
.len
());
let
mut
rpo
=
traversal
::
reverse_postorder
(
&
mir
);
let
mut
funclets
:
IndexVec
<
mir
::
BasicBlock
,
Option
<
Funclet
>>
=
IndexVec
::
from_elem
(
None
,
mir
.basic_blocks
());
// Prepare each block for translation.
for
(
bb
,
_
)
in
rpo
.by_ref
()
{
mircx
.init_cpad
(
bb
,
&
mut
funclets
);
// If false, all funclets should be None (which is the default)
if
base
::
wants_msvc_seh
(
fcx
.ccx
.sess
())
{
for
(
bb
,
cleanup_kind
)
in
mircx
.cleanup_kinds
.iter_enumerated
()
{
let
bcx
=
mircx
.build_block
(
bb
);
match
*
cleanup_kind
{
CleanupKind
::
Internal
{
..
}
=>
{
bcx
.set_personality_fn
(
fcx
.eh_personality
());
}
CleanupKind
::
Funclet
=>
{
bcx
.set_personality_fn
(
fcx
.eh_personality
());
funclets
[
bb
]
=
Funclet
::
msvc
(
bcx
.cleanup_pad
(
None
,
&
[]));
}
_
=>
{}
}
}
}
rpo
.reset
();
let
rpo
=
traversal
::
reverse_postorder
(
&
mir
);
let
mut
visited
=
BitVector
::
new
(
mir
.basic_blocks
()
.len
());
// Translate the body of each block using reverse postorder
for
(
bb
,
_
)
in
rpo
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录