Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
a1d0d4f9
R
Rust
项目概览
int
/
Rust
12 个月 前同步成功
通知
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,发现更多精彩内容 >>
提交
a1d0d4f9
编写于
9月 06, 2018
作者:
D
Denis Merigoux
提交者:
Eduard-Mihai Burtescu
11月 16, 2018
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Removing LLVM content from CommonMethods -> ConstMethods
上级
e224f063
变更
25
隐藏空白更改
内联
并排
Showing
25 changed file
with
55 addition
and
124 deletion
+55
-124
src/librustc_codegen_llvm/abi.rs
src/librustc_codegen_llvm/abi.rs
+1
-1
src/librustc_codegen_llvm/asm.rs
src/librustc_codegen_llvm/asm.rs
+1
-1
src/librustc_codegen_llvm/back/write.rs
src/librustc_codegen_llvm/back/write.rs
+5
-24
src/librustc_codegen_llvm/base.rs
src/librustc_codegen_llvm/base.rs
+5
-5
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
+6
-26
src/librustc_codegen_llvm/consts.rs
src/librustc_codegen_llvm/consts.rs
+1
-1
src/librustc_codegen_llvm/debuginfo/gdb.rs
src/librustc_codegen_llvm/debuginfo/gdb.rs
+1
-1
src/librustc_codegen_llvm/debuginfo/metadata.rs
src/librustc_codegen_llvm/debuginfo/metadata.rs
+1
-1
src/librustc_codegen_llvm/glue.rs
src/librustc_codegen_llvm/glue.rs
+1
-1
src/librustc_codegen_llvm/interfaces/backend.rs
src/librustc_codegen_llvm/interfaces/backend.rs
+1
-1
src/librustc_codegen_llvm/interfaces/consts.rs
src/librustc_codegen_llvm/interfaces/consts.rs
+1
-12
src/librustc_codegen_llvm/interfaces/mod.rs
src/librustc_codegen_llvm/interfaces/mod.rs
+2
-2
src/librustc_codegen_llvm/interfaces/type_.rs
src/librustc_codegen_llvm/interfaces/type_.rs
+3
-1
src/librustc_codegen_llvm/intrinsic.rs
src/librustc_codegen_llvm/intrinsic.rs
+1
-1
src/librustc_codegen_llvm/lib.rs
src/librustc_codegen_llvm/lib.rs
+0
-30
src/librustc_codegen_llvm/meth.rs
src/librustc_codegen_llvm/meth.rs
+1
-1
src/librustc_codegen_llvm/mir/block.rs
src/librustc_codegen_llvm/mir/block.rs
+1
-1
src/librustc_codegen_llvm/mir/constant.rs
src/librustc_codegen_llvm/mir/constant.rs
+1
-1
src/librustc_codegen_llvm/mir/mod.rs
src/librustc_codegen_llvm/mir/mod.rs
+1
-1
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
-1
src/librustc_codegen_llvm/mir/rvalue.rs
src/librustc_codegen_llvm/mir/rvalue.rs
+1
-1
src/librustc_codegen_llvm/type_.rs
src/librustc_codegen_llvm/type_.rs
+16
-7
未找到文件。
src/librustc_codegen_llvm/abi.rs
浏览文件 @
a1d0d4f9
...
...
@@ -18,7 +18,7 @@
use
type_of
::{
LayoutLlvmExt
,
PointerKind
};
use
value
::
Value
;
use
interfaces
::{
BuilderMethods
,
Co
mmon
Methods
,
TypeMethods
};
use
interfaces
::{
BuilderMethods
,
Co
nst
Methods
,
TypeMethods
};
use
rustc_target
::
abi
::{
HasDataLayout
,
LayoutOf
,
Size
,
TyLayout
,
Abi
as
LayoutAbi
};
use
rustc
::
ty
::{
self
,
Ty
};
...
...
src/librustc_codegen_llvm/asm.rs
浏览文件 @
a1d0d4f9
...
...
@@ -15,7 +15,7 @@
use
value
::
Value
;
use
rustc
::
hir
;
use
interfaces
::{
BuilderMethods
,
Co
mmon
Methods
,
TypeMethods
};
use
interfaces
::{
BuilderMethods
,
Co
nst
Methods
,
TypeMethods
};
use
mir
::
place
::
PlaceRef
;
use
mir
::
operand
::
OperandValue
;
...
...
src/librustc_codegen_llvm/back/write.rs
浏览文件 @
a1d0d4f9
...
...
@@ -49,7 +49,6 @@
use
common
;
use
jobserver
::{
Client
,
Acquired
};
use
rustc_demangle
;
use
value
::
Value
;
use
std
::
marker
::
PhantomData
;
use
std
::
any
::
Any
;
...
...
@@ -428,24 +427,6 @@ pub(crate) fn save_temp_bitcode(&self, module: &ModuleCodegen, name: &str) {
}
}
impl
CodegenContext
<
'll
>
{
fn
val_ty
(
&
self
,
v
:
&
'll
Value
)
->
&
'll
Type
{
common
::
val_ty
(
v
)
}
fn
const_bytes_in_context
(
&
self
,
llcx
:
&
'll
llvm
::
Context
,
bytes
:
&
[
u8
])
->
&
'll
Value
{
common
::
const_bytes_in_context
(
llcx
,
bytes
)
}
pub
fn
type_ptr_to
(
&
self
,
ty
:
&
'll
Type
)
->
&
'll
Type
{
unsafe
{
llvm
::
LLVMPointerType
(
ty
,
0
)
}
}
}
pub
struct
DiagnosticHandlers
<
'a
>
{
data
:
*
mut
(
&
'a
CodegenContext
<
'a
>
,
&
'a
Handler
),
llcx
:
&
'a
llvm
::
Context
,
...
...
@@ -907,10 +888,10 @@ unsafe fn embed_bitcode(cgcx: &CodegenContext,
llcx
:
&
llvm
::
Context
,
llmod
:
&
llvm
::
Module
,
bitcode
:
Option
<&
[
u8
]
>
)
{
let
llconst
=
c
gcx
.const_
bytes_in_context
(
llcx
,
bitcode
.unwrap_or
(
&
[]));
let
llconst
=
c
ommon
::
bytes_in_context
(
llcx
,
bitcode
.unwrap_or
(
&
[]));
let
llglobal
=
llvm
::
LLVMAddGlobal
(
llmod
,
c
gcx
.
val_ty
(
llconst
),
c
ommon
::
val_ty
(
llconst
),
"rustc.embedded.module
\0
"
.as_ptr
()
as
*
const
_
,
);
llvm
::
LLVMSetInitializer
(
llglobal
,
llconst
);
...
...
@@ -927,10 +908,10 @@ unsafe fn embed_bitcode(cgcx: &CodegenContext,
llvm
::
LLVMRustSetLinkage
(
llglobal
,
llvm
::
Linkage
::
PrivateLinkage
);
llvm
::
LLVMSetGlobalConstant
(
llglobal
,
llvm
::
True
);
let
llconst
=
c
gcx
.const_
bytes_in_context
(
llcx
,
&
[]);
let
llconst
=
c
ommon
::
bytes_in_context
(
llcx
,
&
[]);
let
llglobal
=
llvm
::
LLVMAddGlobal
(
llmod
,
c
gcx
.
val_ty
(
llconst
),
c
ommon
::
val_ty
(
llconst
),
"rustc.embedded.cmdline
\0
"
.as_ptr
()
as
*
const
_
,
);
llvm
::
LLVMSetInitializer
(
llglobal
,
llconst
);
...
...
@@ -2598,7 +2579,7 @@ fn create_msvc_imps(cgcx: &CodegenContext, llcx: &llvm::Context, llmod: &llvm::M
"
\x01
__imp_"
};
unsafe
{
let
i8p_ty
=
Type
::
i8p_llcx
(
cgcx
,
llcx
);
let
i8p_ty
=
Type
::
i8p_llcx
(
llcx
);
let
globals
=
base
::
iter_globals
(
llmod
)
.filter
(|
&
val
|
{
llvm
::
LLVMRustGetLinkage
(
val
)
==
llvm
::
Linkage
::
ExternalLinkage
&&
...
...
src/librustc_codegen_llvm/base.rs
浏览文件 @
a1d0d4f9
...
...
@@ -54,7 +54,7 @@
use
builder
::{
Builder
,
MemFlags
};
use
callee
;
use
rustc_mir
::
monomorphize
::
item
::
DefPathBasedNames
;
use
common
::{
IntPredicate
,
RealPredicate
};
use
common
::{
self
,
IntPredicate
,
RealPredicate
};
use
consts
;
use
context
::
CodegenCx
;
use
debuginfo
;
...
...
@@ -74,7 +74,7 @@
use
rustc_data_structures
::
sync
::
Lrc
;
use
rustc_data_structures
::
indexed_vec
::
Idx
;
use
interfaces
::{
BuilderMethods
,
Co
mmonMethods
,
CommonWrite
Methods
,
TypeMethods
};
use
interfaces
::{
BuilderMethods
,
Co
nst
Methods
,
TypeMethods
};
use
std
::
any
::
Any
;
use
std
::
cmp
;
...
...
@@ -649,12 +649,12 @@ enum MetadataKind {
DeflateEncoder
::
new
(
&
mut
compressed
,
Compression
::
fast
())
.write_all
(
&
metadata
.raw_data
)
.unwrap
();
let
llmeta
=
llvm_module
.const_
bytes_in_context
(
metadata_llcx
,
&
compressed
);
let
llconst
=
llvm_module
.const_
struct_in_context
(
metadata_llcx
,
&
[
llmeta
],
false
);
let
llmeta
=
common
::
bytes_in_context
(
metadata_llcx
,
&
compressed
);
let
llconst
=
common
::
struct_in_context
(
metadata_llcx
,
&
[
llmeta
],
false
);
let
name
=
exported_symbols
::
metadata_symbol_name
(
tcx
);
let
buf
=
CString
::
new
(
name
)
.unwrap
();
let
llglobal
=
unsafe
{
llvm
::
LLVMAddGlobal
(
metadata_llmod
,
llvm_module
.
val_ty
(
llconst
),
buf
.as_ptr
())
llvm
::
LLVMAddGlobal
(
metadata_llmod
,
common
::
val_ty
(
llconst
),
buf
.as_ptr
())
};
unsafe
{
llvm
::
LLVMSetInitializer
(
llglobal
,
llconst
);
...
...
src/librustc_codegen_llvm/builder.rs
浏览文件 @
a1d0d4f9
...
...
@@ -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
,
Co
mmonMethods
,
CommonWrite
Methods
,
TypeMethods
};
use
interfaces
::{
BuilderMethods
,
Backend
,
Co
nst
Methods
,
TypeMethods
};
use
syntax
;
use
std
::
borrow
::
Cow
;
...
...
src/librustc_codegen_llvm/callee.rs
浏览文件 @
a1d0d4f9
...
...
@@ -22,7 +22,7 @@
use
monomorphize
::
Instance
;
use
type_of
::
LayoutLlvmExt
;
use
value
::
Value
;
use
interfaces
::
CommonWrit
eMethods
;
use
interfaces
::
Typ
eMethods
;
use
rustc
::
hir
::
def_id
::
DefId
;
use
rustc
::
ty
::{
self
,
TypeFoldable
};
...
...
src/librustc_codegen_llvm/common.rs
浏览文件 @
a1d0d4f9
...
...
@@ -24,7 +24,7 @@
use
type_
::
Type
;
use
type_of
::
LayoutLlvmExt
;
use
value
::
Value
;
use
interfaces
::{
Backend
,
Co
mmonMethods
,
CommonWrite
Methods
,
TypeMethods
};
use
interfaces
::{
Backend
,
Co
nst
Methods
,
TypeMethods
};
use
rustc
::
ty
::{
self
,
Ty
,
TyCtxt
};
use
rustc
::
ty
::
layout
::{
HasDataLayout
,
LayoutOf
};
...
...
@@ -201,7 +201,7 @@ impl Backend for CodegenCx<'ll, 'tcx> {
type
Context
=
&
'll
llvm
::
Context
;
}
impl
<
'll
,
'tcx
:
'll
>
Co
mmon
Methods
for
CodegenCx
<
'll
,
'tcx
>
{
impl
<
'll
,
'tcx
:
'll
>
Co
nst
Methods
for
CodegenCx
<
'll
,
'tcx
>
{
// LLVM constant constructors.
fn
const_null
(
&
self
,
t
:
&
'll
Type
)
->
&
'll
Value
{
...
...
@@ -319,7 +319,7 @@ fn const_struct(
elts
:
&
[
&
'll
Value
],
packed
:
bool
)
->
&
'll
Value
{
&
self
.const_
struct_in_context
(
&
self
.llcx
,
elts
,
packed
)
struct_in_context
(
&
self
.llcx
,
elts
,
packed
)
}
fn
const_array
(
&
self
,
ty
:
&
'll
Type
,
elts
:
&
[
&
'll
Value
])
->
&
'll
Value
{
...
...
@@ -335,7 +335,7 @@ fn const_vector(&self, elts: &[&'ll Value]) -> &'ll Value {
}
fn
const_bytes
(
&
self
,
bytes
:
&
[
u8
])
->
&
'll
Value
{
&
self
.const_
bytes_in_context
(
&
self
.llcx
,
bytes
)
bytes_in_context
(
&
self
.llcx
,
bytes
)
}
fn
const_get_elt
(
&
self
,
v
:
&
'll
Value
,
idx
:
u64
)
->
&
'll
Value
{
...
...
@@ -406,14 +406,14 @@ pub fn val_ty(v: &'ll Value) -> &'ll Type {
}
}
pub
fn
const_
bytes_in_context
(
llcx
:
&
'll
llvm
::
Context
,
bytes
:
&
[
u8
])
->
&
'll
Value
{
pub
fn
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
);
}
}
pub
fn
const_
struct_in_context
(
pub
fn
struct_in_context
(
llcx
:
&
'a
llvm
::
Context
,
elts
:
&
[
&
'a
Value
],
packed
:
bool
,
...
...
@@ -425,26 +425,6 @@ pub fn const_struct_in_context(
}
}
impl
<
'll
,
'tcx
:
'll
>
CommonWriteMethods
for
CodegenCx
<
'll
,
'tcx
>
{
fn
val_ty
(
&
self
,
v
:
&
'll
Value
)
->
&
'll
Type
{
val_ty
(
v
)
}
fn
const_bytes_in_context
(
&
self
,
llcx
:
&
'll
llvm
::
Context
,
bytes
:
&
[
u8
])
->
&
'll
Value
{
const_bytes_in_context
(
llcx
,
bytes
)
}
fn
const_struct_in_context
(
&
self
,
llcx
:
&
'a
llvm
::
Context
,
elts
:
&
[
&
'a
Value
],
packed
:
bool
,
)
->
&
'a
Value
{
const_struct_in_context
(
llcx
,
elts
,
packed
)
}
}
#[inline]
fn
hi_lo_to_u128
(
lo
:
u64
,
hi
:
u64
)
->
u128
{
((
hi
as
u128
)
<<
64
)
|
(
lo
as
u128
)
...
...
src/librustc_codegen_llvm/consts.rs
浏览文件 @
a1d0d4f9
...
...
@@ -24,7 +24,7 @@
use
type_of
::
LayoutLlvmExt
;
use
value
::
Value
;
use
rustc
::
ty
::{
self
,
Ty
};
use
interfaces
::
{
CommonWriteMethods
,
TypeMethods
}
;
use
interfaces
::
TypeMethods
;
use
rustc
::
ty
::
layout
::{
Align
,
LayoutOf
};
...
...
src/librustc_codegen_llvm/debuginfo/gdb.rs
浏览文件 @
a1d0d4f9
...
...
@@ -17,7 +17,7 @@
use
declare
;
use
rustc
::
session
::
config
::
DebugInfo
;
use
value
::
Value
;
use
interfaces
::{
BuilderMethods
,
Co
mmon
Methods
,
TypeMethods
};
use
interfaces
::{
BuilderMethods
,
Co
nst
Methods
,
TypeMethods
};
use
syntax
::
attr
;
...
...
src/librustc_codegen_llvm/debuginfo/metadata.rs
浏览文件 @
a1d0d4f9
...
...
@@ -18,7 +18,7 @@
use
super
::
type_names
::
compute_debuginfo_type_name
;
use
super
::{
CrateDebugContext
};
use
abi
;
use
interfaces
::
Co
mmon
Methods
;
use
interfaces
::
Co
nst
Methods
;
use
value
::
Value
;
use
llvm
;
...
...
src/librustc_codegen_llvm/glue.rs
浏览文件 @
a1d0d4f9
...
...
@@ -20,7 +20,7 @@
use
rustc
::
ty
::
layout
::
LayoutOf
;
use
rustc
::
ty
::{
self
,
Ty
};
use
value
::
Value
;
use
interfaces
::{
BuilderMethods
,
Co
mmon
Methods
};
use
interfaces
::{
BuilderMethods
,
Co
nst
Methods
};
pub
fn
size_and_align_of_dst
(
bx
:
&
Builder
<
'_
,
'll
,
'tcx
>
,
...
...
src/librustc_codegen_llvm/interfaces/backend.rs
浏览文件 @
a1d0d4f9
...
...
@@ -13,7 +13,7 @@
pub
trait
Backend
{
type
Value
:
Debug
+
PartialEq
;
type
BasicBlock
;
type
Type
:
Debug
+
PartialEq
;
type
Type
:
Debug
+
PartialEq
;
type
TypeKind
;
type
Context
;
}
src/librustc_codegen_llvm/interfaces/co
mmon
.rs
→
src/librustc_codegen_llvm/interfaces/co
nsts
.rs
浏览文件 @
a1d0d4f9
...
...
@@ -11,7 +11,7 @@
use
super
::
Backend
;
use
syntax
::
symbol
::
LocalInternedString
;
pub
trait
Co
mmonMethods
:
Backend
+
CommonWriteMethods
{
pub
trait
Co
nstMethods
:
Backend
{
// Constant constructors
fn
const_null
(
&
self
,
t
:
Self
::
Type
)
->
Self
::
Value
;
fn
const_undef
(
&
self
,
t
:
Self
::
Type
)
->
Self
::
Value
;
...
...
@@ -52,14 +52,3 @@ fn const_struct(
fn
is_const_integral
(
&
self
,
v
:
Self
::
Value
)
->
bool
;
fn
is_const_real
(
&
self
,
v
:
Self
::
Value
)
->
bool
;
}
pub
trait
CommonWriteMethods
:
Backend
{
fn
val_ty
(
&
self
,
v
:
Self
::
Value
)
->
Self
::
Type
;
fn
const_bytes_in_context
(
&
self
,
llcx
:
Self
::
Context
,
bytes
:
&
[
u8
])
->
Self
::
Value
;
fn
const_struct_in_context
(
&
self
,
llcx
:
Self
::
Context
,
elts
:
&
[
Self
::
Value
],
packed
:
bool
,
)
->
Self
::
Value
;
}
src/librustc_codegen_llvm/interfaces/mod.rs
浏览文件 @
a1d0d4f9
...
...
@@ -10,10 +10,10 @@
mod
builder
;
mod
backend
;
mod
co
mmon
;
mod
co
nsts
;
mod
type_
;
pub
use
self
::
builder
::
BuilderMethods
;
pub
use
self
::
backend
::
Backend
;
pub
use
self
::
co
mmon
::{
CommonMethods
,
CommonWriteMethods
}
;
pub
use
self
::
co
nsts
::
ConstMethods
;
pub
use
self
::
type_
::
TypeMethods
;
src/librustc_codegen_llvm/interfaces/type_.rs
浏览文件 @
a1d0d4f9
...
...
@@ -10,7 +10,7 @@
use
super
::
backend
::
Backend
;
pub
trait
TypeMethods
:
Backend
{
pub
trait
TypeMethods
:
Backend
{
fn
type_void
(
&
self
)
->
Self
::
Type
;
fn
type_metadata
(
&
self
)
->
Self
::
Type
;
fn
type_i1
(
&
self
)
->
Self
::
Type
;
...
...
@@ -38,4 +38,6 @@ pub trait TypeMethods : Backend {
fn
func_params_types
(
&
self
,
ty
:
Self
::
Type
)
->
Vec
<
Self
::
Type
>
;
fn
float_width
(
&
self
,
ty
:
Self
::
Type
)
->
usize
;
fn
int_width
(
&
self
,
ty
:
Self
::
Type
)
->
u64
;
fn
val_ty
(
&
self
,
v
:
Self
::
Value
)
->
Self
::
Type
;
}
src/librustc_codegen_llvm/intrinsic.rs
浏览文件 @
a1d0d4f9
...
...
@@ -32,7 +32,7 @@
use
builder
::
Builder
;
use
value
::
Value
;
use
interfaces
::{
BuilderMethods
,
Co
mmon
Methods
,
TypeMethods
};
use
interfaces
::{
BuilderMethods
,
Co
nst
Methods
,
TypeMethods
};
use
rustc
::
session
::
Session
;
use
syntax_pos
::
Span
;
...
...
src/librustc_codegen_llvm/lib.rs
浏览文件 @
a1d0d4f9
...
...
@@ -68,9 +68,6 @@
extern
crate
memmap
;
use
back
::
bytecode
::
RLIB_BYTECODE_EXTENSION
;
use
interfaces
::{
Backend
,
CommonWriteMethods
};
use
value
::
Value
;
use
type_
::
Type
;
pub
use
llvm_util
::
target_features
;
use
std
::
any
::
Any
;
...
...
@@ -326,14 +323,6 @@ struct ModuleLlvm<'ll> {
phantom
:
PhantomData
<&
'll
()
>
}
impl
<
'll
>
Backend
for
ModuleLlvm
<
'll
>
{
type
Value
=
&
'll
Value
;
type
BasicBlock
=
&
'll
llvm
::
BasicBlock
;
type
Type
=
&
'll
Type
;
type
TypeKind
=
llvm
::
TypeKind
;
type
Context
=
&
'll
llvm
::
Context
;
}
unsafe
impl
Send
for
ModuleLlvm
<
'll
>
{
}
unsafe
impl
Sync
for
ModuleLlvm
<
'll
>
{
}
...
...
@@ -359,25 +348,6 @@ fn llmod(&self) -> &llvm::Module {
}
}
impl
CommonWriteMethods
for
ModuleLlvm
<
'll
>
{
fn
val_ty
(
&
self
,
v
:
&
'll
Value
)
->
&
'll
Type
{
common
::
val_ty
(
v
)
}
fn
const_bytes_in_context
(
&
self
,
llcx
:
&
'll
llvm
::
Context
,
bytes
:
&
[
u8
])
->
&
'll
Value
{
common
::
const_bytes_in_context
(
llcx
,
bytes
)
}
fn
const_struct_in_context
(
&
self
,
llcx
:
&
'a
llvm
::
Context
,
elts
:
&
[
&
'a
Value
],
packed
:
bool
,
)
->
&
'a
Value
{
common
::
const_struct_in_context
(
llcx
,
elts
,
packed
)
}
}
impl
Drop
for
ModuleLlvm
<
'll
>
{
fn
drop
(
&
mut
self
)
{
unsafe
{
...
...
src/librustc_codegen_llvm/meth.rs
浏览文件 @
a1d0d4f9
...
...
@@ -16,7 +16,7 @@
use
monomorphize
;
use
value
::
Value
;
use
interfaces
::{
BuilderMethods
,
Co
mmon
Methods
,
TypeMethods
};
use
interfaces
::{
BuilderMethods
,
Co
nst
Methods
,
TypeMethods
};
use
rustc
::
ty
::{
self
,
Ty
};
use
rustc
::
ty
::
layout
::
HasDataLayout
;
...
...
src/librustc_codegen_llvm/mir/block.rs
浏览文件 @
a1d0d4f9
...
...
@@ -26,7 +26,7 @@
use
type_
::
Type
;
use
value
::
Value
;
use
interfaces
::{
BuilderMethods
,
Co
mmon
Methods
,
TypeMethods
};
use
interfaces
::{
BuilderMethods
,
Co
nst
Methods
,
TypeMethods
};
use
syntax
::
symbol
::
Symbol
;
use
syntax_pos
::
Pos
;
...
...
src/librustc_codegen_llvm/mir/constant.rs
浏览文件 @
a1d0d4f9
...
...
@@ -25,7 +25,7 @@
use
syntax
::
ast
::
Mutability
;
use
syntax
::
source_map
::
Span
;
use
value
::
Value
;
use
interfaces
::{
BuilderMethods
,
Co
mmon
Methods
,
TypeMethods
};
use
interfaces
::{
BuilderMethods
,
Co
nst
Methods
,
TypeMethods
};
use
super
::
super
::
callee
;
use
super
::
FunctionCx
;
...
...
src/librustc_codegen_llvm/mir/mod.rs
浏览文件 @
a1d0d4f9
...
...
@@ -24,7 +24,7 @@
use
monomorphize
::
Instance
;
use
abi
::{
ArgTypeExt
,
FnType
,
FnTypeExt
,
PassMode
};
use
value
::
Value
;
use
interfaces
::{
BuilderMethods
,
Co
mmon
Methods
};
use
interfaces
::{
BuilderMethods
,
Co
nst
Methods
};
use
syntax_pos
::{
DUMMY_SP
,
NO_EXPANSION
,
BytePos
,
Span
};
use
syntax
::
symbol
::
keywords
;
...
...
src/librustc_codegen_llvm/mir/operand.rs
浏览文件 @
a1d0d4f9
...
...
@@ -20,7 +20,7 @@
use
type_of
::
LayoutLlvmExt
;
use
glue
;
use
interfaces
::{
BuilderMethods
,
Co
mmon
Methods
,
TypeMethods
};
use
interfaces
::{
BuilderMethods
,
Co
nst
Methods
,
TypeMethods
};
use
std
::
fmt
;
...
...
src/librustc_codegen_llvm/mir/place.rs
浏览文件 @
a1d0d4f9
...
...
@@ -22,7 +22,7 @@
use
glue
;
use
mir
::
constant
::
const_alloc_to_llvm
;
use
interfaces
::{
BuilderMethods
,
Co
mmon
Methods
,
TypeMethods
};
use
interfaces
::{
BuilderMethods
,
Co
nst
Methods
,
TypeMethods
};
use
super
::{
FunctionCx
,
LocalRef
};
use
super
::
operand
::{
OperandRef
,
OperandValue
};
...
...
src/librustc_codegen_llvm/mir/rvalue.rs
浏览文件 @
a1d0d4f9
...
...
@@ -26,7 +26,7 @@
use
type_of
::
LayoutLlvmExt
;
use
value
::
Value
;
use
interfaces
::{
BuilderMethods
,
Co
mmonMethods
,
CommonWrite
Methods
,
TypeMethods
};
use
interfaces
::{
BuilderMethods
,
Co
nst
Methods
,
TypeMethods
};
use
super
::{
FunctionCx
,
LocalRef
};
use
super
::
operand
::{
OperandRef
,
OperandValue
};
...
...
src/librustc_codegen_llvm/type_.rs
浏览文件 @
a1d0d4f9
...
...
@@ -17,11 +17,12 @@
use
context
::
CodegenCx
;
use
interfaces
::
TypeMethods
;
use
value
::
Value
;
use
syntax
::
ast
;
use
rustc
::
ty
::
layout
::{
self
,
Align
,
Size
};
use
rustc_data_structures
::
small_c_str
::
SmallCStr
;
use
back
::
write
;
use
common
;
use
std
::
fmt
;
...
...
@@ -188,9 +189,7 @@ fn set_struct_body(&self, ty: &'ll Type, els: &[&'ll Type], packed: bool) {
fn
type_ptr_to
(
&
self
,
ty
:
&
'll
Type
)
->
&
'll
Type
{
assert_ne!
(
self
.type_kind
(
ty
),
TypeKind
::
Function
,
"don't call ptr_to on function types, use ptr_to_llvm_type on FnType instead"
);
unsafe
{
llvm
::
LLVMPointerType
(
ty
,
0
)
}
ty
.ptr_to
()
}
fn
element_type
(
&
self
,
ty
:
&
'll
Type
)
->
&
'll
Type
{
...
...
@@ -216,7 +215,7 @@ fn func_params_types(&self, ty: &'ll Type) -> Vec<&'ll Type> {
}
}
fn
float_width
(
&
self
,
ty
:
&
'll
Type
)
->
usize
{
fn
float_width
(
&
self
,
ty
:
&
'll
Type
)
->
usize
{
match
self
.type_kind
(
ty
)
{
TypeKind
::
Float
=>
32
,
TypeKind
::
Double
=>
64
,
...
...
@@ -232,6 +231,10 @@ fn int_width(&self, ty: &'ll Type) -> u64 {
llvm
::
LLVMGetIntTypeWidth
(
ty
)
as
u64
}
}
fn
val_ty
(
&
self
,
v
:
&
'll
Value
)
->
&
'll
Type
{
common
::
val_ty
(
v
)
}
}
impl
Type
{
...
...
@@ -251,8 +254,14 @@ pub fn ix_llcx(
}
}
pub
fn
i8p_llcx
(
cx
:
&
write
::
CodegenContext
<
'll
>
,
llcx
:
&
'll
llvm
::
Context
)
->
&
'll
Type
{
cx
.type_ptr_to
(
Type
::
i8_llcx
(
llcx
))
pub
fn
i8p_llcx
(
llcx
:
&
'll
llvm
::
Context
)
->
&
'll
Type
{
Type
::
i8_llcx
(
llcx
)
.ptr_to
()
}
fn
ptr_to
(
&
self
)
->
&
Type
{
unsafe
{
llvm
::
LLVMPointerType
(
&
self
,
0
)
}
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录