Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
25a58af0
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,发现更多精彩内容 >>
提交
25a58af0
编写于
8月 09, 2018
作者:
L
ljedrz
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
A few cleanups for rustc_target
上级
76b69a60
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
46 addition
and
50 deletion
+46
-50
src/librustc_target/abi/call/mips64.rs
src/librustc_target/abi/call/mips64.rs
+1
-1
src/librustc_target/abi/call/mod.rs
src/librustc_target/abi/call/mod.rs
+2
-2
src/librustc_target/abi/call/x86_64.rs
src/librustc_target/abi/call/x86_64.rs
+2
-4
src/librustc_target/abi/mod.rs
src/librustc_target/abi/mod.rs
+17
-17
src/librustc_target/spec/abi.rs
src/librustc_target/spec/abi.rs
+6
-6
src/librustc_target/spec/apple_base.rs
src/librustc_target/spec/apple_base.rs
+1
-1
src/librustc_target/spec/apple_ios_base.rs
src/librustc_target/spec/apple_ios_base.rs
+6
-6
src/librustc_target/spec/mod.rs
src/librustc_target/spec/mod.rs
+11
-13
未找到文件。
src/librustc_target/abi/call/mips64.rs
浏览文件 @
25a58af0
...
...
@@ -145,7 +145,7 @@ fn classify_arg_ty<'a, Ty, C>(cx: C, arg: &mut ArgType<'a, Ty>)
// Extract first 8 chunks as the prefix
let
rest_size
=
size
-
Size
::
from_bytes
(
8
)
*
prefix_index
as
u64
;
arg
.cast_to
(
CastTarget
{
prefix
:
prefix
,
prefix
,
prefix_chunk
:
Size
::
from_bytes
(
8
),
rest
:
Uniform
{
unit
:
Reg
::
i64
(),
total
:
rest_size
}
});
...
...
src/librustc_target/abi/call/mod.rs
浏览文件 @
25a58af0
...
...
@@ -90,7 +90,7 @@ pub fn new() -> Self {
}
pub
fn
set
(
&
mut
self
,
attr
:
ArgAttribute
)
->
&
mut
Self
{
self
.regular
=
self
.regular
|
attr
;
self
.regular
|
=
attr
;
self
}
...
...
@@ -229,7 +229,7 @@ pub fn size<C: HasDataLayout>(&self, cx: C) -> Size {
pub
fn
align
<
C
:
HasDataLayout
>
(
&
self
,
cx
:
C
)
->
Align
{
self
.prefix
.iter
()
.filter_map
(|
x
|
x
.map
(|
kind
|
Reg
{
kind
:
kind
,
size
:
self
.prefix_chunk
}
.align
(
cx
)))
.filter_map
(|
x
|
x
.map
(|
kind
|
Reg
{
kind
,
size
:
self
.prefix_chunk
}
.align
(
cx
)))
.fold
(
cx
.data_layout
()
.aggregate_align
.max
(
self
.rest
.align
(
cx
)),
|
acc
,
align
|
acc
.max
(
align
))
}
...
...
src/librustc_target/abi/call/x86_64.rs
浏览文件 @
25a58af0
...
...
@@ -199,10 +199,8 @@ pub fn compute_abi_info<'a, Ty, C>(cx: C, fty: &mut FnType<'a, Ty>)
_
=>
{}
}
}
if
arg
.layout
.is_aggregate
()
{
if
int_regs
<
needed_int
||
sse_regs
<
needed_sse
{
cls_or_mem
=
Err
(
Memory
);
}
if
arg
.layout
.is_aggregate
()
&&
(
int_regs
<
needed_int
||
sse_regs
<
needed_sse
)
{
cls_or_mem
=
Err
(
Memory
);
}
}
}
...
...
src/librustc_target/abi/mod.rs
浏览文件 @
25a58af0
...
...
@@ -93,17 +93,17 @@ pub fn parse(target: &Target) -> Result<TargetDataLayout, String> {
let
mut
dl
=
TargetDataLayout
::
default
();
let
mut
i128_align_src
=
64
;
for
spec
in
target
.data_layout
.split
(
'-'
)
{
match
&
spec
.split
(
':'
)
.collect
::
<
Vec
<
_
>>
()[
..
]
{
&
[
"e"
]
=>
dl
.endian
=
Endian
::
Little
,
&
[
"E"
]
=>
dl
.endian
=
Endian
::
Big
,
&
[
"a"
,
ref
a
..
]
=>
dl
.aggregate_align
=
align
(
a
,
"a"
)
?
,
&
[
"f32"
,
ref
a
..
]
=>
dl
.f32_align
=
align
(
a
,
"f32"
)
?
,
&
[
"f64"
,
ref
a
..
]
=>
dl
.f64_align
=
align
(
a
,
"f64"
)
?
,
&
[
p
@
"p"
,
s
,
ref
a
..
]
|
&
[
p
@
"p0"
,
s
,
ref
a
..
]
=>
{
match
spec
.split
(
':'
)
.collect
::
<
Vec
<
_
>>
()[
..
]
{
[
"e"
]
=>
dl
.endian
=
Endian
::
Little
,
[
"E"
]
=>
dl
.endian
=
Endian
::
Big
,
[
"a"
,
ref
a
..
]
=>
dl
.aggregate_align
=
align
(
a
,
"a"
)
?
,
[
"f32"
,
ref
a
..
]
=>
dl
.f32_align
=
align
(
a
,
"f32"
)
?
,
[
"f64"
,
ref
a
..
]
=>
dl
.f64_align
=
align
(
a
,
"f64"
)
?
,
[
p
@
"p"
,
s
,
ref
a
..
]
|
[
p
@
"p0"
,
s
,
ref
a
..
]
=>
{
dl
.pointer_size
=
size
(
s
,
p
)
?
;
dl
.pointer_align
=
align
(
a
,
p
)
?
;
}
&
[
s
,
ref
a
..
]
if
s
.starts_with
(
"i"
)
=>
{
[
s
,
ref
a
..
]
if
s
.starts_with
(
"i"
)
=>
{
let
bits
=
match
s
[
1
..
]
.parse
::
<
u64
>
()
{
Ok
(
bits
)
=>
bits
,
Err
(
_
)
=>
{
...
...
@@ -127,7 +127,7 @@ pub fn parse(target: &Target) -> Result<TargetDataLayout, String> {
dl
.i128_align
=
a
;
}
}
&
[
s
,
ref
a
..
]
if
s
.starts_with
(
"v"
)
=>
{
[
s
,
ref
a
..
]
if
s
.starts_with
(
"v"
)
=>
{
let
v_size
=
size
(
&
s
[
1
..
],
"v"
)
?
;
let
a
=
align
(
a
,
s
)
?
;
if
let
Some
(
v
)
=
dl
.vector_align
.iter_mut
()
.find
(|
v
|
v
.0
==
v_size
)
{
...
...
@@ -429,8 +429,8 @@ pub enum Integer {
}
impl
Integer
{
pub
fn
size
(
&
self
)
->
Size
{
match
*
self
{
pub
fn
size
(
self
)
->
Size
{
match
self
{
I8
=>
Size
::
from_bytes
(
1
),
I16
=>
Size
::
from_bytes
(
2
),
I32
=>
Size
::
from_bytes
(
4
),
...
...
@@ -439,10 +439,10 @@ pub fn size(&self) -> Size {
}
}
pub
fn
align
<
C
:
HasDataLayout
>
(
&
self
,
cx
:
C
)
->
Align
{
pub
fn
align
<
C
:
HasDataLayout
>
(
self
,
cx
:
C
)
->
Align
{
let
dl
=
cx
.data_layout
();
match
*
self
{
match
self
{
I8
=>
dl
.i8_align
,
I16
=>
dl
.i16_align
,
I32
=>
dl
.i32_align
,
...
...
@@ -522,15 +522,15 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
}
impl
FloatTy
{
pub
fn
ty_to_string
(
&
self
)
->
&
'static
str
{
match
*
self
{
pub
fn
ty_to_string
(
self
)
->
&
'static
str
{
match
self
{
FloatTy
::
F32
=>
"f32"
,
FloatTy
::
F64
=>
"f64"
,
}
}
pub
fn
bit_width
(
&
self
)
->
usize
{
match
*
self
{
pub
fn
bit_width
(
self
)
->
usize
{
match
self
{
FloatTy
::
F32
=>
32
,
FloatTy
::
F64
=>
64
,
}
...
...
src/librustc_target/spec/abi.rs
浏览文件 @
25a58af0
...
...
@@ -51,7 +51,7 @@ pub struct AbiData {
}
#[allow(non_upper_case_globals)]
const
AbiDatas
:
&
'static
[
AbiData
]
=
&
[
const
AbiDatas
:
&
[
AbiData
]
=
&
[
// Platform-specific ABIs
AbiData
{
abi
:
Abi
::
Cdecl
,
name
:
"cdecl"
,
generic
:
false
},
AbiData
{
abi
:
Abi
::
Stdcall
,
name
:
"stdcall"
,
generic
:
false
},
...
...
@@ -87,20 +87,20 @@ pub fn all_names() -> Vec<&'static str> {
impl
Abi
{
#[inline]
pub
fn
index
(
&
self
)
->
usize
{
*
self
as
usize
pub
fn
index
(
self
)
->
usize
{
self
as
usize
}
#[inline]
pub
fn
data
(
&
self
)
->
&
'static
AbiData
{
pub
fn
data
(
self
)
->
&
'static
AbiData
{
&
AbiDatas
[
self
.index
()]
}
pub
fn
name
(
&
self
)
->
&
'static
str
{
pub
fn
name
(
self
)
->
&
'static
str
{
self
.data
()
.name
}
pub
fn
generic
(
&
self
)
->
bool
{
pub
fn
generic
(
self
)
->
bool
{
self
.data
()
.generic
}
}
...
...
src/librustc_target/spec/apple_base.rs
浏览文件 @
25a58af0
...
...
@@ -26,7 +26,7 @@ pub fn opts() -> TargetOptions {
// TLS is flagged as enabled if it looks to be supported.
let
deployment_target
=
env
::
var
(
"MACOSX_DEPLOYMENT_TARGET"
)
.ok
();
let
version
=
deployment_target
.as_ref
()
.and_then
(|
s
|
{
let
mut
i
=
s
.splitn
(
2
,
"."
);
let
mut
i
=
s
.splitn
(
2
,
'.'
);
i
.next
()
.and_then
(|
a
|
i
.next
()
.map
(|
b
|
(
a
,
b
)))
})
.and_then
(|(
a
,
b
)|
{
a
.parse
::
<
u32
>
()
.and_then
(|
a
|
b
.parse
::
<
u32
>
()
.map
(|
b
|
(
a
,
b
)))
.ok
()
...
...
src/librustc_target/spec/apple_ios_base.rs
浏览文件 @
25a58af0
...
...
@@ -25,13 +25,13 @@ pub enum Arch {
}
impl
Arch
{
pub
fn
to_string
(
&
self
)
->
&
'static
str
{
pub
fn
to_string
(
self
)
->
&
'static
str
{
match
self
{
&
Armv7
=>
"armv7"
,
&
Armv7s
=>
"armv7s"
,
&
Arm64
=>
"arm64"
,
&
I386
=>
"i386"
,
&
X86_64
=>
"x86_64"
Armv7
=>
"armv7"
,
Armv7s
=>
"armv7s"
,
Arm64
=>
"arm64"
,
I386
=>
"i386"
,
X86_64
=>
"x86_64"
}
}
}
...
...
src/librustc_target/spec/mod.rs
浏览文件 @
25a58af0
...
...
@@ -747,7 +747,7 @@ pub fn min_atomic_width(&self) -> u64 {
/// Maximum integer size in bits that this target can perform atomic
/// operations on.
pub
fn
max_atomic_width
(
&
self
)
->
u64
{
self
.options.max_atomic_width
.unwrap_or
(
self
.target_pointer_width
.parse
()
.unwrap
())
self
.options.max_atomic_width
.unwrap_or
_else
(||
self
.target_pointer_width
.parse
()
.unwrap
())
}
pub
fn
is_abi_supported
(
&
self
,
abi
:
Abi
)
->
bool
{
...
...
@@ -777,7 +777,7 @@ pub fn from_json(obj: Json) -> TargetResult {
let
get_opt_field
=
|
name
:
&
str
,
default
:
&
str
|
{
obj
.find
(
name
)
.and_then
(|
s
|
s
.as_string
())
.map
(|
s
|
s
.to_string
())
.unwrap_or
(
default
.to_string
())
.unwrap_or
_else
(||
default
.to_string
())
};
let
mut
base
=
Target
{
...
...
@@ -1007,7 +1007,6 @@ pub fn from_json(obj: Json) -> TargetResult {
/// filesystem access and JSON decoding.
pub
fn
search
(
target_triple
:
&
TargetTriple
)
->
Result
<
Target
,
String
>
{
use
std
::
env
;
use
std
::
ffi
::
OsString
;
use
std
::
fs
;
use
serialize
::
json
;
...
...
@@ -1018,8 +1017,8 @@ fn load_file(path: &Path) -> Result<Target, String> {
Target
::
from_json
(
obj
)
}
match
target_triple
{
&
TargetTriple
::
TargetTriple
(
ref
target_triple
)
=>
{
match
*
target_triple
{
TargetTriple
::
TargetTriple
(
ref
target_triple
)
=>
{
// check if triple is in list of supported targets
if
let
Ok
(
t
)
=
load_specific
(
target_triple
)
{
return
Ok
(
t
)
...
...
@@ -1032,8 +1031,7 @@ fn load_file(path: &Path) -> Result<Target, String> {
PathBuf
::
from
(
target
)
};
let
target_path
=
env
::
var_os
(
"RUST_TARGET_PATH"
)
.unwrap_or
(
OsString
::
new
());
let
target_path
=
env
::
var_os
(
"RUST_TARGET_PATH"
)
.unwrap_or_default
();
// FIXME 16351: add a sane default search path?
...
...
@@ -1045,7 +1043,7 @@ fn load_file(path: &Path) -> Result<Target, String> {
}
Err
(
format!
(
"Could not find specification for target {:?}"
,
target_triple
))
}
&
TargetTriple
::
TargetPath
(
ref
target_path
)
=>
{
TargetTriple
::
TargetPath
(
ref
target_path
)
=>
{
if
target_path
.is_file
()
{
return
load_file
(
&
target_path
);
}
...
...
@@ -1190,7 +1188,7 @@ fn to_json(&self) -> Json {
if
default
.abi_blacklist
!=
self
.options.abi_blacklist
{
d
.insert
(
"abi-blacklist"
.to_string
(),
self
.options.abi_blacklist
.iter
()
.map
(
Abi
::
name
)
.map
(|
name
|
name
.to_json
())
.map
(
|
&
name
|
Abi
::
name
(
name
)
.to_json
())
.collect
::
<
Vec
<
_
>>
()
.to_json
());
}
...
...
@@ -1229,9 +1227,9 @@ pub fn from_path(path: &Path) -> Result<Self, io::Error> {
///
/// If this target is a path, the file name (without extension) is returned.
pub
fn
triple
(
&
self
)
->
&
str
{
match
self
{
&
TargetTriple
::
TargetTriple
(
ref
triple
)
=>
triple
,
&
TargetTriple
::
TargetPath
(
ref
path
)
=>
{
match
*
self
{
TargetTriple
::
TargetTriple
(
ref
triple
)
=>
triple
,
TargetTriple
::
TargetPath
(
ref
path
)
=>
{
path
.file_stem
()
.expect
(
"target path must not be empty"
)
.to_str
()
.expect
(
"target path must be valid unicode"
)
}
...
...
@@ -1247,7 +1245,7 @@ pub fn debug_triple(&self) -> String {
use
std
::
collections
::
hash_map
::
DefaultHasher
;
let
triple
=
self
.triple
();
if
let
&
TargetTriple
::
TargetPath
(
ref
path
)
=
self
{
if
let
TargetTriple
::
TargetPath
(
ref
path
)
=
*
self
{
let
mut
hasher
=
DefaultHasher
::
new
();
path
.hash
(
&
mut
hasher
);
let
hash
=
hasher
.finish
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录