Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
602ae913
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,发现更多精彩内容 >>
提交
602ae913
编写于
10月 26, 2011
作者:
N
Niko Matsakis
提交者:
Brian Anderson
11月 02, 2011
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
convert various ints to i32 and vice versa
上级
4bd05e5b
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
22 addition
and
22 deletion
+22
-22
src/comp/middle/trans.rs
src/comp/middle/trans.rs
+22
-22
未找到文件。
src/comp/middle/trans.rs
浏览文件 @
602ae913
...
...
@@ -935,20 +935,15 @@ fn trans_stack_local_derived_tydesc(cx: @block_ctxt, llsz: ValueRef,
// Store a pointer to the rest of the descriptors.
let
ccx
=
bcx_ccx
(
cx
);
store_inbounds
(
cx
,
llfirstparam
,
llmyroottydesc
,
[
C_int
(
ccx
,
0
),
C_int
(
ccx
,
abi
::
tydesc_field_first_param
)]);
[
0
,
abi
::
tydesc_field_first_param
]);
store_inbounds
(
cx
,
C_uint
(
ccx
,
n_params
),
llmyroottydesc
,
[
C_int
(
ccx
,
0
),
C_int
(
ccx
,
abi
::
tydesc_field_n_params
)]);
[
0
,
abi
::
tydesc_field_n_params
]);
store_inbounds
(
cx
,
llsz
,
llmyroottydesc
,
[
C_int
(
ccx
,
0
),
C_int
(
ccx
,
abi
::
tydesc_field_size
)]);
[
0
,
abi
::
tydesc_field_size
]);
store_inbounds
(
cx
,
llalign
,
llmyroottydesc
,
[
C_int
(
ccx
,
0
),
C_int
(
ccx
,
abi
::
tydesc_field_align
)]);
[
0
,
abi
::
tydesc_field_align
]);
store_inbounds
(
cx
,
C_uint
(
ccx
,
obj_params
),
llmyroottydesc
,
[
C_int
(
ccx
,
0
),
C_int
(
ccx
,
abi
::
tydesc_field_obj_params
)]);
[
0
,
abi
::
tydesc_field_obj_params
]);
ret
llmyroottydesc
;
}
...
...
@@ -1618,8 +1613,8 @@ fn load_inbounds(cx: @block_ctxt, p: ValueRef, idxs: [ValueRef]) -> ValueRef {
}
fn
store_inbounds
(
cx
:
@
block_ctxt
,
v
:
ValueRef
,
p
:
ValueRef
,
idxs
:
[
ValueRef
])
{
Store
(
cx
,
v
,
InBoundsGEP
(
cx
,
p
,
idxs
));
idxs
:
[
int
])
{
Store
(
cx
,
v
,
GEPi
(
cx
,
p
,
idxs
));
}
// Iterates through the elements of a structural type.
...
...
@@ -1975,16 +1970,20 @@ fn call_memmove(cx: @block_ctxt, dst: ValueRef, src: ValueRef,
// LLVM complains -- not even a constant element of a tydesc works).
let
ccx
=
bcx_ccx
(
cx
);
let
key
=
alt
ccx
.sess
.get_targ_cfg
()
.arch
{
session
::
arch_x86
.
|
session
::
arch_arm
.
{
"llvm.memmove.p0i8.p0i8.i32"
}
session
::
arch_x86_64
.
{
"llvm.memmove.p0i8.p0i8.i64"
}
};
let
i
=
ccx
.intrinsics
;
assert
(
i
.contains_key
(
"llvm.memmove.p0i8.p0i8.i32"
));
let
memmove
=
i
.get
(
"llvm.memmove.p0i8.p0i8.i32"
);
assert
(
i
.contains_key
(
key
));
let
memmove
=
i
.get
(
key
);
let
src_ptr
=
PointerCast
(
cx
,
src
,
T_ptr
(
T_i8
()));
let
dst_ptr
=
PointerCast
(
cx
,
dst
,
T_ptr
(
T_i8
()));
let
size
=
IntCast
(
cx
,
n_bytes
,
T_i32
()
);
let
align
=
C_i
nt
(
ccx
,
1
);
let
size
=
IntCast
(
cx
,
n_bytes
,
ccx
.int_type
);
let
align
=
C_i
32
(
1i32
);
let
volatile
=
C_bool
(
false
);
ret
rslt
(
cx
,
Call
(
cx
,
memmove
,
[
dst_ptr
,
src_ptr
,
size
,
align
,
volatile
])
);
let
ret_val
=
Call
(
cx
,
memmove
,
[
dst_ptr
,
src_ptr
,
size
,
align
,
volatile
]);
ret
rslt
(
cx
,
ret_val
);
}
fn
call_bzero
(
cx
:
@
block_ctxt
,
dst
:
ValueRef
,
n_bytes
:
ValueRef
,
...
...
@@ -3872,8 +3871,7 @@ fn trans_c_stack_native_call(bcx: @block_ctxt, f: @ast::expr,
let
i
=
0u
,
n
=
vec
::
len
(
llargs
);
while
i
<
n
{
let
llarg
=
llargs
[
i
]
.llval
;
store_inbounds
(
bcx
,
llarg
,
llargbundle
,
[
C_int
(
ccx
,
0
),
C_uint
(
ccx
,
i
)]);
store_inbounds
(
bcx
,
llarg
,
llargbundle
,
[
0
,
i
as
int
]);
i
+=
1u
;
}
...
...
@@ -4408,8 +4406,10 @@ fn trans_log(lvl: int, cx: @block_ctxt, e: @ast::expr) -> @block_ctxt {
let
llvalptr
=
r
.val
;
let
llval_i8
=
PointerCast
(
log_bcx
,
llvalptr
,
T_ptr
(
T_i8
()));
// FIXME lvl should not be int, but actually u32,
// and the upcall should take a u32, not an i32
Call
(
log_bcx
,
ccx
.upcalls.log_type
,
[
lltydesc
,
llval_i8
,
C_i
nt
(
ccx
,
lvl
)]);
[
lltydesc
,
llval_i8
,
C_i
32
(
lvl
as
i32
)]);
log_bcx
=
trans_block_cleanups
(
log_bcx
,
log_cx
);
Br
(
log_bcx
,
after_cx
.llbb
);
...
...
@@ -5206,7 +5206,7 @@ fn trans_res_ctor(cx: @local_ctxt, sp: span, dtor: ast::_fn,
check
type_is_tup_like
(
bcx
,
tup_t
);
let
flag
=
GEP_tup_like
(
bcx
,
tup_t
,
llretptr
,
[
0
,
0
]);
bcx
=
flag
.bcx
;
Store
(
bcx
,
C_i
nt
(
ccx
,
1
),
flag
.val
);
Store
(
bcx
,
C_i
32
(
1
),
flag
.val
);
build_return
(
bcx
);
finish_fn
(
fcx
,
lltop
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录