Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
3fd4b22b
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,发现更多精彩内容 >>
提交
3fd4b22b
编写于
5月 22, 2019
作者:
S
Santiago Pastorino
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Make maybe_codegen_consume_direct iterate instead of doing recursion
上级
50a0defd
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
36 addition
and
34 deletion
+36
-34
src/librustc_codegen_ssa/mir/operand.rs
src/librustc_codegen_ssa/mir/operand.rs
+36
-34
未找到文件。
src/librustc_codegen_ssa/mir/operand.rs
浏览文件 @
3fd4b22b
...
...
@@ -380,28 +380,15 @@ fn maybe_codegen_consume_direct(
)
->
Option
<
OperandRef
<
'tcx
,
Bx
::
Value
>>
{
debug!
(
"maybe_codegen_consume_direct(place={:?})"
,
place
);
// watch out for locals that do not have an
// alloca; they are handled somewhat differently
if
let
mir
::
Place
::
Base
(
mir
::
PlaceBase
::
Local
(
index
))
=
*
place
{
match
self
.locals
[
index
]
{
LocalRef
::
Operand
(
Some
(
o
))
=>
{
return
Some
(
o
);
}
LocalRef
::
Operand
(
None
)
=>
{
bug!
(
"use of {:?} before def"
,
place
);
}
LocalRef
::
Place
(
..
)
|
LocalRef
::
UnsizedPlace
(
..
)
=>
{
// use path below
}
}
}
place
.iterate
(|
place_base
,
place_projection
|
{
if
let
mir
::
PlaceBase
::
Local
(
index
)
=
place_base
{
match
self
.locals
[
*
index
]
{
LocalRef
::
Operand
(
Some
(
mut
o
))
=>
{
// Moves out of scalar and scalar pair fields are trivial.
if
let
&
mir
::
Place
::
Projection
(
ref
proj
)
=
place
{
if
let
Some
(
o
)
=
self
.maybe_codegen_consume_direct
(
bx
,
&
proj
.base
)
{
for
proj
in
place_projection
{
match
proj
.elem
{
mir
::
ProjectionElem
::
Field
(
ref
f
,
_
)
=>
{
return
Some
(
o
.extract_field
(
bx
,
f
.index
()
));
o
=
o
.extract_field
(
bx
,
f
.index
(
));
}
mir
::
ProjectionElem
::
Index
(
_
)
|
mir
::
ProjectionElem
::
ConstantIndex
{
..
}
=>
{
...
...
@@ -410,16 +397,31 @@ fn maybe_codegen_consume_direct(
// checks in `codegen_consume` and `extract_field`.
let
elem
=
o
.layout
.field
(
bx
.cx
(),
0
);
if
elem
.is_zst
()
{
return
Some
(
OperandRef
::
new_zst
(
bx
,
elem
));
}
o
=
OperandRef
::
new_zst
(
bx
,
elem
);
}
else
{
return
None
;
}
_
=>
{}
}
_
=>
return
None
,
}
}
Some
(
o
)
}
LocalRef
::
Operand
(
None
)
=>
{
bug!
(
"use of {:?} before def"
,
place
);
}
LocalRef
::
Place
(
..
)
|
LocalRef
::
UnsizedPlace
(
..
)
=>
{
// watch out for locals that do not have an
// alloca; they are handled somewhat differently
None
}
}
}
else
{
None
}
})
}
pub
fn
codegen_consume
(
&
mut
self
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录