Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
3aee7727
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,发现更多精彩内容 >>
提交
3aee7727
编写于
8月 29, 2018
作者:
D
Denis Merigoux
提交者:
Eduard-Mihai Burtescu
11月 16, 2018
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Split CommonMethods to accomodate for use in back/write.rs
上级
83e07f9f
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
29 addition
and
24 deletion
+29
-24
src/librustc_codegen_llvm/back/write.rs
src/librustc_codegen_llvm/back/write.rs
+1
-1
src/librustc_codegen_llvm/base.rs
src/librustc_codegen_llvm/base.rs
+1
-1
src/librustc_codegen_llvm/builder.rs
src/librustc_codegen_llvm/builder.rs
+1
-1
src/librustc_codegen_llvm/callee.rs
src/librustc_codegen_llvm/callee.rs
+1
-1
src/librustc_codegen_llvm/common.rs
src/librustc_codegen_llvm/common.rs
+16
-13
src/librustc_codegen_llvm/consts.rs
src/librustc_codegen_llvm/consts.rs
+1
-1
src/librustc_codegen_llvm/interfaces/common.rs
src/librustc_codegen_llvm/interfaces/common.rs
+6
-4
src/librustc_codegen_llvm/interfaces/mod.rs
src/librustc_codegen_llvm/interfaces/mod.rs
+1
-1
src/librustc_codegen_llvm/mir/rvalue.rs
src/librustc_codegen_llvm/mir/rvalue.rs
+1
-1
未找到文件。
src/librustc_codegen_llvm/back/write.rs
浏览文件 @
3aee7727
...
...
@@ -46,7 +46,7 @@
use
syntax_pos
::
symbol
::
Symbol
;
use
type_
::
Type
;
use
context
::{
is_pie_binary
,
get_reloc_model
,
CodegenCx
};
use
interfaces
::
CommonMethods
;
use
interfaces
::
Common
Write
Methods
;
use
jobserver
::{
Client
,
Acquired
};
use
rustc_demangle
;
...
...
src/librustc_codegen_llvm/base.rs
浏览文件 @
3aee7727
...
...
@@ -74,7 +74,7 @@
use
rustc_data_structures
::
sync
::
Lrc
;
use
rustc_data_structures
::
indexed_vec
::
Idx
;
use
interfaces
::{
BuilderMethods
,
CommonMethods
};
use
interfaces
::{
BuilderMethods
,
CommonMethods
,
CommonWriteMethods
};
use
std
::
any
::
Any
;
use
std
::
cmp
;
...
...
src/librustc_codegen_llvm/builder.rs
浏览文件 @
3aee7727
...
...
@@ -19,7 +19,7 @@
use
rustc
::
ty
::
layout
::{
Align
,
Size
};
use
rustc
::
session
::{
config
,
Session
};
use
rustc_data_structures
::
small_c_str
::
SmallCStr
;
use
interfaces
::{
BuilderMethods
,
Backend
,
CommonMethods
};
use
interfaces
::{
BuilderMethods
,
Backend
,
CommonMethods
,
CommonWriteMethods
};
use
syntax
;
use
std
::
borrow
::
Cow
;
...
...
src/librustc_codegen_llvm/callee.rs
浏览文件 @
3aee7727
...
...
@@ -22,7 +22,7 @@
use
monomorphize
::
Instance
;
use
type_of
::
LayoutLlvmExt
;
use
value
::
Value
;
use
interfaces
::
CommonMethods
;
use
interfaces
::
Common
Write
Methods
;
use
rustc
::
hir
::
def_id
::
DefId
;
use
rustc
::
ty
::{
self
,
TypeFoldable
};
...
...
src/librustc_codegen_llvm/common.rs
浏览文件 @
3aee7727
...
...
@@ -24,7 +24,7 @@
use
type_
::
Type
;
use
type_of
::
LayoutLlvmExt
;
use
value
::
Value
;
use
interfaces
::{
Backend
,
CommonMethods
};
use
interfaces
::{
Backend
,
CommonMethods
,
CommonWriteMethods
};
use
rustc
::
ty
::{
self
,
Ty
,
TyCtxt
};
use
rustc
::
ty
::
layout
::{
HasDataLayout
,
LayoutOf
};
...
...
@@ -201,11 +201,6 @@ impl Backend for CodegenCx<'ll, 'tcx> {
}
impl
<
'll
,
'tcx
:
'll
>
CommonMethods
for
CodegenCx
<
'll
,
'tcx
>
{
fn
val_ty
(
v
:
&
'll
Value
)
->
&
'll
Type
{
unsafe
{
llvm
::
LLVMTypeOf
(
v
)
}
}
// LLVM constant constructors.
fn
c_null
(
&
self
,
t
:
&
'll
Type
)
->
&
'll
Value
{
...
...
@@ -354,13 +349,6 @@ fn c_bytes(&self, bytes: &[u8]) -> &'ll Value {
Self
::
c_bytes_in_context
(
&
self
.llcx
,
bytes
)
}
fn
c_bytes_in_context
(
llcx
:
&
'll
llvm
::
Context
,
bytes
:
&
[
u8
])
->
&
'll
Value
{
unsafe
{
let
ptr
=
bytes
.as_ptr
()
as
*
const
c_char
;
return
llvm
::
LLVMConstStringInContext
(
llcx
,
ptr
,
bytes
.len
()
as
c_uint
,
True
);
}
}
fn
const_get_elt
(
v
:
&
'll
Value
,
idx
:
u64
)
->
&
'll
Value
{
unsafe
{
assert_eq!
(
idx
as
c_uint
as
u64
,
idx
);
...
...
@@ -501,3 +489,18 @@ pub fn shift_mask_val(
_
=>
bug!
(
"shift_mask_val: expected Integer or Vector, found {:?}"
,
kind
),
}
}
impl
<
'll
,
'tcx
:
'll
>
CommonWriteMethods
for
CodegenCx
<
'll
,
'tcx
>
{
fn
val_ty
(
v
:
&
'll
Value
)
->
&
'll
Type
{
unsafe
{
llvm
::
LLVMTypeOf
(
v
)
}
}
fn
c_bytes_in_context
(
llcx
:
&
'll
llvm
::
Context
,
bytes
:
&
[
u8
])
->
&
'll
Value
{
unsafe
{
let
ptr
=
bytes
.as_ptr
()
as
*
const
c_char
;
return
llvm
::
LLVMConstStringInContext
(
llcx
,
ptr
,
bytes
.len
()
as
c_uint
,
True
);
}
}
}
src/librustc_codegen_llvm/consts.rs
浏览文件 @
3aee7727
...
...
@@ -24,7 +24,7 @@
use
type_of
::
LayoutLlvmExt
;
use
value
::
Value
;
use
rustc
::
ty
::{
self
,
Ty
};
use
interfaces
::
CommonMethods
;
use
interfaces
::
Common
Write
Methods
;
use
rustc
::
ty
::
layout
::{
Align
,
LayoutOf
};
...
...
src/librustc_codegen_llvm/interfaces/common.rs
浏览文件 @
3aee7727
...
...
@@ -11,9 +11,7 @@
use
super
::
Backend
;
use
syntax
::
symbol
::
LocalInternedString
;
pub
trait
CommonMethods
:
Backend
{
fn
val_ty
(
v
:
Self
::
Value
)
->
Self
::
Type
;
pub
trait
CommonMethods
:
Backend
+
CommonWriteMethods
{
// Constant constructors
fn
c_null
(
&
self
,
t
:
Self
::
Type
)
->
Self
::
Value
;
fn
c_undef
(
&
self
,
t
:
Self
::
Type
)
->
Self
::
Value
;
...
...
@@ -50,7 +48,6 @@ fn c_struct_in_context(
fn
c_array
(
ty
:
Self
::
Type
,
elts
:
&
[
Self
::
Value
])
->
Self
::
Value
;
fn
c_vector
(
elts
:
&
[
Self
::
Value
])
->
Self
::
Value
;
fn
c_bytes
(
&
self
,
bytes
:
&
[
u8
])
->
Self
::
Value
;
fn
c_bytes_in_context
(
llcx
:
Self
::
Context
,
bytes
:
&
[
u8
])
->
Self
::
Value
;
fn
const_get_elt
(
v
:
Self
::
Value
,
idx
:
u64
)
->
Self
::
Value
;
fn
const_get_real
(
v
:
Self
::
Value
)
->
Option
<
(
f64
,
bool
)
>
;
...
...
@@ -59,3 +56,8 @@ fn c_struct_in_context(
fn
is_const_real
(
v
:
Self
::
Value
)
->
bool
;
fn
const_to_opt_u128
(
v
:
Self
::
Value
,
sign_ext
:
bool
)
->
Option
<
u128
>
;
}
pub
trait
CommonWriteMethods
:
Backend
{
fn
val_ty
(
v
:
Self
::
Value
)
->
Self
::
Type
;
fn
c_bytes_in_context
(
llcx
:
Self
::
Context
,
bytes
:
&
[
u8
])
->
Self
::
Value
;
}
src/librustc_codegen_llvm/interfaces/mod.rs
浏览文件 @
3aee7727
...
...
@@ -14,4 +14,4 @@
pub
use
self
::
builder
::
BuilderMethods
;
pub
use
self
::
backend
::
Backend
;
pub
use
self
::
common
::
CommonMethods
;
pub
use
self
::
common
::
{
CommonMethods
,
CommonWriteMethods
}
;
src/librustc_codegen_llvm/mir/rvalue.rs
浏览文件 @
3aee7727
...
...
@@ -27,7 +27,7 @@
use
type_of
::
LayoutLlvmExt
;
use
value
::
Value
;
use
interfaces
::{
BuilderMethods
,
CommonMethods
};
use
interfaces
::{
BuilderMethods
,
CommonMethods
,
CommonWriteMethods
};
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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录