Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
0a1c5095
R
Rust
项目概览
int
/
Rust
11 个月 前同步成功
通知
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,发现更多精彩内容 >>
提交
0a1c5095
编写于
9月 11, 2018
作者:
D
Denis Merigoux
提交者:
Eduard-Mihai Burtescu
11月 16, 2018
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Traitified IntrinsicCallMethods
上级
a5aeb8ed
变更
11
展开全部
隐藏空白更改
内联
并排
Showing
11 changed file
with
648 addition
and
624 deletion
+648
-624
src/librustc_codegen_llvm/base.rs
src/librustc_codegen_llvm/base.rs
+1
-3
src/librustc_codegen_llvm/builder.rs
src/librustc_codegen_llvm/builder.rs
+3
-11
src/librustc_codegen_llvm/context.rs
src/librustc_codegen_llvm/context.rs
+2
-7
src/librustc_codegen_llvm/interfaces/builder.rs
src/librustc_codegen_llvm/interfaces/builder.rs
+12
-4
src/librustc_codegen_llvm/interfaces/intrinsic.rs
src/librustc_codegen_llvm/interfaces/intrinsic.rs
+15
-5
src/librustc_codegen_llvm/interfaces/mod.rs
src/librustc_codegen_llvm/interfaces/mod.rs
+2
-2
src/librustc_codegen_llvm/intrinsic.rs
src/librustc_codegen_llvm/intrinsic.rs
+607
-578
src/librustc_codegen_llvm/mir/block.rs
src/librustc_codegen_llvm/mir/block.rs
+3
-8
src/librustc_codegen_llvm/mir/operand.rs
src/librustc_codegen_llvm/mir/operand.rs
+1
-1
src/librustc_codegen_llvm/mir/place.rs
src/librustc_codegen_llvm/mir/place.rs
+1
-4
src/librustc_codegen_llvm/mir/rvalue.rs
src/librustc_codegen_llvm/mir/rvalue.rs
+1
-1
未找到文件。
src/librustc_codegen_llvm/base.rs
浏览文件 @
0a1c5095
...
...
@@ -73,9 +73,7 @@
use
rustc_data_structures
::
sync
::
Lrc
;
use
rustc_data_structures
::
indexed_vec
::
Idx
;
use
interfaces
::{
BuilderMethods
,
ConstMethods
,
BaseTypeMethods
,
DerivedTypeMethods
,
DerivedIntrinsicMethods
,
};
use
interfaces
::
*
;
use
std
::
any
::
Any
;
use
std
::
cmp
;
...
...
src/librustc_codegen_llvm/builder.rs
浏览文件 @
0a1c5095
...
...
@@ -19,10 +19,7 @@
use
rustc
::
ty
::
layout
::{
Align
,
Size
};
use
rustc
::
session
::{
config
,
Session
};
use
rustc_data_structures
::
small_c_str
::
SmallCStr
;
use
interfaces
::{
Backend
,
BuilderMethods
,
ConstMethods
,
BaseTypeMethods
,
DerivedTypeMethods
,
DerivedIntrinsicMethods
,
};
use
interfaces
::
*
;
use
syntax
;
use
std
::
borrow
::
Cow
;
...
...
@@ -59,16 +56,11 @@ pub struct MemFlags: u8 {
}
}
impl
Backend
for
Builder
<
'a
,
'll
,
'tcx
>
{
type
Value
=
&
'll
Value
;
type
BasicBlock
=
&
'll
BasicBlock
;
type
Type
=
&
'll
Type
;
type
Context
=
&
'll
llvm
::
Context
;
impl
HasCodegen
for
Builder
<
'a
,
'll
,
'tcx
>
{
type
CodegenCx
=
CodegenCx
<
'll
,
'tcx
>
;
}
impl
BuilderMethods
<
'a
,
'tcx
>
for
Builder
<
'a
,
'll
,
'tcx
>
{
type
CodegenCx
=
CodegenCx
<
'll
,
'tcx
>
;
fn
new_block
<
'b
>
(
cx
:
&
'a
CodegenCx
<
'll
,
'tcx
>
,
llfn
:
&
'll
Value
,
...
...
src/librustc_codegen_llvm/context.rs
浏览文件 @
0a1c5095
...
...
@@ -23,8 +23,7 @@
use
monomorphize
::
partitioning
::
CodegenUnit
;
use
type_
::
Type
;
use
type_of
::
PointeeInfo
;
use
interfaces
::{
BaseTypeMethods
,
DerivedTypeMethods
,
IntrinsicMethods
,
BaseIntrinsicMethods
,
DerivedIntrinsicMethods
};
use
interfaces
::{
BaseTypeMethods
,
DerivedTypeMethods
,
IntrinsicDeclarationMethods
};
use
rustc_data_structures
::
base_n
;
use
rustc_data_structures
::
small_c_str
::
SmallCStr
;
...
...
@@ -323,9 +322,7 @@ pub fn sess<'a>(&'a self) -> &'a Session {
}
}
impl
BaseIntrinsicMethods
for
CodegenCx
<
'_
,
'_
>
{}
impl
DerivedIntrinsicMethods
for
CodegenCx
<
'b
,
'tcx
>
{
impl
IntrinsicDeclarationMethods
for
CodegenCx
<
'b
,
'tcx
>
{
fn
get_intrinsic
(
&
self
,
key
:
&
str
)
->
&
'b
Value
{
if
let
Some
(
v
)
=
self
.intrinsics
.borrow
()
.get
(
key
)
.cloned
()
{
return
v
;
...
...
@@ -647,8 +644,6 @@ fn declare_intrinsic(
}
}
impl
IntrinsicMethods
for
CodegenCx
<
'a
,
'tcx
>
{}
impl
<
'b
,
'tcx
>
CodegenCx
<
'b
,
'tcx
>
{
/// Generate a new symbol name with the given prefix. This symbol name must
/// only be used for definitions with `internal` or `private` linkage.
...
...
src/librustc_codegen_llvm/interfaces/builder.rs
浏览文件 @
0a1c5095
...
...
@@ -17,21 +17,29 @@
use
super
::
backend
::
Backend
;
use
super
::
type_
::
TypeMethods
;
use
super
::
consts
::
ConstMethods
;
use
super
::
intrinsic
::
IntrinsicMethods
;
use
super
::
intrinsic
::
Intrinsic
Declaration
Methods
;
use
std
::
borrow
::
Cow
;
use
std
::
ops
::
Range
;
use
syntax
::
ast
::
AsmDialect
;
pub
trait
BuilderMethods
<
'a
,
'tcx
:
'a
>
:
Backend
{
type
CodegenCx
:
'a
+
TypeMethods
+
ConstMethods
+
IntrinsicMethods
+
Backend
<
pub
trait
HasCodegen
:
Backend
{
type
CodegenCx
:
TypeMethods
+
ConstMethods
+
IntrinsicDeclarationMethods
+
Backend
<
Value
=
Self
::
Value
,
BasicBlock
=
Self
::
BasicBlock
,
Type
=
Self
::
Type
,
Context
=
Self
::
Context
,
>
;
}
impl
<
T
:
HasCodegen
>
Backend
for
T
{
type
Value
=
<
T
::
CodegenCx
as
Backend
>
::
Value
;
type
BasicBlock
=
<
T
::
CodegenCx
as
Backend
>
::
BasicBlock
;
type
Type
=
<
T
::
CodegenCx
as
Backend
>
::
Type
;
type
Context
=
<
T
::
CodegenCx
as
Backend
>
::
Context
;
}
pub
trait
BuilderMethods
<
'a
,
'tcx
:
'a
>
:
HasCodegen
{
fn
new_block
<
'b
>
(
cx
:
&
'a
Self
::
CodegenCx
,
llfn
:
Self
::
Value
,
...
...
src/librustc_codegen_llvm/interfaces/intrinsic.rs
浏览文件 @
0a1c5095
...
...
@@ -9,17 +9,27 @@
// except according to those terms.
use
super
::
backend
::
Backend
;
use
super
::
builder
::
HasCodegen
;
use
mir
::
operand
::
OperandRef
;
use
rustc
::
ty
::
Ty
;
use
abi
::
FnType
;
use
syntax_pos
::
Span
;
pub
trait
BaseIntrinsicMethods
:
Backend
{
pub
trait
IntrinsicCallMethods
<
'a
,
'tcx
:
'a
>
:
HasCodegen
{
fn
codegen_intrinsic_call
(
&
self
,
callee_ty
:
Ty
<
'tcx
>
,
fn_ty
:
&
FnType
<
'tcx
,
Ty
<
'tcx
>>
,
args
:
&
[
OperandRef
<
'tcx
,
Self
::
Value
>
],
llresult
:
Self
::
Value
,
span
:
Span
,
);
}
pub
trait
DerivedIntrinsic
Methods
:
Backend
{
pub
trait
IntrinsicDeclaration
Methods
:
Backend
{
fn
get_intrinsic
(
&
self
,
key
:
&
str
)
->
Self
::
Value
;
fn
declare_intrinsic
(
&
self
,
key
:
&
str
)
->
Option
<
Self
::
Value
>
;
}
pub
trait
IntrinsicMethods
:
BaseIntrinsicMethods
+
DerivedIntrinsicMethods
{}
src/librustc_codegen_llvm/interfaces/mod.rs
浏览文件 @
0a1c5095
...
...
@@ -15,9 +15,9 @@
mod
intrinsic
;
mod
statics
;
pub
use
self
::
builder
::
BuilderMethods
;
pub
use
self
::
builder
::
{
BuilderMethods
,
HasCodegen
}
;
pub
use
self
::
backend
::
Backend
;
pub
use
self
::
consts
::
ConstMethods
;
pub
use
self
::
type_
::{
TypeMethods
,
BaseTypeMethods
,
DerivedTypeMethods
};
pub
use
self
::
intrinsic
::{
Intrinsic
Methods
,
BaseIntrinsicMethods
,
DerivedIntrinsic
Methods
};
pub
use
self
::
intrinsic
::{
Intrinsic
CallMethods
,
IntrinsicDeclaration
Methods
};
pub
use
self
::
statics
::
StaticMethods
;
src/librustc_codegen_llvm/intrinsic.rs
浏览文件 @
0a1c5095
此差异已折叠。
点击以展开。
src/librustc_codegen_llvm/mir/block.rs
浏览文件 @
0a1c5095
...
...
@@ -25,10 +25,7 @@
use
type_
::
Type
;
use
value
::
Value
;
use
interfaces
::{
BuilderMethods
,
ConstMethods
,
BaseTypeMethods
,
DerivedTypeMethods
,
DerivedIntrinsicMethods
,
StaticMethods
,
};
use
interfaces
::
*
;
use
syntax
::
symbol
::
Symbol
;
use
syntax_pos
::
Pos
;
...
...
@@ -560,8 +557,6 @@ fn codegen_terminator(&mut self,
};
if
intrinsic
.is_some
()
&&
intrinsic
!=
Some
(
"drop_in_place"
)
{
use
intrinsic
::
codegen_intrinsic_call
;
let
dest
=
match
ret_dest
{
_
if
fn_ty
.ret
.is_indirect
()
=>
llargs
[
0
],
ReturnDest
::
Nothing
=>
{
...
...
@@ -628,8 +623,8 @@ fn codegen_terminator(&mut self,
let
callee_ty
=
instance
.as_ref
()
.unwrap
()
.ty
(
bx
.cx
()
.tcx
);
codegen_intrinsic_call
(
&
bx
,
callee_ty
,
&
fn_ty
,
&
args
,
dest
,
terminator
.source_info.span
);
&
bx
.codegen_intrinsic_call
(
callee_ty
,
&
fn_ty
,
&
args
,
dest
,
terminator
.source_info.span
);
if
let
ReturnDest
::
IndirectOperand
(
dst
,
_
)
=
ret_dest
{
self
.store_return
(
&
bx
,
ret_dest
,
&
fn_ty
.ret
,
dst
.llval
);
...
...
src/librustc_codegen_llvm/mir/operand.rs
浏览文件 @
0a1c5095
...
...
@@ -20,7 +20,7 @@
use
type_of
::
LayoutLlvmExt
;
use
glue
;
use
interfaces
::{
BuilderMethods
,
ConstMethods
,
BaseTypeMethods
,
DerivedIntrinsic
Methods
};
use
interfaces
::{
BuilderMethods
,
ConstMethods
,
BaseTypeMethods
,
IntrinsicDeclaration
Methods
};
use
std
::
fmt
;
...
...
src/librustc_codegen_llvm/mir/place.rs
浏览文件 @
0a1c5095
...
...
@@ -21,10 +21,7 @@
use
glue
;
use
mir
::
constant
::
const_alloc_to_llvm
;
use
interfaces
::{
BuilderMethods
,
ConstMethods
,
BaseTypeMethods
,
DerivedTypeMethods
,
DerivedIntrinsicMethods
,
StaticMethods
,
};
use
interfaces
::
*
;
use
super
::{
FunctionCx
,
LocalRef
};
use
super
::
operand
::{
OperandRef
,
OperandValue
};
...
...
src/librustc_codegen_llvm/mir/rvalue.rs
浏览文件 @
0a1c5095
...
...
@@ -25,7 +25,7 @@
use
type_of
::
LayoutLlvmExt
;
use
value
::
Value
;
use
interfaces
::{
BuilderMethods
,
ConstMethods
,
BaseTypeMethods
,
DerivedIntrinsic
Methods
};
use
interfaces
::{
BuilderMethods
,
ConstMethods
,
BaseTypeMethods
,
IntrinsicDeclaration
Methods
};
use
super
::{
FunctionCx
,
LocalRef
};
use
super
::
operand
::{
OperandRef
,
OperandValue
};
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录