Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
45f8a3b3
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,发现更多精彩内容 >>
提交
45f8a3b3
编写于
11月 23, 2017
作者:
M
Maik Klein
提交者:
Ariel Ben-Yehuda
12月 18, 2017
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Move partitioning.rs to rustc_mir
上级
116e43f7
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
35 addition
and
34 deletion
+35
-34
src/librustc_mir/monomorphize/item.rs
src/librustc_mir/monomorphize/item.rs
+26
-0
src/librustc_mir/monomorphize/mod.rs
src/librustc_mir/monomorphize/mod.rs
+2
-0
src/librustc_mir/monomorphize/partitioning.rs
src/librustc_mir/monomorphize/partitioning.rs
+3
-2
src/librustc_trans/base.rs
src/librustc_trans/base.rs
+1
-1
src/librustc_trans/consts.rs
src/librustc_trans/consts.rs
+1
-1
src/librustc_trans/context.rs
src/librustc_trans/context.rs
+1
-1
src/librustc_trans/lib.rs
src/librustc_trans/lib.rs
+0
-1
src/librustc_trans/trans_item.rs
src/librustc_trans/trans_item.rs
+1
-28
未找到文件。
src/librustc_mir/monomorphize/item.rs
浏览文件 @
45f8a3b3
...
...
@@ -26,6 +26,7 @@
use
std
::
fmt
::{
self
,
Write
};
use
std
::
iter
;
use
rustc
::
mir
::
mono
::
Linkage
;
use
syntax_pos
::
symbol
::
Symbol
;
pub
use
rustc
::
mir
::
mono
::
MonoItem
;
pub
fn
linkage_by_name
(
name
:
&
str
)
->
Option
<
Linkage
>
{
...
...
@@ -83,6 +84,31 @@ pub enum InstantiationMode {
pub
trait
MonoItemExt
<
'a
,
'tcx
>
:
fmt
::
Debug
{
fn
as_mono_item
(
&
self
)
->
&
MonoItem
<
'tcx
>
;
fn
is_generic_fn
(
&
self
)
->
bool
{
match
*
self
.as_mono_item
()
{
MonoItem
::
Fn
(
ref
instance
)
=>
{
instance
.substs
.types
()
.next
()
.is_some
()
}
MonoItem
::
Static
(
..
)
|
MonoItem
::
GlobalAsm
(
..
)
=>
false
,
}
}
fn
symbol_name
(
&
self
,
tcx
:
TyCtxt
<
'a
,
'tcx
,
'tcx
>
)
->
ty
::
SymbolName
{
match
*
self
.as_mono_item
()
{
MonoItem
::
Fn
(
instance
)
=>
tcx
.symbol_name
(
instance
),
MonoItem
::
Static
(
node_id
)
=>
{
let
def_id
=
tcx
.hir
.local_def_id
(
node_id
);
tcx
.symbol_name
(
Instance
::
mono
(
tcx
,
def_id
))
}
MonoItem
::
GlobalAsm
(
node_id
)
=>
{
let
def_id
=
tcx
.hir
.local_def_id
(
node_id
);
ty
::
SymbolName
{
name
:
Symbol
::
intern
(
&
format!
(
"global_asm_{:?}"
,
def_id
))
.as_str
()
}
}
}
}
fn
instantiation_mode
(
&
self
,
tcx
:
TyCtxt
<
'a
,
'tcx
,
'tcx
>
)
->
InstantiationMode
{
...
...
src/librustc_mir/monomorphize/mod.rs
浏览文件 @
45f8a3b3
...
...
@@ -16,9 +16,11 @@
use
rustc
::
ty
::{
self
,
Ty
,
TyCtxt
};
pub
use
rustc
::
ty
::
Instance
;
pub
use
self
::
item
::{
MonoItem
,
MonoItemExt
};
pub
mod
collector
;
pub
mod
item
;
pub
mod
partitioning
;
fn
fn_once_adapter_instance
<
'a
,
'tcx
>
(
tcx
:
TyCtxt
<
'a
,
'tcx
,
'tcx
>
,
...
...
src/librustc_
trans
/partitioning.rs
→
src/librustc_
mir/monomorphize
/partitioning.rs
浏览文件 @
45f8a3b3
...
...
@@ -102,7 +102,7 @@
//! source-level module, functions from the same module will be available for
//! inlining, even when they are not marked #[inline].
use
rustc_mir
::
monomorphize
::
collector
::
InliningMap
;
use
monomorphize
::
collector
::
InliningMap
;
use
rustc
::
dep_graph
::
WorkProductId
;
use
rustc
::
hir
::
def_id
::
DefId
;
use
rustc
::
hir
::
map
::
DefPathData
;
...
...
@@ -113,7 +113,8 @@
use
std
::
collections
::
hash_map
::
Entry
;
use
syntax
::
ast
::
NodeId
;
use
syntax
::
symbol
::{
Symbol
,
InternedString
};
use
trans_item
::{
MonoItem
,
BaseMonoItemExt
,
MonoItemExt
,
InstantiationMode
};
use
rustc
::
mir
::
mono
::
MonoItem
;
use
monomorphize
::
item
::{
MonoItemExt
,
InstantiationMode
};
use
rustc
::
ty
::
subst
::
Subst
;
pub
use
rustc
::
mir
::
mono
::
CodegenUnit
;
...
...
src/librustc_trans/base.rs
浏览文件 @
45f8a3b3
...
...
@@ -64,7 +64,7 @@
use
meth
;
use
mir
;
use
monomorphize
::
Instance
;
use
partitioning
::{
self
,
PartitioningStrategy
,
CodegenUnit
,
CodegenUnitExt
};
use
monomorphize
::
partitioning
::{
self
,
PartitioningStrategy
,
CodegenUnit
,
CodegenUnitExt
};
use
symbol_names_test
;
use
time_graph
;
use
trans_item
::{
MonoItem
,
BaseMonoItemExt
,
MonoItemExt
,
DefPathBasedNames
};
...
...
src/librustc_trans/consts.rs
浏览文件 @
45f8a3b3
...
...
@@ -16,7 +16,7 @@
use
rustc
::
middle
::
const_val
::
ConstEvalErr
;
use
debuginfo
;
use
base
;
use
trans_item
::{
MonoItem
,
MonoItemExt
};
use
monomorphize
::{
MonoItem
,
MonoItemExt
};
use
common
::{
CrateContext
,
val_ty
};
use
declare
;
use
monomorphize
::
Instance
;
...
...
src/librustc_trans/context.rs
浏览文件 @
45f8a3b3
...
...
@@ -22,7 +22,7 @@
use
declare
;
use
monomorphize
::
Instance
;
use
partitioning
::
CodegenUnit
;
use
monomorphize
::
partitioning
::
CodegenUnit
;
use
type_
::
Type
;
use
type_of
::
PointeeInfo
;
...
...
src/librustc_trans/lib.rs
浏览文件 @
45f8a3b3
...
...
@@ -138,7 +138,6 @@ pub mod back {
mod
metadata
;
mod
meth
;
mod
mir
;
mod
partitioning
;
mod
symbol_names_test
;
mod
time_graph
;
mod
trans_item
;
...
...
src/librustc_trans/trans_item.rs
浏览文件 @
45f8a3b3
...
...
@@ -25,12 +25,11 @@
use
type_of
::
LayoutLlvmExt
;
use
rustc
::
hir
;
use
rustc
::
mir
::
mono
::{
Linkage
,
Visibility
};
use
rustc
::
ty
::{
self
,
TyCtxt
,
TypeFoldable
};
use
rustc
::
ty
::{
TyCtxt
,
TypeFoldable
};
use
rustc
::
ty
::
layout
::
LayoutOf
;
use
syntax
::
ast
;
use
syntax
::
attr
;
use
syntax_pos
::
Span
;
use
syntax_pos
::
symbol
::
Symbol
;
use
std
::
fmt
;
pub
use
rustc
::
mir
::
mono
::
MonoItem
;
...
...
@@ -108,22 +107,6 @@ fn predefine(&self,
ccx
.codegen_unit
()
.name
());
}
fn
symbol_name
(
&
self
,
tcx
:
TyCtxt
<
'a
,
'tcx
,
'tcx
>
)
->
ty
::
SymbolName
{
match
*
self
.as_mono_item
()
{
MonoItem
::
Fn
(
instance
)
=>
tcx
.symbol_name
(
instance
),
MonoItem
::
Static
(
node_id
)
=>
{
let
def_id
=
tcx
.hir
.local_def_id
(
node_id
);
tcx
.symbol_name
(
Instance
::
mono
(
tcx
,
def_id
))
}
MonoItem
::
GlobalAsm
(
node_id
)
=>
{
let
def_id
=
tcx
.hir
.local_def_id
(
node_id
);
ty
::
SymbolName
{
name
:
Symbol
::
intern
(
&
format!
(
"global_asm_{:?}"
,
def_id
))
.as_str
()
}
}
}
}
fn
local_span
(
&
self
,
tcx
:
TyCtxt
<
'a
,
'tcx
,
'tcx
>
)
->
Option
<
Span
>
{
match
*
self
.as_mono_item
()
{
MonoItem
::
Fn
(
Instance
{
def
,
..
})
=>
{
...
...
@@ -136,16 +119,6 @@ fn local_span(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>) -> Option<Span> {
}
.map
(|
node_id
|
tcx
.hir
.span
(
node_id
))
}
fn
is_generic_fn
(
&
self
)
->
bool
{
match
*
self
.as_mono_item
()
{
MonoItem
::
Fn
(
ref
instance
)
=>
{
instance
.substs
.types
()
.next
()
.is_some
()
}
MonoItem
::
Static
(
..
)
|
MonoItem
::
GlobalAsm
(
..
)
=>
false
,
}
}
fn
to_raw_string
(
&
self
)
->
String
{
match
*
self
.as_mono_item
()
{
MonoItem
::
Fn
(
instance
)
=>
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录