Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
4787b7ca
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,发现更多精彩内容 >>
提交
4787b7ca
编写于
9月 06, 2018
作者:
D
Denis Merigoux
提交者:
Eduard-Mihai Burtescu
11月 16, 2018
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Removed phantomdata no longer necessary
Because CodegenContext doesn't implement Backend anymore
上级
a1d0d4f9
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
12 addition
and
22 deletion
+12
-22
src/librustc_codegen_llvm/back/lto.rs
src/librustc_codegen_llvm/back/lto.rs
+0
-2
src/librustc_codegen_llvm/back/write.rs
src/librustc_codegen_llvm/back/write.rs
+6
-11
src/librustc_codegen_llvm/lib.rs
src/librustc_codegen_llvm/lib.rs
+6
-9
未找到文件。
src/librustc_codegen_llvm/back/lto.rs
浏览文件 @
4787b7ca
...
...
@@ -26,7 +26,6 @@
use
rustc_codegen_utils
::
symbol_export
;
use
time_graph
::
Timeline
;
use
{
ModuleCodegen
,
ModuleLlvm
,
ModuleKind
};
use
std
::
marker
::
PhantomData
;
use
libc
;
...
...
@@ -768,7 +767,6 @@ unsafe fn optimize(&mut self, cgcx: &CodegenContext, timeline: &mut Timeline)
llmod_raw
,
llcx
,
tm
,
phantom
:
PhantomData
},
name
:
self
.name
()
.to_string
(),
kind
:
ModuleKind
::
Regular
,
...
...
src/librustc_codegen_llvm/back/write.rs
浏览文件 @
4787b7ca
...
...
@@ -49,7 +49,6 @@
use
common
;
use
jobserver
::{
Client
,
Acquired
};
use
rustc_demangle
;
use
std
::
marker
::
PhantomData
;
use
std
::
any
::
Any
;
use
std
::
ffi
::{
CString
,
CStr
};
...
...
@@ -352,7 +351,7 @@ struct AssemblerCommand {
/// Additional resources used by optimize_and_codegen (not module specific)
#[derive(Clone)]
pub
struct
CodegenContext
<
'll
>
{
pub
struct
CodegenContext
{
// Resources needed when running LTO
pub
time_passes
:
bool
,
pub
lto
:
Lto
,
...
...
@@ -393,13 +392,10 @@ pub struct CodegenContext<'ll> {
// measuring is disabled.
time_graph
:
Option
<
TimeGraph
>
,
// The assembler command if no_integrated_as option is enabled, None otherwise
assembler_cmd
:
Option
<
Arc
<
AssemblerCommand
>>
,
// This field is used to give a lifetime parameter to the struct so that it can implement
// the Backend trait.
phantom
:
PhantomData
<&
'll
()
>
assembler_cmd
:
Option
<
Arc
<
AssemblerCommand
>>
}
impl
CodegenContext
<
'll
>
{
impl
CodegenContext
{
pub
fn
create_diag_handler
(
&
self
)
->
Handler
{
Handler
::
with_emitter
(
true
,
false
,
Box
::
new
(
self
.diag_emitter
.clone
()))
}
...
...
@@ -428,12 +424,12 @@ pub(crate) fn save_temp_bitcode(&self, module: &ModuleCodegen, name: &str) {
}
pub
struct
DiagnosticHandlers
<
'a
>
{
data
:
*
mut
(
&
'a
CodegenContext
<
'a
>
,
&
'a
Handler
),
data
:
*
mut
(
&
'a
CodegenContext
,
&
'a
Handler
),
llcx
:
&
'a
llvm
::
Context
,
}
impl
<
'a
>
DiagnosticHandlers
<
'a
>
{
pub
fn
new
(
cgcx
:
&
'a
CodegenContext
<
'a
>
,
pub
fn
new
(
cgcx
:
&
'a
CodegenContext
,
handler
:
&
'a
Handler
,
llcx
:
&
'a
llvm
::
Context
)
->
Self
{
let
data
=
Box
::
into_raw
(
Box
::
new
((
cgcx
,
handler
)));
...
...
@@ -1618,7 +1614,6 @@ fn start_executing_work(tcx: TyCtxt,
target_pointer_width
:
tcx
.sess.target.target.target_pointer_width
.clone
(),
debuginfo
:
tcx
.sess.opts.debuginfo
,
assembler_cmd
,
phantom
:
PhantomData
};
// This is the "main loop" of parallel work happening for parallel codegen.
...
...
@@ -2113,7 +2108,7 @@ fn maybe_start_llvm_timer(config: &ModuleConfig,
const
LLVM_WORK_PACKAGE_KIND
:
time_graph
::
WorkPackageKind
=
time_graph
::
WorkPackageKind
(
&
[
"#7DB67A"
,
"#C6EEC4"
,
"#ACDAAA"
,
"#579354"
,
"#3E6F3C"
]);
fn
spawn_work
(
cgcx
:
CodegenContext
<
'static
>
,
work
:
WorkItem
)
{
fn
spawn_work
(
cgcx
:
CodegenContext
,
work
:
WorkItem
)
{
let
depth
=
time_depth
();
thread
::
spawn
(
move
||
{
...
...
src/librustc_codegen_llvm/lib.rs
浏览文件 @
4787b7ca
...
...
@@ -72,7 +72,6 @@
pub
use
llvm_util
::
target_features
;
use
std
::
any
::
Any
;
use
std
::
sync
::
mpsc
;
use
std
::
marker
::
PhantomData
;
use
rustc_data_structures
::
sync
::
Lrc
;
use
rustc
::
dep_graph
::
DepGraph
;
...
...
@@ -274,7 +273,7 @@ struct ModuleCodegen {
/// as the crate name and disambiguator.
/// We currently generate these names via CodegenUnit::build_cgu_name().
name
:
String
,
module_llvm
:
ModuleLlvm
<
'static
>
,
module_llvm
:
ModuleLlvm
,
kind
:
ModuleKind
,
}
...
...
@@ -316,17 +315,16 @@ fn into_compiled_module(self,
}
}
struct
ModuleLlvm
<
'll
>
{
struct
ModuleLlvm
{
llcx
:
&
'static
mut
llvm
::
Context
,
llmod_raw
:
*
const
llvm
::
Module
,
tm
:
&
'static
mut
llvm
::
TargetMachine
,
phantom
:
PhantomData
<&
'll
()
>
}
unsafe
impl
Send
for
ModuleLlvm
<
'll
>
{
}
unsafe
impl
Sync
for
ModuleLlvm
<
'll
>
{
}
unsafe
impl
Send
for
ModuleLlvm
{
}
unsafe
impl
Sync
for
ModuleLlvm
{
}
impl
ModuleLlvm
<
'll
>
{
impl
ModuleLlvm
{
fn
new
(
sess
:
&
Session
,
mod_name
:
&
str
)
->
Self
{
unsafe
{
let
llcx
=
llvm
::
LLVMRustContextCreate
(
sess
.fewer_names
());
...
...
@@ -336,7 +334,6 @@ fn new(sess: &Session, mod_name: &str) -> Self {
llmod_raw
,
llcx
,
tm
:
create_target_machine
(
sess
,
false
),
phantom
:
PhantomData
}
}
}
...
...
@@ -348,7 +345,7 @@ fn llmod(&self) -> &llvm::Module {
}
}
impl
Drop
for
ModuleLlvm
<
'll
>
{
impl
Drop
for
ModuleLlvm
{
fn
drop
(
&
mut
self
)
{
unsafe
{
llvm
::
LLVMContextDispose
(
&
mut
*
(
self
.llcx
as
*
mut
_
));
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录