Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
a8a722f2
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,发现更多精彩内容 >>
提交
a8a722f2
编写于
7月 22, 2023
作者:
B
bjorn3
浏览文件
操作
浏览文件
下载
差异文件
Sync from rust
0308df23
上级
84afcee7
648f5e42
变更
16
隐藏空白更改
内联
并排
Showing
16 changed file
with
70 addition
and
65 deletion
+70
-65
example/float-minmax-pass.rs
example/float-minmax-pass.rs
+1
-1
src/abi/comments.rs
src/abi/comments.rs
+1
-8
src/abi/mod.rs
src/abi/mod.rs
+6
-6
src/base.rs
src/base.rs
+5
-5
src/constant.rs
src/constant.rs
+1
-1
src/driver/mod.rs
src/driver/mod.rs
+5
-5
src/global_asm.rs
src/global_asm.rs
+1
-1
src/inline_asm.rs
src/inline_asm.rs
+2
-2
src/intrinsics/llvm.rs
src/intrinsics/llvm.rs
+16
-4
src/intrinsics/llvm_aarch64.rs
src/intrinsics/llvm_aarch64.rs
+2
-2
src/intrinsics/llvm_x86.rs
src/intrinsics/llvm_x86.rs
+2
-2
src/intrinsics/mod.rs
src/intrinsics/mod.rs
+14
-14
src/intrinsics/simd.rs
src/intrinsics/simd.rs
+2
-2
src/main_shim.rs
src/main_shim.rs
+3
-3
src/pretty_clif.rs
src/pretty_clif.rs
+3
-3
src/value_and_place.rs
src/value_and_place.rs
+6
-6
未找到文件。
example/float-minmax-pass.rs
浏览文件 @
a8a722f2
...
...
@@ -22,7 +22,7 @@ fn main() {
#[cfg(not(any(target_arch
=
"mips"
,
target_arch
=
"mips64"
)))]
let
nan
=
f32
::
NAN
;
// MIPS hardware treats f32::NAN as SNAN. Clear the signaling bit.
// MIPS hardware
except MIPS R6
treats f32::NAN as SNAN. Clear the signaling bit.
// See https://github.com/rust-lang/rust/issues/52746.
#[cfg(any(target_arch
=
"mips"
,
target_arch
=
"mips64"
))]
let
nan
=
f32
::
from_bits
(
f32
::
NAN
.to_bits
()
-
1
);
...
...
src/abi/comments.rs
浏览文件 @
a8a722f2
...
...
@@ -80,14 +80,7 @@ pub(super) fn add_local_place_comments<'tcx>(
return
;
}
let
TyAndLayout
{
ty
,
layout
}
=
place
.layout
();
let
rustc_target
::
abi
::
LayoutS
{
size
,
align
,
abi
:
_
,
variants
:
_
,
fields
:
_
,
largest_niche
:
_
,
}
=
layout
.0.0
;
let
rustc_target
::
abi
::
LayoutS
{
size
,
align
,
..
}
=
layout
.0.0
;
let
(
kind
,
extra
)
=
place
.debug_comment
();
...
...
src/abi/mod.rs
浏览文件 @
a8a722f2
...
...
@@ -70,7 +70,7 @@ pub(crate) fn get_function_sig<'tcx>(
default_call_conv
:
CallConv
,
inst
:
Instance
<
'tcx
>
,
)
->
Signature
{
assert
!
(
!
inst
.
subst
s
.has_infer
());
assert
!
(
!
inst
.
arg
s
.has_infer
());
clif_sig_from_fn_abi
(
tcx
,
default_call_conv
,
...
...
@@ -377,16 +377,16 @@ pub(crate) fn codegen_terminator_call<'tcx>(
let
ret_place
=
codegen_place
(
fx
,
destination
);
// Handle special calls like intrinsics and empty drop glue.
let
instance
=
if
let
ty
::
FnDef
(
def_id
,
subst
s
)
=
*
func
.layout
()
.ty
.kind
()
{
let
instance
=
if
let
ty
::
FnDef
(
def_id
,
fn_arg
s
)
=
*
func
.layout
()
.ty
.kind
()
{
let
instance
=
ty
::
Instance
::
expect_resolve
(
fx
.tcx
,
ty
::
ParamEnv
::
reveal_all
(),
def_id
,
subst
s
)
ty
::
Instance
::
expect_resolve
(
fx
.tcx
,
ty
::
ParamEnv
::
reveal_all
(),
def_id
,
fn_arg
s
)
.polymorphize
(
fx
.tcx
);
if
fx
.tcx
.symbol_name
(
instance
)
.name
.starts_with
(
"llvm."
)
{
crate
::
intrinsics
::
codegen_llvm_intrinsic_call
(
fx
,
&
fx
.tcx
.symbol_name
(
instance
)
.name
,
subst
s
,
fn_arg
s
,
args
,
ret_place
,
target
,
...
...
@@ -616,7 +616,7 @@ pub(crate) fn codegen_drop<'tcx>(
// `Instance::resolve_drop_in_place`?
let
virtual_drop
=
Instance
{
def
:
ty
::
InstanceDef
::
Virtual
(
drop_instance
.def_id
(),
0
),
substs
:
drop_instance
.subst
s
,
args
:
drop_instance
.arg
s
,
};
let
fn_abi
=
RevealAllLayoutCx
(
fx
.tcx
)
.fn_abi_of_instance
(
virtual_drop
,
ty
::
List
::
empty
());
...
...
@@ -653,7 +653,7 @@ pub(crate) fn codegen_drop<'tcx>(
let
virtual_drop
=
Instance
{
def
:
ty
::
InstanceDef
::
Virtual
(
drop_instance
.def_id
(),
0
),
substs
:
drop_instance
.subst
s
,
args
:
drop_instance
.arg
s
,
};
let
fn_abi
=
RevealAllLayoutCx
(
fx
.tcx
)
.fn_abi_of_instance
(
virtual_drop
,
ty
::
List
::
empty
());
...
...
src/base.rs
浏览文件 @
a8a722f2
...
...
@@ -30,7 +30,7 @@ pub(crate) fn codegen_fn<'tcx>(
module
:
&
mut
dyn
Module
,
instance
:
Instance
<
'tcx
>
,
)
->
CodegenedFunction
{
debug_assert!
(
!
instance
.
subst
s
.has_infer
());
debug_assert!
(
!
instance
.
arg
s
.has_infer
());
let
symbol_name
=
tcx
.symbol_name
(
instance
)
.name
.to_string
();
let
_
timer
=
tcx
.prof
.generic_activity_with_arg
(
"codegen fn"
,
&*
symbol_name
);
...
...
@@ -594,13 +594,13 @@ fn codegen_stmt<'tcx>(
let
from_ty
=
fx
.monomorphize
(
operand
.ty
(
&
fx
.mir.local_decls
,
fx
.tcx
));
let
to_layout
=
fx
.layout_of
(
fx
.monomorphize
(
to_ty
));
match
*
from_ty
.kind
()
{
ty
::
FnDef
(
def_id
,
subst
s
)
=>
{
ty
::
FnDef
(
def_id
,
arg
s
)
=>
{
let
func_ref
=
fx
.get_function_ref
(
Instance
::
resolve_for_fn_ptr
(
fx
.tcx
,
ParamEnv
::
reveal_all
(),
def_id
,
subst
s
,
arg
s
,
)
.unwrap
()
.polymorphize
(
fx
.tcx
),
...
...
@@ -684,11 +684,11 @@ fn is_fat_ptr<'tcx>(fx: &FunctionCx<'_, '_, 'tcx>, ty: Ty<'tcx>) -> bool {
)
=>
{
let
operand
=
codegen_operand
(
fx
,
operand
);
match
*
operand
.layout
()
.ty
.kind
()
{
ty
::
Closure
(
def_id
,
subst
s
)
=>
{
ty
::
Closure
(
def_id
,
arg
s
)
=>
{
let
instance
=
Instance
::
resolve_closure
(
fx
.tcx
,
def_id
,
subst
s
,
arg
s
,
ty
::
ClosureKind
::
FnOnce
,
)
.expect
(
"failed to normalize and resolve closure during codegen"
)
...
...
src/constant.rs
浏览文件 @
a8a722f2
...
...
@@ -57,7 +57,7 @@ pub(crate) fn codegen_tls_ref<'tcx>(
let
tls_ptr
=
if
!
def_id
.is_local
()
&&
fx
.tcx
.needs_thread_local_shim
(
def_id
)
{
let
instance
=
ty
::
Instance
{
def
:
ty
::
InstanceDef
::
ThreadLocalShim
(
def_id
),
substs
:
ty
::
InternalSubst
s
::
empty
(),
args
:
ty
::
GenericArg
s
::
empty
(),
};
let
func_ref
=
fx
.get_function_ref
(
instance
);
let
call
=
fx
.bcx
.ins
()
.call
(
func_ref
,
&
[]);
...
...
src/driver/mod.rs
浏览文件 @
a8a722f2
...
...
@@ -5,7 +5,7 @@
//! [`codegen_static`]: crate::constant::codegen_static
use
rustc_data_structures
::
profiling
::
SelfProfilerRef
;
use
rustc_middle
::
mir
::
mono
::{
Linkage
as
RLinkage
,
MonoItem
,
Visibility
};
use
rustc_middle
::
mir
::
mono
::{
MonoItem
,
MonoItemData
};
use
crate
::
prelude
::
*
;
...
...
@@ -16,11 +16,11 @@
fn
predefine_mono_items
<
'tcx
>
(
tcx
:
TyCtxt
<
'tcx
>
,
module
:
&
mut
dyn
Module
,
mono_items
:
&
[(
MonoItem
<
'tcx
>
,
(
RLinkage
,
Visibility
)
)],
mono_items
:
&
[(
MonoItem
<
'tcx
>
,
MonoItemData
)],
)
{
tcx
.prof
.generic_activity
(
"predefine functions"
)
.run
(||
{
let
is_compiler_builtins
=
tcx
.is_compiler_builtins
(
LOCAL_CRATE
);
for
&
(
mono_item
,
(
linkage
,
visibility
)
)
in
mono_items
{
for
&
(
mono_item
,
data
)
in
mono_items
{
match
mono_item
{
MonoItem
::
Fn
(
instance
)
=>
{
let
name
=
tcx
.symbol_name
(
instance
)
.name
;
...
...
@@ -29,8 +29,8 @@ fn predefine_mono_items<'tcx>(
get_function_sig
(
tcx
,
module
.target_config
()
.default_call_conv
,
instance
);
let
linkage
=
crate
::
linkage
::
get_clif_linkage
(
mono_item
,
linkage
,
visibility
,
data
.
linkage
,
data
.
visibility
,
is_compiler_builtins
,
);
module
.declare_function
(
name
,
linkage
,
&
sig
)
.unwrap
();
...
...
src/global_asm.rs
浏览文件 @
a8a722f2
...
...
@@ -42,7 +42,7 @@ pub(crate) fn codegen_global_asm_item(tcx: TyCtxt<'_>, global_asm: &mut String,
InlineAsmOperand
::
SymFn
{
anon_const
}
=>
{
let
ty
=
tcx
.typeck_body
(
anon_const
.body
)
.node_type
(
anon_const
.hir_id
);
let
instance
=
match
ty
.kind
()
{
&
ty
::
FnDef
(
def_id
,
substs
)
=>
Instance
::
new
(
def_id
,
subst
s
),
&
ty
::
FnDef
(
def_id
,
args
)
=>
Instance
::
new
(
def_id
,
arg
s
),
_
=>
span_bug!
(
op_sp
,
"asm sym is not a function"
),
};
let
symbol
=
tcx
.symbol_name
(
instance
);
...
...
src/inline_asm.rs
浏览文件 @
a8a722f2
...
...
@@ -254,12 +254,12 @@ pub(crate) fn codegen_inline_asm<'tcx>(
}
InlineAsmOperand
::
SymFn
{
ref
value
}
=>
{
let
literal
=
fx
.monomorphize
(
value
.literal
);
if
let
ty
::
FnDef
(
def_id
,
subst
s
)
=
*
literal
.ty
()
.kind
()
{
if
let
ty
::
FnDef
(
def_id
,
arg
s
)
=
*
literal
.ty
()
.kind
()
{
let
instance
=
ty
::
Instance
::
resolve_for_fn_ptr
(
fx
.tcx
,
ty
::
ParamEnv
::
reveal_all
(),
def_id
,
subst
s
,
arg
s
,
)
.unwrap
();
let
symbol
=
fx
.tcx
.symbol_name
(
instance
);
...
...
src/intrinsics/llvm.rs
浏览文件 @
a8a722f2
...
...
@@ -3,23 +3,35 @@
use
crate
::
intrinsics
::
*
;
use
crate
::
prelude
::
*
;
use
rustc_middle
::
ty
::
subst
::
Subst
sRef
;
use
rustc_middle
::
ty
::
GenericArg
sRef
;
pub
(
crate
)
fn
codegen_llvm_intrinsic_call
<
'tcx
>
(
fx
:
&
mut
FunctionCx
<
'_
,
'_
,
'tcx
>
,
intrinsic
:
&
str
,
substs
:
Subst
sRef
<
'tcx
>
,
generic_args
:
GenericArg
sRef
<
'tcx
>
,
args
:
&
[
mir
::
Operand
<
'tcx
>
],
ret
:
CPlace
<
'tcx
>
,
target
:
Option
<
BasicBlock
>
,
)
{
if
intrinsic
.starts_with
(
"llvm.aarch64"
)
{
return
llvm_aarch64
::
codegen_aarch64_llvm_intrinsic_call
(
fx
,
intrinsic
,
substs
,
args
,
ret
,
target
,
fx
,
intrinsic
,
generic_args
,
args
,
ret
,
target
,
);
}
if
intrinsic
.starts_with
(
"llvm.x86"
)
{
return
llvm_x86
::
codegen_x86_llvm_intrinsic_call
(
fx
,
intrinsic
,
substs
,
args
,
ret
,
target
);
return
llvm_x86
::
codegen_x86_llvm_intrinsic_call
(
fx
,
intrinsic
,
generic_args
,
args
,
ret
,
target
,
);
}
match
intrinsic
{
...
...
src/intrinsics/llvm_aarch64.rs
浏览文件 @
a8a722f2
...
...
@@ -3,12 +3,12 @@
use
crate
::
intrinsics
::
*
;
use
crate
::
prelude
::
*
;
use
rustc_middle
::
ty
::
subst
::
Subst
sRef
;
use
rustc_middle
::
ty
::
GenericArg
sRef
;
pub
(
crate
)
fn
codegen_aarch64_llvm_intrinsic_call
<
'tcx
>
(
fx
:
&
mut
FunctionCx
<
'_
,
'_
,
'tcx
>
,
intrinsic
:
&
str
,
_
substs
:
Subst
sRef
<
'tcx
>
,
_
args
:
GenericArg
sRef
<
'tcx
>
,
args
:
&
[
mir
::
Operand
<
'tcx
>
],
ret
:
CPlace
<
'tcx
>
,
target
:
Option
<
BasicBlock
>
,
...
...
src/intrinsics/llvm_x86.rs
浏览文件 @
a8a722f2
...
...
@@ -3,12 +3,12 @@
use
crate
::
intrinsics
::
*
;
use
crate
::
prelude
::
*
;
use
rustc_middle
::
ty
::
subst
::
Subst
sRef
;
use
rustc_middle
::
ty
::
GenericArg
sRef
;
pub
(
crate
)
fn
codegen_x86_llvm_intrinsic_call
<
'tcx
>
(
fx
:
&
mut
FunctionCx
<
'_
,
'_
,
'tcx
>
,
intrinsic
:
&
str
,
_
substs
:
Subst
sRef
<
'tcx
>
,
_
args
:
GenericArg
sRef
<
'tcx
>
,
args
:
&
[
mir
::
Operand
<
'tcx
>
],
ret
:
CPlace
<
'tcx
>
,
target
:
Option
<
BasicBlock
>
,
...
...
src/intrinsics/mod.rs
浏览文件 @
a8a722f2
...
...
@@ -24,7 +24,7 @@
use
rustc_middle
::
ty
;
use
rustc_middle
::
ty
::
layout
::{
HasParamEnv
,
ValidityRequirement
};
use
rustc_middle
::
ty
::
print
::{
with_no_trimmed_paths
,
with_no_visible_paths
};
use
rustc_middle
::
ty
::
subst
::
Subst
sRef
;
use
rustc_middle
::
ty
::
GenericArg
sRef
;
use
rustc_span
::
symbol
::{
kw
,
sym
,
Symbol
};
use
crate
::
prelude
::
*
;
...
...
@@ -213,13 +213,13 @@ pub(crate) fn codegen_intrinsic_call<'tcx>(
source_info
:
mir
::
SourceInfo
,
)
{
let
intrinsic
=
fx
.tcx
.item_name
(
instance
.def_id
());
let
substs
=
instance
.subst
s
;
let
instance_args
=
instance
.arg
s
;
if
intrinsic
.as_str
()
.starts_with
(
"simd_"
)
{
self
::
simd
::
codegen_simd_intrinsic_call
(
fx
,
intrinsic
,
subst
s
,
instance_arg
s
,
args
,
destination
,
target
.expect
(
"target for simd intrinsic"
),
...
...
@@ -233,7 +233,7 @@ pub(crate) fn codegen_intrinsic_call<'tcx>(
fx
,
instance
,
intrinsic
,
subst
s
,
instance_arg
s
,
args
,
destination
,
target
,
...
...
@@ -365,7 +365,7 @@ fn codegen_regular_intrinsic_call<'tcx>(
fx
:
&
mut
FunctionCx
<
'_
,
'_
,
'tcx
>
,
instance
:
Instance
<
'tcx
>
,
intrinsic
:
Symbol
,
substs
:
Subst
sRef
<
'tcx
>
,
generic_args
:
GenericArg
sRef
<
'tcx
>
,
args
:
&
[
mir
::
Operand
<
'tcx
>
],
ret
:
CPlace
<
'tcx
>
,
destination
:
Option
<
BasicBlock
>
,
...
...
@@ -394,7 +394,7 @@ fn codegen_regular_intrinsic_call<'tcx>(
let
dst
=
dst
.load_scalar
(
fx
);
let
count
=
count
.load_scalar
(
fx
);
let
elem_ty
=
subst
s
.type_at
(
0
);
let
elem_ty
=
generic_arg
s
.type_at
(
0
);
let
elem_size
:
u64
=
fx
.layout_of
(
elem_ty
)
.size
.bytes
();
assert_eq!
(
args
.len
(),
3
);
let
byte_amount
=
...
...
@@ -410,7 +410,7 @@ fn codegen_regular_intrinsic_call<'tcx>(
let
src
=
src
.load_scalar
(
fx
);
let
count
=
count
.load_scalar
(
fx
);
let
elem_ty
=
subst
s
.type_at
(
0
);
let
elem_ty
=
generic_arg
s
.type_at
(
0
);
let
elem_size
:
u64
=
fx
.layout_of
(
elem_ty
)
.size
.bytes
();
assert_eq!
(
args
.len
(),
3
);
let
byte_amount
=
...
...
@@ -428,7 +428,7 @@ fn codegen_regular_intrinsic_call<'tcx>(
sym
::
size_of_val
=>
{
intrinsic_args!
(
fx
,
args
=>
(
ptr
);
intrinsic
);
let
layout
=
fx
.layout_of
(
subst
s
.type_at
(
0
));
let
layout
=
fx
.layout_of
(
generic_arg
s
.type_at
(
0
));
// Note: Can't use is_unsized here as truly unsized types need to take the fixed size
// branch
let
size
=
if
let
Abi
::
ScalarPair
(
_
,
_
)
=
ptr
.layout
()
.abi
{
...
...
@@ -443,7 +443,7 @@ fn codegen_regular_intrinsic_call<'tcx>(
sym
::
min_align_of_val
=>
{
intrinsic_args!
(
fx
,
args
=>
(
ptr
);
intrinsic
);
let
layout
=
fx
.layout_of
(
subst
s
.type_at
(
0
));
let
layout
=
fx
.layout_of
(
generic_arg
s
.type_at
(
0
));
// Note: Can't use is_unsized here as truly unsized types need to take the fixed size
// branch
let
align
=
if
let
Abi
::
ScalarPair
(
_
,
_
)
=
ptr
.layout
()
.abi
{
...
...
@@ -602,7 +602,7 @@ fn codegen_regular_intrinsic_call<'tcx>(
sym
::
assert_inhabited
|
sym
::
assert_zero_valid
|
sym
::
assert_mem_uninitialized_valid
=>
{
intrinsic_args!
(
fx
,
args
=>
();
intrinsic
);
let
ty
=
subst
s
.type_at
(
0
);
let
ty
=
generic_arg
s
.type_at
(
0
);
let
requirement
=
ValidityRequirement
::
from_intrinsic
(
intrinsic
);
...
...
@@ -675,7 +675,7 @@ fn codegen_regular_intrinsic_call<'tcx>(
intrinsic_args!
(
fx
,
args
=>
(
ptr
,
base
);
intrinsic
);
let
ptr
=
ptr
.load_scalar
(
fx
);
let
base
=
base
.load_scalar
(
fx
);
let
ty
=
subst
s
.type_at
(
0
);
let
ty
=
generic_arg
s
.type_at
(
0
);
let
pointee_size
:
u64
=
fx
.layout_of
(
ty
)
.size
.bytes
();
let
diff_bytes
=
fx
.bcx
.ins
()
.isub
(
ptr
,
base
);
...
...
@@ -721,7 +721,7 @@ fn codegen_regular_intrinsic_call<'tcx>(
intrinsic_args!
(
fx
,
args
=>
(
ptr
);
intrinsic
);
let
ptr
=
ptr
.load_scalar
(
fx
);
let
ty
=
subst
s
.type_at
(
0
);
let
ty
=
generic_arg
s
.type_at
(
0
);
match
ty
.kind
()
{
ty
::
Uint
(
UintTy
::
U128
)
|
ty
::
Int
(
IntTy
::
I128
)
=>
{
// FIXME implement 128bit atomics
...
...
@@ -752,7 +752,7 @@ fn codegen_regular_intrinsic_call<'tcx>(
intrinsic_args!
(
fx
,
args
=>
(
ptr
,
val
);
intrinsic
);
let
ptr
=
ptr
.load_scalar
(
fx
);
let
ty
=
subst
s
.type_at
(
0
);
let
ty
=
generic_arg
s
.type_at
(
0
);
match
ty
.kind
()
{
ty
::
Uint
(
UintTy
::
U128
)
|
ty
::
Int
(
IntTy
::
I128
)
=>
{
// FIXME implement 128bit atomics
...
...
@@ -1129,7 +1129,7 @@ fn codegen_regular_intrinsic_call<'tcx>(
let
lhs_ref
=
lhs_ref
.load_scalar
(
fx
);
let
rhs_ref
=
rhs_ref
.load_scalar
(
fx
);
let
size
=
fx
.layout_of
(
subst
s
.type_at
(
0
))
.layout
.size
();
let
size
=
fx
.layout_of
(
generic_arg
s
.type_at
(
0
))
.layout
.size
();
// FIXME add and use emit_small_memcmp
let
is_eq_value
=
if
size
==
Size
::
ZERO
{
// No bytes means they're trivially equal
...
...
src/intrinsics/simd.rs
浏览文件 @
a8a722f2
//! Codegen `extern "platform-intrinsic"` intrinsics.
use
rustc_middle
::
ty
::
subst
::
Subst
sRef
;
use
rustc_middle
::
ty
::
GenericArg
sRef
;
use
rustc_span
::
Symbol
;
use
rustc_target
::
abi
::
Endian
;
...
...
@@ -21,7 +21,7 @@ fn report_simd_type_validation_error(
pub
(
super
)
fn
codegen_simd_intrinsic_call
<
'tcx
>
(
fx
:
&
mut
FunctionCx
<
'_
,
'_
,
'tcx
>
,
intrinsic
:
Symbol
,
_
substs
:
Subst
sRef
<
'tcx
>
,
_
args
:
GenericArg
sRef
<
'tcx
>
,
args
:
&
[
mir
::
Operand
<
'tcx
>
],
ret
:
CPlace
<
'tcx
>
,
target
:
BasicBlock
,
...
...
src/main_shim.rs
浏览文件 @
a8a722f2
use
rustc_hir
::
LangItem
;
use
rustc_middle
::
ty
::
subst
::
GenericArg
;
use
rustc_middle
::
ty
::
AssocKind
;
use
rustc_middle
::
ty
::
GenericArg
;
use
rustc_session
::
config
::{
sigpipe
,
EntryFnType
};
use
rustc_span
::
symbol
::
Ident
;
...
...
@@ -119,7 +119,7 @@ fn create_entry_fn(
tcx
,
ParamEnv
::
reveal_all
(),
report
.def_id
,
tcx
.mk_
subst
s
(
&
[
GenericArg
::
from
(
main_ret_ty
)]),
tcx
.mk_
arg
s
(
&
[
GenericArg
::
from
(
main_ret_ty
)]),
)
.unwrap
()
.unwrap
()
...
...
@@ -146,7 +146,7 @@ fn create_entry_fn(
tcx
,
ParamEnv
::
reveal_all
(),
start_def_id
,
tcx
.mk_
subst
s
(
&
[
main_ret_ty
.into
()]),
tcx
.mk_
arg
s
(
&
[
main_ret_ty
.into
()]),
)
.unwrap
()
.unwrap
()
...
...
src/pretty_clif.rs
浏览文件 @
a8a722f2
...
...
@@ -9,7 +9,7 @@
//!
//! function u0:22(i64) -> i8, i8 system_v {
//! ; symbol _ZN97_$LT$example..IsNotEmpty$u20$as$u20$mini_core..FnOnce$LT$$LP$$RF$$RF$$u5b$u16$u5d$$C$$RP$$GT$$GT$9call_once17hd517c453d67c0915E
//! ; instance Instance { def: Item(WithOptConstParam { did: DefId(0:42 ~ example[4e51]::{impl#0}::call_once), const_param_did: None }),
subst
s: [ReErased, ReErased] }
//! ; instance Instance { def: Item(WithOptConstParam { did: DefId(0:42 ~ example[4e51]::{impl#0}::call_once), const_param_did: None }),
arg
s: [ReErased, ReErased] }
//! ; abi FnAbi { args: [ArgAbi { layout: TyAndLayout { ty: IsNotEmpty, layout: Layout { size: Size(0 bytes), align: AbiAndPrefAlign { abi: Align(1 bytes), pref: Align(8 bytes) }, abi: Aggregate { sized: true }, fields: Arbitrary { offsets: [], memory_index: [] }, largest_niche: None, variants: Single { index: 0 } } }, mode: Ignore }, ArgAbi { layout: TyAndLayout { ty: &&[u16], layout: Layout { size: Size(8 bytes), align: AbiAndPrefAlign { abi: Align(8 bytes), pref: Align(8 bytes) }, abi: Scalar(Initialized { value: Pointer(AddressSpace(0)), valid_range: 1..=18446744073709551615 }), fields: Primitive, largest_niche: Some(Niche { offset: Size(0 bytes), value: Pointer(AddressSpace(0)), valid_range: 1..=18446744073709551615 }), variants: Single { index: 0 } } }, mode: Direct(ArgAttributes { regular: NonNull | NoUndef, arg_ext: None, pointee_size: Size(0 bytes), pointee_align: Some(Align(8 bytes)) }) }], ret: ArgAbi { layout: TyAndLayout { ty: (u8, u8), layout: Layout { size: Size(2 bytes), align: AbiAndPrefAlign { abi: Align(1 bytes), pref: Align(8 bytes) }, abi: ScalarPair(Initialized { value: Int(I8, false), valid_range: 0..=255 }, Initialized { value: Int(I8, false), valid_range: 0..=255 }), fields: Arbitrary { offsets: [Size(0 bytes), Size(1 bytes)], memory_index: [0, 1] }, largest_niche: None, variants: Single { index: 0 } } }, mode: Pair(ArgAttributes { regular: NoUndef, arg_ext: None, pointee_size: Size(0 bytes), pointee_align: None }, ArgAttributes { regular: NoUndef, arg_ext: None, pointee_size: Size(0 bytes), pointee_align: None }) }, c_variadic: false, fixed_count: 1, conv: Rust, can_unwind: false }
//!
//! ; kind loc.idx param pass mode ty
...
...
@@ -25,7 +25,7 @@
//!
//! ss0 = explicit_slot 16
//! sig0 = (i64, i64) -> i8, i8 system_v
//! fn0 = colocated u0:23 sig0 ; Instance { def: Item(WithOptConstParam { did: DefId(0:46 ~ example[4e51]::{impl#1}::call_mut), const_param_did: None }),
subst
s: [ReErased, ReErased] }
//! fn0 = colocated u0:23 sig0 ; Instance { def: Item(WithOptConstParam { did: DefId(0:46 ~ example[4e51]::{impl#1}::call_mut), const_param_did: None }),
arg
s: [ReErased, ReErased] }
//!
//! block0(v0: i64):
//! nop
...
...
@@ -261,7 +261,7 @@ pub(crate) fn write_clif_file(
impl
fmt
::
Debug
for
FunctionCx
<
'_
,
'_
,
'_
>
{
fn
fmt
(
&
self
,
f
:
&
mut
fmt
::
Formatter
<
'_
>
)
->
fmt
::
Result
{
writeln!
(
f
,
"{:?}"
,
self
.instance.
subst
s
)
?
;
writeln!
(
f
,
"{:?}"
,
self
.instance.
arg
s
)
?
;
writeln!
(
f
,
"{:?}"
,
self
.local_map
)
?
;
let
mut
clif
=
String
::
new
();
...
...
src/value_and_place.rs
浏览文件 @
a8a722f2
...
...
@@ -901,11 +901,11 @@ pub(crate) fn assert_assignable<'tcx>(
}
}
}
(
&
ty
::
Adt
(
adt_def_a
,
substs_a
),
&
ty
::
Adt
(
adt_def_b
,
subst
s_b
))
(
&
ty
::
Adt
(
adt_def_a
,
args_a
),
&
ty
::
Adt
(
adt_def_b
,
arg
s_b
))
if
adt_def_a
.did
()
==
adt_def_b
.did
()
=>
{
let
mut
types_a
=
subst
s_a
.types
();
let
mut
types_b
=
subst
s_b
.types
();
let
mut
types_a
=
arg
s_a
.types
();
let
mut
types_b
=
arg
s_b
.types
();
loop
{
match
(
types_a
.next
(),
types_b
.next
())
{
(
Some
(
a
),
Some
(
b
))
=>
assert_assignable
(
fx
,
a
,
b
,
limit
-
1
),
...
...
@@ -915,11 +915,11 @@ pub(crate) fn assert_assignable<'tcx>(
}
}
(
ty
::
Array
(
a
,
_
),
ty
::
Array
(
b
,
_
))
=>
assert_assignable
(
fx
,
*
a
,
*
b
,
limit
-
1
),
(
&
ty
::
Closure
(
def_id_a
,
substs_a
),
&
ty
::
Closure
(
def_id_b
,
subst
s_b
))
(
&
ty
::
Closure
(
def_id_a
,
args_a
),
&
ty
::
Closure
(
def_id_b
,
arg
s_b
))
if
def_id_a
==
def_id_b
=>
{
let
mut
types_a
=
subst
s_a
.types
();
let
mut
types_b
=
subst
s_b
.types
();
let
mut
types_a
=
arg
s_a
.types
();
let
mut
types_b
=
arg
s_b
.types
();
loop
{
match
(
types_a
.next
(),
types_b
.next
())
{
(
Some
(
a
),
Some
(
b
))
=>
assert_assignable
(
fx
,
a
,
b
,
limit
-
1
),
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录