Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
39d93b1e
R
Rust
项目概览
int
/
Rust
12 个月 前同步成功
通知
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,发现更多精彩内容 >>
未验证
提交
39d93b1e
编写于
1月 14, 2020
作者:
S
Santiago Pastorino
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
codegen_place and related functions can take PlaceRef by value
上级
10b19f6d
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
19 addition
and
19 deletion
+19
-19
src/librustc_codegen_ssa/mir/block.rs
src/librustc_codegen_ssa/mir/block.rs
+5
-5
src/librustc_codegen_ssa/mir/operand.rs
src/librustc_codegen_ssa/mir/operand.rs
+3
-3
src/librustc_codegen_ssa/mir/place.rs
src/librustc_codegen_ssa/mir/place.rs
+5
-5
src/librustc_codegen_ssa/mir/rvalue.rs
src/librustc_codegen_ssa/mir/rvalue.rs
+3
-3
src/librustc_codegen_ssa/mir/statement.rs
src/librustc_codegen_ssa/mir/statement.rs
+3
-3
未找到文件。
src/librustc_codegen_ssa/mir/block.rs
浏览文件 @
39d93b1e
...
...
@@ -264,7 +264,7 @@ fn codegen_return_terminator(&mut self, mut bx: Bx) {
}
PassMode
::
Direct
(
_
)
|
PassMode
::
Pair
(
..
)
=>
{
let
op
=
self
.codegen_consume
(
&
mut
bx
,
&
mir
::
Place
::
return_place
()
.as_ref
());
let
op
=
self
.codegen_consume
(
&
mut
bx
,
mir
::
Place
::
return_place
()
.as_ref
());
if
let
Ref
(
llval
,
_
,
align
)
=
op
.val
{
bx
.load
(
llval
,
align
)
}
else
{
...
...
@@ -319,7 +319,7 @@ fn codegen_drop_terminator(
return
;
}
let
place
=
self
.codegen_place
(
&
mut
bx
,
&
location
.as_ref
());
let
place
=
self
.codegen_place
(
&
mut
bx
,
location
.as_ref
());
let
(
args1
,
args2
);
let
mut
args
=
if
let
Some
(
llextra
)
=
place
.llextra
{
args2
=
[
place
.llval
,
llextra
];
...
...
@@ -1111,7 +1111,7 @@ fn make_return_dest(
}
else
{
self
.codegen_place
(
bx
,
&
mir
::
PlaceRef
{
local
:
&
dest
.local
,
projection
:
&
dest
.projection
},
mir
::
PlaceRef
{
local
:
&
dest
.local
,
projection
:
&
dest
.projection
},
)
};
if
fn_ret
.is_indirect
()
{
...
...
@@ -1137,7 +1137,7 @@ fn codegen_transmute(&mut self, bx: &mut Bx, src: &mir::Operand<'tcx>, dst: &mir
LocalRef
::
Place
(
place
)
=>
self
.codegen_transmute_into
(
bx
,
src
,
place
),
LocalRef
::
UnsizedPlace
(
_
)
=>
bug!
(
"transmute must not involve unsized locals"
),
LocalRef
::
Operand
(
None
)
=>
{
let
dst_layout
=
bx
.layout_of
(
self
.monomorphized_place_ty
(
&
dst
.as_ref
()));
let
dst_layout
=
bx
.layout_of
(
self
.monomorphized_place_ty
(
dst
.as_ref
()));
assert
!
(
!
dst_layout
.ty
.has_erasable_regions
());
let
place
=
PlaceRef
::
alloca
(
bx
,
dst_layout
);
place
.storage_live
(
bx
);
...
...
@@ -1151,7 +1151,7 @@ fn codegen_transmute(&mut self, bx: &mut Bx, src: &mir::Operand<'tcx>, dst: &mir
}
}
}
else
{
let
dst
=
self
.codegen_place
(
bx
,
&
dst
.as_ref
());
let
dst
=
self
.codegen_place
(
bx
,
dst
.as_ref
());
self
.codegen_transmute_into
(
bx
,
src
,
dst
);
}
}
...
...
src/librustc_codegen_ssa/mir/operand.rs
浏览文件 @
39d93b1e
...
...
@@ -369,7 +369,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
fn
maybe_codegen_consume_direct
(
&
mut
self
,
bx
:
&
mut
Bx
,
place_ref
:
&
mir
::
PlaceRef
<
'_
,
'tcx
>
,
place_ref
:
mir
::
PlaceRef
<
'_
,
'tcx
>
,
)
->
Option
<
OperandRef
<
'tcx
,
Bx
::
Value
>>
{
debug!
(
"maybe_codegen_consume_direct(place_ref={:?})"
,
place_ref
);
...
...
@@ -413,7 +413,7 @@ fn maybe_codegen_consume_direct(
pub
fn
codegen_consume
(
&
mut
self
,
bx
:
&
mut
Bx
,
place_ref
:
&
mir
::
PlaceRef
<
'_
,
'tcx
>
,
place_ref
:
mir
::
PlaceRef
<
'_
,
'tcx
>
,
)
->
OperandRef
<
'tcx
,
Bx
::
Value
>
{
debug!
(
"codegen_consume(place_ref={:?})"
,
place_ref
);
...
...
@@ -444,7 +444,7 @@ pub fn codegen_operand(
match
*
operand
{
mir
::
Operand
::
Copy
(
ref
place
)
|
mir
::
Operand
::
Move
(
ref
place
)
=>
{
self
.codegen_consume
(
bx
,
&
place
.as_ref
())
self
.codegen_consume
(
bx
,
place
.as_ref
())
}
mir
::
Operand
::
Constant
(
ref
constant
)
=>
{
...
...
src/librustc_codegen_ssa/mir/place.rs
浏览文件 @
39d93b1e
...
...
@@ -408,14 +408,14 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
pub
fn
codegen_place
(
&
mut
self
,
bx
:
&
mut
Bx
,
place_ref
:
&
mir
::
PlaceRef
<
'_
,
'tcx
>
,
place_ref
:
mir
::
PlaceRef
<
'_
,
'tcx
>
,
)
->
PlaceRef
<
'tcx
,
Bx
::
Value
>
{
debug!
(
"codegen_place(place_ref={:?})"
,
place_ref
);
let
cx
=
self
.cx
;
let
tcx
=
self
.cx
.tcx
();
let
result
=
match
place_ref
{
mir
::
PlaceRef
{
local
,
projection
:
[]
}
=>
match
self
.locals
[
*
*
local
]
{
mir
::
PlaceRef
{
local
,
projection
:
[]
}
=>
match
self
.locals
[
*
local
]
{
LocalRef
::
Place
(
place
)
=>
{
return
place
;
}
...
...
@@ -428,13 +428,13 @@ pub fn codegen_place(
},
mir
::
PlaceRef
{
local
,
projection
:
[
proj_base
@
..
,
mir
::
ProjectionElem
::
Deref
]
}
=>
{
// Load the pointer from its location.
self
.codegen_consume
(
bx
,
&
mir
::
PlaceRef
{
local
,
projection
:
proj_base
})
self
.codegen_consume
(
bx
,
mir
::
PlaceRef
{
local
,
projection
:
proj_base
})
.deref
(
bx
.cx
())
}
mir
::
PlaceRef
{
local
,
projection
:
[
proj_base
@
..
,
elem
]
}
=>
{
// FIXME turn this recursion into iteration
let
cg_base
=
self
.codegen_place
(
bx
,
&
mir
::
PlaceRef
{
local
,
projection
:
proj_base
});
self
.codegen_place
(
bx
,
mir
::
PlaceRef
{
local
,
projection
:
proj_base
});
match
elem
{
mir
::
ProjectionElem
::
Deref
=>
bug!
(),
...
...
@@ -497,7 +497,7 @@ pub fn codegen_place(
result
}
pub
fn
monomorphized_place_ty
(
&
self
,
place_ref
:
&
mir
::
PlaceRef
<
'_
,
'tcx
>
)
->
Ty
<
'tcx
>
{
pub
fn
monomorphized_place_ty
(
&
self
,
place_ref
:
mir
::
PlaceRef
<
'_
,
'tcx
>
)
->
Ty
<
'tcx
>
{
let
tcx
=
self
.cx
.tcx
();
let
place_ty
=
mir
::
Place
::
ty_from
(
place_ref
.local
,
place_ref
.projection
,
*
self
.mir
,
tcx
);
self
.monomorphize
(
&
place_ty
.ty
)
...
...
src/librustc_codegen_ssa/mir/rvalue.rs
浏览文件 @
39d93b1e
...
...
@@ -467,7 +467,7 @@ pub fn codegen_rvalue_operand(
mir
::
Rvalue
::
Discriminant
(
ref
place
)
=>
{
let
discr_ty
=
rvalue
.ty
(
*
self
.mir
,
bx
.tcx
());
let
discr
=
self
.codegen_place
(
&
mut
bx
,
&
place
.as_ref
())
.codegen_place
(
&
mut
bx
,
place
.as_ref
())
.codegen_get_discr
(
&
mut
bx
,
discr_ty
);
(
bx
,
...
...
@@ -541,7 +541,7 @@ fn evaluate_array_len(&mut self, bx: &mut Bx, place: &mir::Place<'tcx>) -> Bx::V
}
}
// use common size calculation for non zero-sized types
let
cg_value
=
self
.codegen_place
(
bx
,
&
place
.as_ref
());
let
cg_value
=
self
.codegen_place
(
bx
,
place
.as_ref
());
cg_value
.len
(
bx
.cx
())
}
...
...
@@ -552,7 +552,7 @@ fn codegen_place_to_pointer(
place
:
&
mir
::
Place
<
'tcx
>
,
mk_ptr_ty
:
impl
FnOnce
(
TyCtxt
<
'tcx
>
,
Ty
<
'tcx
>
)
->
Ty
<
'tcx
>
,
)
->
(
Bx
,
OperandRef
<
'tcx
,
Bx
::
Value
>
)
{
let
cg_place
=
self
.codegen_place
(
&
mut
bx
,
&
place
.as_ref
());
let
cg_place
=
self
.codegen_place
(
&
mut
bx
,
place
.as_ref
());
let
ty
=
cg_place
.layout.ty
;
...
...
src/librustc_codegen_ssa/mir/statement.rs
浏览文件 @
39d93b1e
...
...
@@ -41,12 +41,12 @@ pub fn codegen_statement(&mut self, mut bx: Bx, statement: &mir::Statement<'tcx>
}
}
}
else
{
let
cg_dest
=
self
.codegen_place
(
&
mut
bx
,
&
place
.as_ref
());
let
cg_dest
=
self
.codegen_place
(
&
mut
bx
,
place
.as_ref
());
self
.codegen_rvalue
(
bx
,
cg_dest
,
rvalue
)
}
}
mir
::
StatementKind
::
SetDiscriminant
{
box
ref
place
,
variant_index
}
=>
{
self
.codegen_place
(
&
mut
bx
,
&
place
.as_ref
())
self
.codegen_place
(
&
mut
bx
,
place
.as_ref
())
.codegen_set_discr
(
&
mut
bx
,
variant_index
);
bx
}
...
...
@@ -70,7 +70,7 @@ pub fn codegen_statement(&mut self, mut bx: Bx, statement: &mir::Statement<'tcx>
let
outputs
=
asm
.outputs
.iter
()
.map
(|
output
|
self
.codegen_place
(
&
mut
bx
,
&
output
.as_ref
()))
.map
(|
output
|
self
.codegen_place
(
&
mut
bx
,
output
.as_ref
()))
.collect
();
let
input_vals
=
asm
.inputs
.iter
()
.fold
(
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录