Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
3c07b461
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,发现更多精彩内容 >>
提交
3c07b461
编写于
10月 21, 2015
作者:
N
Niko Matsakis
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Pass the mir map to trans
上级
15c1da4e
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
38 addition
and
18 deletion
+38
-18
mk/crates.mk
mk/crates.mk
+1
-1
src/librustc_driver/driver.rs
src/librustc_driver/driver.rs
+16
-11
src/librustc_driver/pretty.rs
src/librustc_driver/pretty.rs
+2
-2
src/librustc_trans/lib.rs
src/librustc_trans/lib.rs
+2
-0
src/librustc_trans/trans/base.rs
src/librustc_trans/trans/base.rs
+6
-1
src/librustc_trans/trans/context.rs
src/librustc_trans/trans/context.rs
+8
-0
src/librustdoc/core.rs
src/librustdoc/core.rs
+1
-1
src/test/run-make/execution-engine/test.rs
src/test/run-make/execution-engine/test.rs
+2
-2
未找到文件。
mk/crates.mk
浏览文件 @
3c07b461
...
...
@@ -103,7 +103,7 @@ DEPS_rustc_mir := rustc rustc_front syntax
DEPS_rustc_resolve
:=
rustc rustc_front log syntax
DEPS_rustc_platform_intrinsics
:=
rustc rustc_llvm
DEPS_rustc_privacy
:=
rustc rustc_front log syntax
DEPS_rustc_trans
:=
arena flate
getopts
graphviz libc rustc rustc_back
\
DEPS_rustc_trans
:=
arena flate
getopts
graphviz libc rustc rustc_back
rustc_mir
\
log syntax serialize rustc_llvm rustc_front rustc_platform_intrinsics
DEPS_rustc_typeck
:=
rustc syntax rustc_front rustc_platform_intrinsics
...
...
src/librustc_driver/driver.rs
浏览文件 @
3c07b461
...
...
@@ -11,6 +11,7 @@
use
rustc
::
front
;
use
rustc
::
front
::
map
as
hir_map
;
use
rustc_mir
as
mir
;
use
rustc_mir
::
mir_map
::
MirMap
;
use
rustc
::
session
::
Session
;
use
rustc
::
session
::
config
::{
self
,
Input
,
OutputFilenames
,
OutputType
};
use
rustc
::
session
::
search_paths
::
PathKind
;
...
...
@@ -22,6 +23,7 @@
use
rustc
::
middle
;
use
rustc
::
plugin
::
registry
::
Registry
;
use
rustc
::
plugin
;
use
rustc
::
util
::
nodemap
::
NodeMap
;
use
rustc
::
util
::
common
::
time
;
use
rustc_borrowck
as
borrowck
;
use
rustc_resolve
as
resolve
;
...
...
@@ -146,7 +148,7 @@ pub fn compile_input(sess: Session,
&
arenas
,
&
id
,
control
.make_glob_map
,
|
tcx
,
analysis
|
{
|
tcx
,
mir_map
,
analysis
|
{
{
let
state
=
CompileState
::
state_after_analysis
(
input
,
...
...
@@ -170,7 +172,7 @@ pub fn compile_input(sess: Session,
println!
(
"Pre-trans"
);
tcx
.print_debug_stats
();
}
let
trans
=
phase_4_translate_to_llvm
(
tcx
,
analysis
);
let
trans
=
phase_4_translate_to_llvm
(
tcx
,
&
mir_map
,
analysis
);
if
log_enabled!
(::
log
::
INFO
)
{
println!
(
"Post-trans"
);
...
...
@@ -670,6 +672,7 @@ pub fn phase_3_run_analysis_passes<'tcx, F, R>(sess: &'tcx Session,
f
:
F
)
->
R
where
F
:
for
<
'a
>
FnOnce
(
&
'a
ty
::
ctxt
<
'tcx
>
,
MirMap
<
'tcx
>
,
ty
::
CrateAnalysis
)
->
R
{
let
time_passes
=
sess
.time_passes
();
...
...
@@ -751,18 +754,18 @@ pub fn phase_3_run_analysis_passes<'tcx, F, R>(sess: &'tcx Session,
time
(
time_passes
,
"match checking"
,
||
middle
::
check_match
::
check_crate
(
tcx
));
match
tcx
.sess.opts.unstable_features
{
let
mir_map
=
match
tcx
.sess.opts.unstable_features
{
UnstableFeatures
::
Disallow
=>
{
// use this as a shorthand for beta/stable, and skip
// MIR construction there until known regressions are
// addressed
NodeMap
()
}
UnstableFeatures
::
Allow
|
UnstableFeatures
::
Cheat
=>
{
let
_
mir_map
=
time
(
time_passes
,
"MIR dump"
,
||
mir
::
mir_map
::
build_mir_for_crate
(
tcx
));
time
(
time_passes
,
"MIR dump"
,
||
mir
::
mir_map
::
build_mir_for_crate
(
tcx
))
}
}
}
;
time
(
time_passes
,
"liveness checking"
,
||
middle
::
liveness
::
check_crate
(
tcx
));
...
...
@@ -804,7 +807,7 @@ pub fn phase_3_run_analysis_passes<'tcx, F, R>(sess: &'tcx Session,
// The above three passes generate errors w/o aborting
tcx
.sess
.abort_if_errors
();
f
(
tcx
,
ty
::
CrateAnalysis
{
f
(
tcx
,
mir_map
,
ty
::
CrateAnalysis
{
export_map
:
export_map
,
exported_items
:
exported_items
,
public_items
:
public_items
,
...
...
@@ -817,8 +820,10 @@ pub fn phase_3_run_analysis_passes<'tcx, F, R>(sess: &'tcx Session,
/// Run the translation phase to LLVM, after which the AST and analysis can
/// be discarded.
pub
fn
phase_4_translate_to_llvm
(
tcx
:
&
ty
::
ctxt
,
analysis
:
ty
::
CrateAnalysis
)
->
trans
::
CrateTranslation
{
pub
fn
phase_4_translate_to_llvm
<
'tcx
>
(
tcx
:
&
ty
::
ctxt
<
'tcx
>
,
mir_map
:
&
MirMap
<
'tcx
>
,
analysis
:
ty
::
CrateAnalysis
)
->
trans
::
CrateTranslation
{
let
time_passes
=
tcx
.sess
.time_passes
();
time
(
time_passes
,
"resolving dependency formats"
,
||
...
...
@@ -826,7 +831,7 @@ pub fn phase_4_translate_to_llvm(tcx: &ty::ctxt, analysis: ty::CrateAnalysis)
// Option dance to work around the lack of stack once closures.
time
(
time_passes
,
"translation"
,
move
||
trans
::
trans_crate
(
tcx
,
analysis
))
trans
::
trans_crate
(
tcx
,
mir_map
,
analysis
))
}
/// Run LLVM itself, producing a bitcode file, assembly file or object file
...
...
src/librustc_driver/pretty.rs
浏览文件 @
3c07b461
...
...
@@ -182,7 +182,7 @@ fn call_with_pp_support_hir<'tcx, A, B, F>(&self,
arenas
,
id
,
resolve
::
MakeGlobMap
::
No
,
|
tcx
,
_
|
{
|
tcx
,
_
,
_
|
{
let
annotation
=
TypedAnnotation
{
tcx
:
tcx
};
f
(
&
annotation
,
payload
,
&
ast_map
.forest.krate
)
})
...
...
@@ -782,7 +782,7 @@ pub fn pretty_print_input(sess: Session,
&
arenas
,
&
id
,
resolve
::
MakeGlobMap
::
No
,
|
tcx
,
_
|
{
|
tcx
,
_
,
_
|
{
print_flowgraph
(
variants
,
tcx
,
code
,
mode
,
out
)
})
}
...
...
src/librustc_trans/lib.rs
浏览文件 @
3c07b461
...
...
@@ -37,6 +37,7 @@
#![feature(quote)]
#![feature(rustc_diagnostic_macros)]
#![feature(rustc_private)]
#![feature(slice_patterns)]
#![feature(staged_api)]
#![feature(unicode)]
#![feature(vec_push_all)]
...
...
@@ -52,6 +53,7 @@
extern
crate
rustc_back
;
extern
crate
rustc_front
;
extern
crate
rustc_llvm
as
llvm
;
extern
crate
rustc_mir
;
extern
crate
rustc_platform_intrinsics
as
intrinsics
;
extern
crate
serialize
;
...
...
src/librustc_trans/trans/base.rs
浏览文件 @
3c07b461
...
...
@@ -44,6 +44,7 @@
use
middle
::
subst
::
Substs
;
use
middle
::
ty
::{
self
,
Ty
,
HasTypeFlags
};
use
rustc
::
front
::
map
as
hir_map
;
use
rustc_mir
::
mir_map
::
MirMap
;
use
session
::
config
::{
self
,
NoDebugInfo
,
FullDebugInfo
};
use
session
::
Session
;
use
trans
::
_
match
;
...
...
@@ -2737,7 +2738,10 @@ pub fn filter_reachable_ids(ccx: &SharedCrateContext) -> NodeSet {
})
.collect
()
}
pub
fn
trans_crate
(
tcx
:
&
ty
::
ctxt
,
analysis
:
ty
::
CrateAnalysis
)
->
CrateTranslation
{
pub
fn
trans_crate
<
'tcx
>
(
tcx
:
&
ty
::
ctxt
<
'tcx
>
,
mir_map
:
&
MirMap
<
'tcx
>
,
analysis
:
ty
::
CrateAnalysis
)
->
CrateTranslation
{
let
ty
::
CrateAnalysis
{
export_map
,
reachable
,
name
,
..
}
=
analysis
;
let
krate
=
tcx
.map
.krate
();
...
...
@@ -2779,6 +2783,7 @@ pub fn trans_crate(tcx: &ty::ctxt, analysis: ty::CrateAnalysis) -> CrateTranslat
let
shared_ccx
=
SharedCrateContext
::
new
(
&
link_meta
.crate_name
,
codegen_units
,
tcx
,
&
mir_map
,
export_map
,
Sha256
::
new
(),
link_meta
.clone
(),
...
...
src/librustc_trans/trans/context.rs
浏览文件 @
3c07b461
...
...
@@ -14,6 +14,7 @@
use
middle
::
def
::
ExportMap
;
use
middle
::
def_id
::
DefId
;
use
middle
::
traits
;
use
rustc_mir
::
mir_map
::
MirMap
;
use
trans
::
adt
;
use
trans
::
base
;
use
trans
::
builder
::
Builder
;
...
...
@@ -70,6 +71,7 @@ pub struct SharedCrateContext<'a, 'tcx: 'a> {
stats
:
Stats
,
check_overflow
:
bool
,
check_drop_flag_for_sanity
:
bool
,
mir_map
:
&
'a
MirMap
<
'tcx
>
,
available_drop_glues
:
RefCell
<
FnvHashMap
<
DropGlueKind
<
'tcx
>
,
String
>>
,
use_dll_storage_attrs
:
bool
,
...
...
@@ -251,6 +253,7 @@ impl<'b, 'tcx> SharedCrateContext<'b, 'tcx> {
pub
fn
new
(
crate_name
:
&
str
,
local_count
:
usize
,
tcx
:
&
'b
ty
::
ctxt
<
'tcx
>
,
mir_map
:
&
'b
MirMap
<
'tcx
>
,
export_map
:
ExportMap
,
symbol_hasher
:
Sha256
,
link_meta
:
LinkMeta
,
...
...
@@ -317,6 +320,7 @@ pub fn new(crate_name: &str,
link_meta
:
link_meta
,
symbol_hasher
:
RefCell
::
new
(
symbol_hasher
),
tcx
:
tcx
,
mir_map
:
mir_map
,
stats
:
Stats
{
n_glues_created
:
Cell
::
new
(
0
),
n_null_glues
:
Cell
::
new
(
0
),
...
...
@@ -803,6 +807,10 @@ pub fn check_drop_flag_for_sanity(&self) -> bool {
pub
fn
use_dll_storage_attrs
(
&
self
)
->
bool
{
self
.shared
.use_dll_storage_attrs
()
}
pub
fn
mir_map
(
&
self
)
->
&
'b
MirMap
<
'tcx
>
{
self
.shared.mir_map
}
}
pub
struct
TypeOfDepthLock
<
'a
,
'tcx
:
'a
>
(
&
'a
LocalCrateContext
<
'tcx
>
);
...
...
src/librustdoc/core.rs
浏览文件 @
3c07b461
...
...
@@ -145,7 +145,7 @@ pub fn run_core(search_paths: SearchPaths, cfgs: Vec<String>, externs: Externs,
&
arenas
,
&
name
,
resolve
::
MakeGlobMap
::
No
,
|
tcx
,
analysis
|
{
|
tcx
,
_
,
analysis
|
{
let
ty
::
CrateAnalysis
{
exported_items
,
public_items
,
..
}
=
analysis
;
// Convert from a NodeId set to a DefId set since we don't always have easy access
...
...
src/test/run-make/execution-engine/test.rs
浏览文件 @
3c07b461
...
...
@@ -229,9 +229,9 @@ fn compile_program(input: &str, sysroot: PathBuf)
let
ast_map
=
driver
::
make_map
(
&
sess
,
&
mut
hir_forest
);
driver
::
phase_3_run_analysis_passes
(
&
sess
,
ast_map
,
&
arenas
,
&
id
,
MakeGlobMap
::
No
,
|
tcx
,
analysis
|
{
&
sess
,
ast_map
,
&
arenas
,
&
id
,
MakeGlobMap
::
No
,
|
tcx
,
mir_map
,
analysis
|
{
let
trans
=
driver
::
phase_4_translate_to_llvm
(
tcx
,
analysis
);
let
trans
=
driver
::
phase_4_translate_to_llvm
(
tcx
,
&
mir_map
,
analysis
);
let
crates
=
tcx
.sess.cstore
.get_used_crates
(
RequireDynamic
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录