Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
4ba09ab8
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,发现更多精彩内容 >>
提交
4ba09ab8
编写于
9月 27, 2018
作者:
D
Denis Merigoux
提交者:
Eduard-Mihai Burtescu
11月 16, 2018
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Added compile codegen to backend trait
上级
6819e6e6
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
18 addition
and
30 deletion
+18
-30
src/librustc_codegen_llvm/base.rs
src/librustc_codegen_llvm/base.rs
+5
-4
src/librustc_codegen_llvm/interfaces/backend.rs
src/librustc_codegen_llvm/interfaces/backend.rs
+6
-12
src/librustc_codegen_llvm/interfaces/mod.rs
src/librustc_codegen_llvm/interfaces/mod.rs
+1
-1
src/librustc_codegen_llvm/lib.rs
src/librustc_codegen_llvm/lib.rs
+6
-13
未找到文件。
src/librustc_codegen_llvm/base.rs
浏览文件 @
4ba09ab8
...
...
@@ -56,6 +56,7 @@
use
common
::{
self
,
IntPredicate
,
RealPredicate
,
TypeKind
};
use
meth
;
use
mir
;
use
context
::
CodegenCx
;
use
monomorphize
::
Instance
;
use
monomorphize
::
partitioning
::{
CodegenUnit
,
CodegenUnitExt
};
use
rustc_codegen_utils
::
symbol_names_test
;
...
...
@@ -712,7 +713,7 @@ fn determine_cgu_reuse<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
}
}
pub
fn
codegen_crate
<
'a
,
'tcx
,
B
:
BackendMethods
>
(
pub
fn
codegen_crate
<
B
:
BackendMethods
>
(
backend
:
B
,
tcx
:
TyCtxt
<
'a
,
'tcx
,
'tcx
>
,
rx
:
mpsc
::
Receiver
<
Box
<
dyn
Any
+
Send
>>
...
...
@@ -858,7 +859,7 @@ pub fn codegen_crate<'a, 'tcx, B: BackendMethods>(
&
format!
(
"codegen {}"
,
cgu
.name
()))
});
let
start_time
=
Instant
::
now
();
let
stats
=
compile_codegen_unit
(
tcx
,
*
cgu
.name
());
let
stats
=
backend
.
compile_codegen_unit
(
tcx
,
*
cgu
.name
());
all_stats
.extend
(
stats
);
total_codegen_time
+=
start_time
.elapsed
();
false
...
...
@@ -1066,7 +1067,7 @@ fn load_wasm_imports(&mut self, tcx: TyCtxt, cnum: CrateNum) {
}
}
fn
compile_codegen_unit
<
'll
,
'tcx
>
(
tcx
:
TyCtxt
<
'll
,
'tcx
,
'tcx
>
,
pub
fn
compile_codegen_unit
<
'll
,
'tcx
>
(
tcx
:
TyCtxt
<
'll
,
'tcx
,
'tcx
>
,
cgu_name
:
InternedString
)
->
Stats
{
let
start_time
=
Instant
::
now
();
...
...
@@ -1098,7 +1099,7 @@ fn module_codegen<'ll, 'tcx>(
// Instantiate monomorphizations without filling out definitions yet...
let
llvm_module
=
backend
.new_metadata
(
tcx
.sess
,
&
cgu_name
.as_str
());
let
stats
=
{
let
cx
=
backend
.new_codegen_context
(
tcx
,
cgu
,
&
llvm_module
);
let
cx
=
CodegenCx
::
new
(
tcx
,
cgu
,
&
llvm_module
);
let
mono_items
=
cx
.codegen_unit
.items_in_deterministic_order
(
cx
.tcx
);
for
&
(
mono_item
,
(
linkage
,
visibility
))
in
&
mono_items
{
...
...
src/librustc_codegen_llvm/interfaces/backend.rs
浏览文件 @
4ba09ab8
...
...
@@ -11,15 +11,15 @@
use
rustc
::
ty
::
layout
::{
HasTyCtxt
,
LayoutOf
,
TyLayout
};
use
rustc
::
ty
::
Ty
;
use
super
::{
CodegenMethods
,
CodegenObject
};
use
monomorphize
::
partitioning
::
CodegenUnit
;
use
super
::
CodegenObject
;
use
rustc
::
middle
::
allocator
::
AllocatorKind
;
use
rustc
::
middle
::
cstore
::
EncodedMetadata
;
use
rustc
::
mir
::
mono
::
Stats
;
use
rustc
::
session
::
Session
;
use
rustc
::
ty
::
TyCtxt
;
use
std
::
any
::
Any
;
use
std
::
sync
::
mpsc
::
Receiver
;
use
s
td
::
sync
::
Arc
;
use
s
yntax_pos
::
symbol
::
InternedString
;
use
time_graph
::
TimeGraph
;
use
ModuleCodegen
;
...
...
@@ -71,15 +71,9 @@ fn submit_pre_codegened_module_to_llvm(
fn
codegen_finished
(
&
self
,
codegen
:
&
Self
::
OngoingCodegen
,
tcx
:
TyCtxt
);
fn
check_for_errors
(
&
self
,
codegen
:
&
Self
::
OngoingCodegen
,
sess
:
&
Session
);
fn
wait_for_signal_to_codegen_item
(
&
self
,
codegen
:
&
Self
::
OngoingCodegen
);
}
pub
trait
BackendCodegenCxMethods
<
'a
,
'tcx
:
'a
>
:
BackendMethods
{
type
CodegenCx
:
CodegenMethods
<
'tcx
>
;
fn
new_codegen_context
(
fn
compile_codegen_unit
<
'a
,
'tcx
:
'a
>
(
&
self
,
tcx
:
TyCtxt
<
'a
,
'tcx
,
'tcx
>
,
codegen_unit
:
Arc
<
CodegenUnit
<
'tcx
>>
,
llvm_module
:
&
'a
Self
::
Module
,
)
->
Self
::
CodegenCx
;
cgu_name
:
InternedString
,
)
->
Stats
;
}
src/librustc_codegen_llvm/interfaces/mod.rs
浏览文件 @
4ba09ab8
...
...
@@ -22,7 +22,7 @@
pub
use
self
::
abi
::{
AbiBuilderMethods
,
AbiMethods
};
pub
use
self
::
asm
::{
AsmBuilderMethods
,
AsmMethods
};
pub
use
self
::
backend
::{
Backend
,
Backend
CodegenCxMethods
,
Backend
Methods
,
BackendTypes
};
pub
use
self
::
backend
::{
Backend
,
BackendMethods
,
BackendTypes
};
pub
use
self
::
builder
::
BuilderMethods
;
pub
use
self
::
consts
::
ConstMethods
;
pub
use
self
::
debuginfo
::{
DebugInfoBuilderMethods
,
DebugInfoMethods
};
...
...
src/librustc_codegen_llvm/lib.rs
浏览文件 @
4ba09ab8
...
...
@@ -72,12 +72,11 @@
use
time_graph
::
TimeGraph
;
use
std
::
sync
::
mpsc
::
Receiver
;
use
back
::
write
::{
self
,
OngoingCodegen
};
use
context
::
CodegenCx
;
use
monomorphize
::
partitioning
::
CodegenUnit
;
use
syntax_pos
::
symbol
::
InternedString
;
use
rustc
::
mir
::
mono
::
Stats
;
pub
use
llvm_util
::
target_features
;
use
std
::
any
::
Any
;
use
std
::
sync
::
Arc
;
use
std
::
sync
::
mpsc
;
use
rustc_data_structures
::
sync
::
Lrc
;
...
...
@@ -188,18 +187,12 @@ fn codegen_allocator(&self, tcx: TyCtxt, mods: &ModuleLlvm, kind: AllocatorKind)
fn
wait_for_signal_to_codegen_item
(
&
self
,
codegen
:
&
OngoingCodegen
)
{
codegen
.wait_for_signal_to_codegen_item
()
}
}
impl
<
'a
,
'tcx
:
'a
>
BackendCodegenCxMethods
<
'a
,
'tcx
>
for
LlvmCodegenBackend
{
type
CodegenCx
=
CodegenCx
<
'a
,
'tcx
>
;
fn
new_codegen_context
(
fn
compile_codegen_unit
<
'a
,
'tcx
:
'a
>
(
&
self
,
tcx
:
TyCtxt
<
'a
,
'tcx
,
'tcx
>
,
codegen_unit
:
Arc
<
CodegenUnit
<
'tcx
>>
,
llvm_module
:
&
'a
ModuleLlvm
)
->
CodegenCx
<
'a
,
'tcx
>
{
CodegenCx
::
new
(
tcx
,
codegen_unit
,
llvm_module
)
cgu_name
:
InternedString
,
)
->
Stats
{
base
::
compile_codegen_unit
(
tcx
,
cgu_name
)
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录