Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
ccde510c
R
Rust
项目概览
int
/
Rust
11 个月 前同步成功
通知
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,发现更多精彩内容 >>
提交
ccde510c
编写于
11月 07, 2019
作者:
E
Eduard-Mihai Burtescu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
rustc_target: inline abi::FloatTy into abi::Primitive.
上级
50f8aadd
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
29 addition
and
35 deletion
+29
-35
src/librustc/ich/impls_syntax.rs
src/librustc/ich/impls_syntax.rs
+0
-1
src/librustc/ty/layout.rs
src/librustc/ty/layout.rs
+9
-8
src/librustc_codegen_llvm/debuginfo/metadata.rs
src/librustc_codegen_llvm/debuginfo/metadata.rs
+2
-2
src/librustc_codegen_llvm/intrinsic.rs
src/librustc_codegen_llvm/intrinsic.rs
+3
-3
src/librustc_codegen_llvm/type_of.rs
src/librustc_codegen_llvm/type_of.rs
+3
-3
src/librustc_target/abi/call/mips64.rs
src/librustc_target/abi/call/mips64.rs
+3
-3
src/librustc_target/abi/call/mod.rs
src/librustc_target/abi/call/mod.rs
+1
-1
src/librustc_target/abi/call/x86_64.rs
src/librustc_target/abi/call/x86_64.rs
+1
-1
src/librustc_target/abi/mod.rs
src/librustc_target/abi/mod.rs
+7
-13
未找到文件。
src/librustc/ich/impls_syntax.rs
浏览文件 @
ccde510c
...
...
@@ -162,7 +162,6 @@ fn hash_stable(&self, hcx: &mut StableHashingContext<'a>, hasher: &mut StableHas
impl_stable_hash_for!
(
enum
::
syntax
::
ast
::
IntTy
{
Isize
,
I8
,
I16
,
I32
,
I64
,
I128
});
impl_stable_hash_for!
(
enum
::
syntax
::
ast
::
UintTy
{
Usize
,
U8
,
U16
,
U32
,
U64
,
U128
});
impl_stable_hash_for!
(
enum
::
syntax
::
ast
::
FloatTy
{
F32
,
F64
});
impl_stable_hash_for!
(
enum
::
rustc_target
::
abi
::
FloatTy
{
F32
,
F64
});
impl_stable_hash_for!
(
enum
::
syntax
::
ast
::
Unsafety
{
Unsafe
,
Normal
});
impl_stable_hash_for!
(
enum
::
syntax
::
ast
::
Constness
{
Const
,
NotConst
});
impl_stable_hash_for!
(
enum
::
syntax
::
ast
::
Defaultness
{
Default
,
Final
});
...
...
src/librustc/ty/layout.rs
浏览文件 @
ccde510c
...
...
@@ -132,8 +132,8 @@ impl PrimitiveExt for Primitive {
fn
to_ty
<
'tcx
>
(
&
self
,
tcx
:
TyCtxt
<
'tcx
>
)
->
Ty
<
'tcx
>
{
match
*
self
{
Int
(
i
,
signed
)
=>
i
.to_ty
(
tcx
,
signed
),
F
loat
(
FloatTy
::
F32
)
=>
tcx
.types.f32
,
F
loat
(
FloatTy
::
F64
)
=>
tcx
.types.f64
,
F
32
=>
tcx
.types.f32
,
F
64
=>
tcx
.types.f64
,
Pointer
=>
tcx
.mk_mut_ptr
(
tcx
.mk_unit
()),
}
}
...
...
@@ -144,7 +144,7 @@ fn to_int_ty(&self, tcx: TyCtxt<'tcx>) -> Ty<'tcx> {
match
*
self
{
Int
(
i
,
signed
)
=>
i
.to_ty
(
tcx
,
signed
),
Pointer
=>
tcx
.types.usize
,
F
loat
(
..
)
=>
bug!
(
"floats do not have an int type"
),
F
32
|
F64
=>
bug!
(
"floats do not have an int type"
),
}
}
}
...
...
@@ -538,10 +538,10 @@ fn layout_raw_uncached(&self, ty: Ty<'tcx>) -> Result<&'tcx LayoutDetails, Layou
ty
::
Uint
(
ity
)
=>
{
scalar
(
Int
(
Integer
::
from_attr
(
dl
,
attr
::
UnsignedInt
(
ity
)),
false
))
}
ty
::
Float
(
fty
)
=>
scalar
(
Float
(
match
fty
{
ast
::
FloatTy
::
F32
=>
F
loatTy
::
F
32
,
ast
::
FloatTy
::
F64
=>
F
loatTy
::
F
64
,
})
)
,
ty
::
Float
(
fty
)
=>
scalar
(
match
fty
{
ast
::
FloatTy
::
F32
=>
F32
,
ast
::
FloatTy
::
F64
=>
F64
,
}),
ty
::
FnPtr
(
_
)
=>
{
let
mut
ptr
=
scalar_unit
(
Pointer
);
ptr
.valid_range
=
1
..=*
ptr
.valid_range
.end
();
...
...
@@ -2457,7 +2457,8 @@ fn hash_stable(&self, hcx: &mut StableHashingContext<'a>, hasher: &mut StableHas
impl_stable_hash_for!
(
enum
crate
::
ty
::
layout
::
Primitive
{
Int
(
integer
,
signed
),
Float
(
fty
),
F32
,
F64
,
Pointer
});
...
...
src/librustc_codegen_llvm/debuginfo/metadata.rs
浏览文件 @
ccde510c
...
...
@@ -1904,8 +1904,8 @@ fn prepare_enum_metadata(
let
discr_type
=
match
discr
.value
{
layout
::
Int
(
t
,
_
)
=>
t
,
layout
::
F
loat
(
layout
::
FloatTy
::
F32
)
=>
Integer
::
I32
,
layout
::
F
loat
(
layout
::
FloatTy
::
F64
)
=>
Integer
::
I64
,
layout
::
F
32
=>
Integer
::
I32
,
layout
::
F
64
=>
Integer
::
I64
,
layout
::
Pointer
=>
cx
.data_layout
()
.ptr_sized_integer
(),
}
.to_ty
(
cx
.tcx
,
false
);
...
...
src/librustc_codegen_llvm/intrinsic.rs
浏览文件 @
ccde510c
...
...
@@ -18,7 +18,7 @@
use
rustc
::
mir
::
interpret
::
GlobalId
;
use
rustc_codegen_ssa
::
common
::{
IntPredicate
,
TypeKind
};
use
rustc
::
hir
;
use
rustc_target
::
abi
::
{
FloatTy
,
HasDataLayout
}
;
use
rustc_target
::
abi
::
HasDataLayout
;
use
syntax
::
ast
;
use
rustc_codegen_ssa
::
common
::
span_invalid_monomorphization_error
;
...
...
@@ -163,12 +163,12 @@ fn codegen_intrinsic_call(
emit_va_arg
(
self
,
args
[
0
],
ret_ty
)
}
}
Primitive
::
F
loat
(
FloatTy
::
F64
)
|
Primitive
::
F
64
|
Primitive
::
Pointer
=>
{
emit_va_arg
(
self
,
args
[
0
],
ret_ty
)
}
// `va_arg` should never be used with the return type f32.
Primitive
::
F
loat
(
FloatTy
::
F32
)
=>
{
Primitive
::
F
32
=>
{
bug!
(
"the va_arg intrinsic does not work with `f32`"
)
}
}
...
...
src/librustc_codegen_llvm/type_of.rs
浏览文件 @
ccde510c
...
...
@@ -3,7 +3,7 @@
use
crate
::
type_
::
Type
;
use
rustc
::
ty
::{
self
,
Ty
,
TypeFoldable
};
use
rustc
::
ty
::
layout
::{
self
,
Align
,
LayoutOf
,
FnAbiExt
,
PointeeInfo
,
Size
,
TyLayout
};
use
rustc_target
::
abi
::
{
FloatTy
,
TyLayoutMethods
}
;
use
rustc_target
::
abi
::
TyLayoutMethods
;
use
rustc
::
ty
::
print
::
obsolete
::
DefPathBasedNames
;
use
rustc_codegen_ssa
::
traits
::
*
;
...
...
@@ -300,8 +300,8 @@ fn scalar_llvm_type_at<'a>(&self, cx: &CodegenCx<'a, 'tcx>,
scalar
:
&
layout
::
Scalar
,
offset
:
Size
)
->
&
'a
Type
{
match
scalar
.value
{
layout
::
Int
(
i
,
_
)
=>
cx
.type_from_integer
(
i
),
layout
::
F
loat
(
FloatTy
::
F32
)
=>
cx
.type_f32
(),
layout
::
F
loat
(
FloatTy
::
F64
)
=>
cx
.type_f64
(),
layout
::
F
32
=>
cx
.type_f32
(),
layout
::
F
64
=>
cx
.type_f64
(),
layout
::
Pointer
=>
{
// If we know the alignment, pick something better than i8.
let
pointee
=
if
let
Some
(
pointee
)
=
self
.pointee_info_at
(
cx
,
offset
)
{
...
...
src/librustc_target/abi/call/mips64.rs
浏览文件 @
ccde510c
...
...
@@ -23,8 +23,8 @@ fn float_reg<'a, Ty, C>(cx: &C, ret: &ArgAbi<'a, Ty>, i: usize) -> Option<Reg>
{
match
ret
.layout
.field
(
cx
,
i
)
.abi
{
abi
::
Abi
::
Scalar
(
ref
scalar
)
=>
match
scalar
.value
{
abi
::
F
loat
(
abi
::
FloatTy
::
F32
)
=>
Some
(
Reg
::
f32
()),
abi
::
F
loat
(
abi
::
FloatTy
::
F64
)
=>
Some
(
Reg
::
f64
()),
abi
::
F
32
=>
Some
(
Reg
::
f32
()),
abi
::
F
64
=>
Some
(
Reg
::
f64
()),
_
=>
None
},
_
=>
None
...
...
@@ -107,7 +107,7 @@ fn classify_arg<'a, Ty, C>(cx: &C, arg: &mut ArgAbi<'a, Ty>)
// We only care about aligned doubles
if
let
abi
::
Abi
::
Scalar
(
ref
scalar
)
=
field
.abi
{
if
let
abi
::
F
loat
(
abi
::
FloatTy
::
F64
)
=
scalar
.value
{
if
let
abi
::
F
64
=
scalar
.value
{
if
offset
.is_aligned
(
dl
.f64_align.abi
)
{
// Insert enough integers to cover [last_offset, offset)
assert
!
(
last_offset
.is_aligned
(
dl
.f64_align.abi
));
...
...
src/librustc_target/abi/call/mod.rs
浏览文件 @
ccde510c
...
...
@@ -287,7 +287,7 @@ pub fn homogeneous_aggregate<C>(&self, cx: &C) -> HomogeneousAggregate
let
kind
=
match
scalar
.value
{
abi
::
Int
(
..
)
|
abi
::
Pointer
=>
RegKind
::
Integer
,
abi
::
F
loat
(
_
)
=>
RegKind
::
Float
,
abi
::
F
32
|
abi
::
F64
=>
RegKind
::
Float
,
};
HomogeneousAggregate
::
Homogeneous
(
Reg
{
kind
,
...
...
src/librustc_target/abi/call/x86_64.rs
浏览文件 @
ccde510c
...
...
@@ -45,7 +45,7 @@ fn classify<'a, Ty, C>(cx: &C, layout: TyLayout<'a, Ty>,
match
scalar
.value
{
abi
::
Int
(
..
)
|
abi
::
Pointer
=>
Class
::
Int
,
abi
::
F
loat
(
_
)
=>
Class
::
Sse
abi
::
F
32
|
abi
::
F64
=>
Class
::
Sse
}
}
...
...
src/librustc_target/abi/mod.rs
浏览文件 @
ccde510c
...
...
@@ -532,13 +532,6 @@ pub fn approximate_align<C: HasDataLayout>(cx: &C, wanted: Align) -> Integer {
}
}
#[derive(Clone,
PartialEq,
Eq,
RustcEncodable,
RustcDecodable,
Hash,
Copy,
PartialOrd,
Ord,
Debug)]
pub
enum
FloatTy
{
F32
,
F64
,
}
/// Fundamental unit of memory access and layout.
#[derive(Copy,
Clone,
PartialEq,
Eq,
Hash,
Debug)]
pub
enum
Primitive
{
...
...
@@ -550,7 +543,8 @@ pub enum Primitive {
/// a negative integer passed by zero-extension will appear positive in
/// the callee, and most operations on it will produce the wrong values.
Int
(
Integer
,
bool
),
Float
(
FloatTy
),
F32
,
F64
,
Pointer
}
...
...
@@ -560,8 +554,8 @@ pub fn size<C: HasDataLayout>(self, cx: &C) -> Size {
match
self
{
Int
(
i
,
_
)
=>
i
.size
(),
F
loat
(
FloatTy
::
F32
)
=>
Size
::
from_bits
(
32
),
F
loat
(
FloatTy
::
F64
)
=>
Size
::
from_bits
(
64
),
F
32
=>
Size
::
from_bits
(
32
),
F
64
=>
Size
::
from_bits
(
64
),
Pointer
=>
dl
.pointer_size
}
}
...
...
@@ -571,15 +565,15 @@ pub fn align<C: HasDataLayout>(self, cx: &C) -> AbiAndPrefAlign {
match
self
{
Int
(
i
,
_
)
=>
i
.align
(
dl
),
F
loat
(
FloatTy
::
F32
)
=>
dl
.f32_align
,
F
loat
(
FloatTy
::
F64
)
=>
dl
.f64_align
,
F
32
=>
dl
.f32_align
,
F
64
=>
dl
.f64_align
,
Pointer
=>
dl
.pointer_align
}
}
pub
fn
is_float
(
self
)
->
bool
{
match
self
{
F
loat
(
_
)
=>
true
,
F
32
|
F64
=>
true
,
_
=>
false
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录