Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
c45f3dee
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,发现更多精彩内容 >>
提交
c45f3dee
编写于
11月 21, 2016
作者:
S
Seo Sanghyeon
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Restore compatibility with LLVM 3.7 and 3.8
上级
fc2373c5
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
15 addition
and
27 deletion
+15
-27
src/librustc_llvm/ffi.rs
src/librustc_llvm/ffi.rs
+3
-10
src/librustc_llvm/lib.rs
src/librustc_llvm/lib.rs
+3
-7
src/rustllvm/RustWrapper.cpp
src/rustllvm/RustWrapper.cpp
+9
-10
未找到文件。
src/librustc_llvm/ffi.rs
浏览文件 @
c45f3dee
...
...
@@ -395,9 +395,6 @@ pub enum RustArchiveMember_opaque {}
#[allow(missing_copy_implementations)]
pub
enum
OperandBundleDef_opaque
{}
pub
type
OperandBundleDefRef
=
*
mut
OperandBundleDef_opaque
;
#[allow(missing_copy_implementations)]
pub
enum
Attribute_opaque
{}
pub
type
AttributeRef
=
*
mut
Attribute_opaque
;
pub
type
DiagnosticHandler
=
unsafe
extern
"C"
fn
(
DiagnosticInfoRef
,
*
mut
c_void
);
pub
type
InlineAsmDiagHandler
=
unsafe
extern
"C"
fn
(
SMDiagnosticRef
,
*
const
c_void
,
c_uint
);
...
...
@@ -770,8 +767,6 @@ pub fn LLVMAddAlias(M: ModuleRef,
Name
:
*
const
c_char
)
->
ValueRef
;
pub
fn
LLVMRustCreateAttribute
(
C
:
ContextRef
,
kind
:
Attribute
,
val
:
u64
)
->
AttributeRef
;
// Operations on functions
pub
fn
LLVMAddFunction
(
M
:
ModuleRef
,
Name
:
*
const
c_char
,
FunctionTy
:
TypeRef
)
->
ValueRef
;
pub
fn
LLVMGetNamedFunction
(
M
:
ModuleRef
,
Name
:
*
const
c_char
)
->
ValueRef
;
...
...
@@ -790,12 +785,12 @@ pub fn LLVMRustGetOrInsertFunction(M: ModuleRef,
pub
fn
LLVMGetGC
(
Fn
:
ValueRef
)
->
*
const
c_char
;
pub
fn
LLVMSetGC
(
Fn
:
ValueRef
,
Name
:
*
const
c_char
);
pub
fn
LLVMRustAddDereferenceableAttr
(
Fn
:
ValueRef
,
index
:
c_uint
,
bytes
:
u64
);
pub
fn
LLVMRustAddFunctionAttribute
(
Fn
:
ValueRef
,
index
:
c_uint
,
attr
:
Attribute
Ref
);
pub
fn
LLVMRustAddFunctionAttribute
(
Fn
:
ValueRef
,
index
:
c_uint
,
attr
:
Attribute
);
pub
fn
LLVMRustAddFunctionAttrStringValue
(
Fn
:
ValueRef
,
index
:
c_uint
,
Name
:
*
const
c_char
,
Value
:
*
const
c_char
);
pub
fn
LLVMRustRemoveFunctionAttributes
(
Fn
:
ValueRef
,
index
:
c_uint
,
attr
:
Attribute
Ref
);
pub
fn
LLVMRustRemoveFunctionAttributes
(
Fn
:
ValueRef
,
index
:
c_uint
,
attr
:
Attribute
);
// Operations on parameters
pub
fn
LLVMCountParams
(
Fn
:
ValueRef
)
->
c_uint
;
...
...
@@ -806,8 +801,6 @@ pub fn LLVMRustAddFunctionAttrStringValue(Fn: ValueRef,
pub
fn
LLVMGetLastParam
(
Fn
:
ValueRef
)
->
ValueRef
;
pub
fn
LLVMGetNextParam
(
Arg
:
ValueRef
)
->
ValueRef
;
pub
fn
LLVMGetPreviousParam
(
Arg
:
ValueRef
)
->
ValueRef
;
pub
fn
LLVMAddAttribute
(
Arg
:
ValueRef
,
attr
:
AttributeRef
);
pub
fn
LLVMRemoveAttribute
(
Arg
:
ValueRef
,
attr
:
AttributeRef
);
pub
fn
LLVMSetParamAlignment
(
Arg
:
ValueRef
,
align
:
c_uint
);
// Operations on basic blocks
...
...
@@ -851,7 +844,7 @@ pub fn LLVMInsertBasicBlockInContext(C: ContextRef,
pub
fn
LLVMAddInstrAttribute
(
Instr
:
ValueRef
,
index
:
c_uint
,
IA
:
c_uint
);
pub
fn
LLVMRemoveInstrAttribute
(
Instr
:
ValueRef
,
index
:
c_uint
,
IA
:
c_uint
);
pub
fn
LLVMSetInstrParamAlignment
(
Instr
:
ValueRef
,
index
:
c_uint
,
align
:
c_uint
);
pub
fn
LLVMRustAddCallSiteAttribute
(
Instr
:
ValueRef
,
index
:
c_uint
,
attr
:
Attribute
Ref
);
pub
fn
LLVMRustAddCallSiteAttribute
(
Instr
:
ValueRef
,
index
:
c_uint
,
attr
:
Attribute
);
pub
fn
LLVMRustAddDereferenceableCallSiteAttr
(
Instr
:
ValueRef
,
index
:
c_uint
,
bytes
:
u64
);
// Operations on call instructions (only)
...
...
src/librustc_llvm/lib.rs
浏览文件 @
c45f3dee
...
...
@@ -176,20 +176,16 @@ pub fn set_thread_local(global: ValueRef, is_thread_local: bool) {
}
impl
Attribute
{
fn
as_object
(
&
self
,
value
:
ValueRef
)
->
AttributeRef
{
unsafe
{
LLVMRustCreateAttribute
(
LLVMRustGetValueContext
(
value
),
*
self
,
0
)
}
}
pub
fn
apply_llfn
(
&
self
,
idx
:
AttributePlace
,
llfn
:
ValueRef
)
{
unsafe
{
LLVMRustAddFunctionAttribute
(
llfn
,
idx
.as_uint
(),
self
.as_object
(
llfn
)
)
}
unsafe
{
LLVMRustAddFunctionAttribute
(
llfn
,
idx
.as_uint
(),
*
self
)
}
}
pub
fn
apply_callsite
(
&
self
,
idx
:
AttributePlace
,
callsite
:
ValueRef
)
{
unsafe
{
LLVMRustAddCallSiteAttribute
(
callsite
,
idx
.as_uint
(),
self
.as_object
(
callsite
)
)
}
unsafe
{
LLVMRustAddCallSiteAttribute
(
callsite
,
idx
.as_uint
(),
*
self
)
}
}
pub
fn
unapply_llfn
(
&
self
,
idx
:
AttributePlace
,
llfn
:
ValueRef
)
{
unsafe
{
LLVMRustRemoveFunctionAttributes
(
llfn
,
idx
.as_uint
(),
self
.as_object
(
llfn
)
)
}
unsafe
{
LLVMRustRemoveFunctionAttributes
(
llfn
,
idx
.as_uint
(),
*
self
)
}
}
pub
fn
toggle_llfn
(
&
self
,
idx
:
AttributePlace
,
llfn
:
ValueRef
,
set
:
bool
)
{
...
...
src/rustllvm/RustWrapper.cpp
浏览文件 @
c45f3dee
...
...
@@ -155,13 +155,10 @@ from_rust(LLVMRustAttribute kind) {
}
}
extern
"C"
LLVMAttributeRef
LLVMRustCreateAttribute
(
LLVMContextRef
C
,
LLVMRustAttribute
Kind
,
uint64_t
Val
)
{
return
wrap
(
Attribute
::
get
(
*
unwrap
(
C
),
from_rust
(
Kind
),
Val
));
}
extern
"C"
void
LLVMRustAddCallSiteAttribute
(
LLVMValueRef
Instr
,
unsigned
index
,
LLVMAttributeRef
attr
)
{
extern
"C"
void
LLVMRustAddCallSiteAttribute
(
LLVMValueRef
Instr
,
unsigned
index
,
LLVMRustAttribute
attr
)
{
CallSite
Call
=
CallSite
(
unwrap
<
Instruction
>
(
Instr
));
AttrBuilder
B
(
unwrap
(
attr
));
Attribute
Attr
=
Attribute
::
get
(
Call
->
getContext
(),
from_rust
(
attr
));
AttrBuilder
B
(
Attr
);
Call
.
setAttributes
(
Call
.
getAttributes
().
addAttributes
(
Call
->
getContext
(),
index
,
AttributeSet
::
get
(
Call
->
getContext
(),
...
...
@@ -183,10 +180,11 @@ extern "C" void LLVMRustAddDereferenceableCallSiteAttr(LLVMValueRef Instr,
extern
"C"
void
LLVMRustAddFunctionAttribute
(
LLVMValueRef
Fn
,
unsigned
index
,
LLVM
AttributeRef
attr
)
LLVM
RustAttribute
attr
)
{
Function
*
A
=
unwrap
<
Function
>
(
Fn
);
AttrBuilder
B
(
unwrap
(
attr
));
Attribute
Attr
=
Attribute
::
get
(
A
->
getContext
(),
from_rust
(
attr
));
AttrBuilder
B
(
Attr
);
A
->
addAttributes
(
index
,
AttributeSet
::
get
(
A
->
getContext
(),
index
,
B
));
}
...
...
@@ -212,11 +210,12 @@ extern "C" void LLVMRustAddFunctionAttrStringValue(LLVMValueRef Fn,
extern
"C"
void
LLVMRustRemoveFunctionAttributes
(
LLVMValueRef
Fn
,
unsigned
index
,
LLVM
AttributeRef
attr
)
LLVM
RustAttribute
attr
)
{
Function
*
F
=
unwrap
<
Function
>
(
Fn
);
const
AttributeSet
PAL
=
F
->
getAttributes
();
AttrBuilder
B
(
unwrap
(
attr
));
Attribute
Attr
=
Attribute
::
get
(
F
->
getContext
(),
from_rust
(
attr
));
AttrBuilder
B
(
Attr
);
const
AttributeSet
PALnew
=
PAL
.
removeAttributes
(
F
->
getContext
(),
index
,
AttributeSet
::
get
(
F
->
getContext
(),
index
,
B
));
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录