Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
6d078db9
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,发现更多精彩内容 >>
提交
6d078db9
编写于
3月 12, 2013
作者:
L
Luqman Aden
提交者:
Luqman Aden
3月 15, 2013
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Actually pass inline asm operands around.
上级
471d2b17
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
100 addition
and
24 deletion
+100
-24
src/librustc/middle/liveness.rs
src/librustc/middle/liveness.rs
+24
-2
src/librustc/middle/moves.rs
src/librustc/middle/moves.rs
+10
-2
src/librustc/middle/trans/expr.rs
src/librustc/middle/trans/expr.rs
+12
-11
src/librustc/middle/trans/type_use.rs
src/librustc/middle/trans/type_use.rs
+6
-1
src/librustc/middle/typeck/check/mod.rs
src/librustc/middle/typeck/check/mod.rs
+8
-1
src/libsyntax/ast.rs
src/libsyntax/ast.rs
+4
-2
src/libsyntax/ext/asm.rs
src/libsyntax/ext/asm.rs
+2
-1
src/libsyntax/fold.rs
src/libsyntax/fold.rs
+8
-1
src/libsyntax/print/pprust.rs
src/libsyntax/print/pprust.rs
+18
-2
src/libsyntax/visit.rs
src/libsyntax/visit.rs
+8
-1
未找到文件。
src/librustc/middle/liveness.rs
浏览文件 @
6d078db9
...
...
@@ -1347,7 +1347,15 @@ fn propagate_through_expr(&self, expr: @expr, succ: LiveNode)
self
.propagate_through_expr
(
e
,
succ
)
}
expr_inline_asm
(
*
)
|
expr_inline_asm
(
_
,
ins
,
outs
,
_
,
_
,
_
)
=>
{
let
succ
=
do
ins
.foldr
(
succ
)
|
&
(
_
,
expr
),
succ
|
{
self
.propagate_through_expr
(
expr
,
succ
)
};
do
outs
.foldr
(
succ
)
|
&
(
_
,
expr
),
succ
|
{
self
.propagate_through_expr
(
expr
,
succ
)
}
}
expr_lit
(
*
)
=>
{
succ
}
...
...
@@ -1613,6 +1621,20 @@ fn check_expr(expr: @expr, &&self: @Liveness, vt: vt<@Liveness>) {
visit
::
visit_expr
(
expr
,
self
,
vt
);
}
expr_inline_asm
(
_
,
ins
,
outs
,
_
,
_
,
_
)
=>
{
for
ins
.each
|
&
(
_
,
in
)|
{
(
vt
.visit_expr
)(
in
,
self
,
vt
);
}
// Output operands must be lvalues
for
outs
.each
|
&
(
_
,
out
)|
{
self
.check_lvalue
(
out
,
vt
);
(
vt
.visit_expr
)(
out
,
self
,
vt
);
}
visit
::
visit_expr
(
expr
,
self
,
vt
);
}
// no correctness conditions related to liveness
expr_call
(
*
)
|
expr_method_call
(
*
)
|
expr_if
(
*
)
|
expr_match
(
*
)
|
expr_while
(
*
)
|
expr_loop
(
*
)
|
expr_index
(
*
)
|
expr_field
(
*
)
|
...
...
@@ -1621,7 +1643,7 @@ fn check_expr(expr: @expr, &&self: @Liveness, vt: vt<@Liveness>) {
expr_cast
(
*
)
|
expr_unary
(
*
)
|
expr_ret
(
*
)
|
expr_break
(
*
)
|
expr_again
(
*
)
|
expr_lit
(
_
)
|
expr_block
(
*
)
|
expr_swap
(
*
)
|
expr_mac
(
*
)
|
expr_addr_of
(
*
)
|
expr_struct
(
*
)
|
expr_repeat
(
*
)
|
expr_paren
(
*
)
|
expr_inline_asm
(
*
)
=>
{
expr_paren
(
*
)
=>
{
visit
::
visit_expr
(
expr
,
self
,
vt
);
}
}
...
...
src/librustc/middle/moves.rs
浏览文件 @
6d078db9
...
...
@@ -558,10 +558,18 @@ fn use_expr(&self,
self
.use_expr
(
base
,
Read
,
visitor
);
}
expr_inline_asm
(
_
,
ref
ins
,
ref
outs
,
_
,
_
,
_
)
=>
{
for
ins
.each
|
&
(
c
,
in
)|
{
// XXX: Do something?
}
for
outs
.each
|
&
(
c
,
out
)|
{
// XXX: Do something?
}
}
expr_break
(
*
)
|
expr_again
(
*
)
|
expr_lit
(
*
)
|
expr_inline_asm
(
*
)
=>
{}
expr_lit
(
*
)
=>
{}
expr_loop
(
ref
blk
,
_
)
=>
{
self
.consume_block
(
blk
,
visitor
);
...
...
src/librustc/middle/trans/expr.rs
浏览文件 @
6d078db9
...
...
@@ -557,6 +557,18 @@ fn trans_rvalue_stmt_unadjusted(bcx: block, expr: @ast::expr) -> block {
ast
::
expr_paren
(
a
)
=>
{
return
trans_rvalue_stmt_unadjusted
(
bcx
,
a
);
}
ast
::
expr_inline_asm
(
asm
,
ref
ins
,
ref
outs
,
cons
,
volatile
,
alignstack
)
=>
{
// XXX: cons doesn't actual contain ALL the stuff we should
// be passing since the constraints for in/outputs aren't included
do
str
::
as_c_str
(
*
asm
)
|
a
|
{
do
str
::
as_c_str
(
*
cons
)
|
c
|
{
InlineAsmCall
(
bcx
,
a
,
c
,
volatile
,
alignstack
,
lib
::
llvm
::
AD_ATT
);
}
}
return
bcx
;
}
_
=>
{
bcx
.tcx
()
.sess
.span_bug
(
expr
.span
,
...
...
@@ -691,17 +703,6 @@ fn trans_rvalue_dps_unadjusted(bcx: block, expr: @ast::expr,
ast
::
expr_assign_op
(
op
,
dst
,
src
)
=>
{
return
trans_assign_op
(
bcx
,
expr
,
op
,
dst
,
src
);
}
ast
::
expr_inline_asm
(
asm
,
cons
,
volatile
,
alignstack
)
=>
{
// XXX: cons doesn't actual contain ALL the stuff we should
// be passing since the constraints for in/outputs aren't included
do
str
::
as_c_str
(
*
asm
)
|
a
|
{
do
str
::
as_c_str
(
*
cons
)
|
c
|
{
InlineAsmCall
(
bcx
,
a
,
c
,
volatile
,
alignstack
,
lib
::
llvm
::
AD_ATT
);
}
}
return
bcx
;
}
_
=>
{
bcx
.tcx
()
.sess
.span_bug
(
expr
.span
,
...
...
src/librustc/middle/trans/type_use.rs
浏览文件 @
6d078db9
...
...
@@ -348,12 +348,17 @@ pub fn mark_for_expr(cx: Context, e: @expr) {
}
mark_for_method_call
(
cx
,
e
.id
,
e
.callee_id
);
}
expr_inline_asm
(
_
,
ref
ins
,
ref
outs
,
_
,
_
,
_
)
=>
{
// XXX Do something, maybe?
}
expr_paren
(
e
)
=>
mark_for_expr
(
cx
,
e
),
expr_match
(
*
)
|
expr_block
(
_
)
|
expr_if
(
*
)
|
expr_while
(
*
)
|
expr_break
(
_
)
|
expr_again
(
_
)
|
expr_unary
(
_
,
_
)
|
expr_lit
(
_
)
|
expr_mac
(
_
)
|
expr_addr_of
(
_
,
_
)
|
expr_ret
(
_
)
|
expr_loop
(
_
,
_
)
|
expr_loop_body
(
_
)
|
expr_do_body
(
_
)
|
expr_inline_asm
(
*
)
=>
()
expr_loop_body
(
_
)
|
expr_do_body
(
_
)
=>
()
}
}
...
...
src/librustc/middle/typeck/check/mod.rs
浏览文件 @
6d078db9
...
...
@@ -2317,8 +2317,15 @@ fn check_loop_body(fcx: @mut FnCtxt,
let
region_lb
=
ty
::
re_scope
(
expr
.id
);
instantiate_path
(
fcx
,
pth
,
tpt
,
expr
.span
,
expr
.id
,
region_lb
);
}
ast
::
expr_inline_asm
(
*
)
=>
{
ast
::
expr_inline_asm
(
_
,
ins
,
outs
,
_
,
_
,
_
)
=>
{
fcx
.require_unsafe
(
expr
.span
,
~
"use of inline assembly"
);
for
ins
.each
|
&
(
_
,
in
)|
{
check_expr
(
fcx
,
in
);
}
for
outs
.each
|
&
(
_
,
out
)|
{
check_expr
(
fcx
,
out
);
}
fcx
.write_nil
(
id
);
}
ast
::
expr_mac
(
_
)
=>
tcx
.sess
.bug
(
~
"unexpanded macro"
),
...
...
src/libsyntax/ast.rs
浏览文件 @
6d078db9
...
...
@@ -601,8 +601,10 @@ pub enum expr_ {
expr_ret
(
Option
<@
expr
>
),
expr_log
(
log_level
,
@
expr
,
@
expr
),
/* asm, clobbers + constraints, volatile, align stack */
expr_inline_asm
(
@~
str
,
@~
str
,
bool
,
bool
),
expr_inline_asm
(
@~
str
,
// asm
~
[(
@~
str
,
@
expr
)],
// inputs
~
[(
@~
str
,
@
expr
)],
// outputs
@~
str
,
bool
,
bool
),
// clobbers, volatile, align stack
expr_mac
(
mac
),
...
...
src/libsyntax/ext/asm.rs
浏览文件 @
6d078db9
...
...
@@ -156,7 +156,8 @@ pub fn expand_asm(cx: @ext_ctxt, sp: span, tts: &[ast::token_tree])
MRExpr
(
@
ast
::
expr
{
id
:
cx
.next_id
(),
callee_id
:
cx
.next_id
(),
node
:
ast
::
expr_inline_asm
(
@
asm
,
@
cons
,
volatile
,
alignstack
),
node
:
ast
::
expr_inline_asm
(
@
asm
,
inputs
,
outputs
,
@
cons
,
volatile
,
alignstack
),
span
:
sp
})
}
...
...
src/libsyntax/fold.rs
浏览文件 @
6d078db9
...
...
@@ -560,7 +560,14 @@ fn fold_field_(field: field, fld: @ast_fold) -> field {
fld
.fold_expr
(
e
)
)
}
expr_inline_asm
(
*
)
=>
copy
*
e
,
expr_inline_asm
(
asm
,
ins
,
outs
,
c
,
v
,
a
)
=>
{
expr_inline_asm
(
asm
,
ins
.map
(|
&
(
c
,
in
)|
(
c
,
fld
.fold_expr
(
in
))),
outs
.map
(|
&
(
c
,
out
)|
(
c
,
fld
.fold_expr
(
out
))),
c
,
v
,
a
)
}
expr_mac
(
ref
mac
)
=>
expr_mac
(
fold_mac
((
*
mac
))),
expr_struct
(
path
,
ref
fields
,
maybe_expr
)
=>
{
expr_struct
(
...
...
src/libsyntax/print/pprust.rs
浏览文件 @
6d078db9
...
...
@@ -1403,7 +1403,7 @@ fn print_field(s: @ps, field: ast::field) {
}
}
}
ast
::
expr_inline_asm
(
a
,
c
,
v
,
_
)
=>
{
ast
::
expr_inline_asm
(
a
,
in
,
out
,
c
,
v
,
_
)
=>
{
if
v
{
word
(
s
.s
,
~
"__volatile__ asm!"
);
}
else
{
...
...
@@ -1411,7 +1411,23 @@ fn print_field(s: @ps, field: ast::field) {
}
popen
(
s
);
print_string
(
s
,
*
a
);
word_space
(
s
,
~
","
);
word_space
(
s
,
~
":"
);
for
out
.each
|
&
(
co
,
o
)|
{
print_string
(
s
,
*
co
);
popen
(
s
);
print_expr
(
s
,
o
);
pclose
(
s
);
word_space
(
s
,
~
","
);
}
word_space
(
s
,
~
":"
);
for
in
.each
|
&
(
co
,
o
)|
{
print_string
(
s
,
*
co
);
popen
(
s
);
print_expr
(
s
,
o
);
pclose
(
s
);
word_space
(
s
,
~
","
);
}
word_space
(
s
,
~
":"
);
print_string
(
s
,
*
c
);
pclose
(
s
);
}
...
...
src/libsyntax/visit.rs
浏览文件 @
6d078db9
...
...
@@ -562,7 +562,14 @@ pub fn visit_expr<E>(ex: @expr, e: E, v: vt<E>) {
}
expr_mac
(
ref
mac
)
=>
visit_mac
((
*
mac
),
e
,
v
),
expr_paren
(
x
)
=>
(
v
.visit_expr
)(
x
,
e
,
v
),
expr_inline_asm
(
*
)
=>
(),
expr_inline_asm
(
_
,
ins
,
outs
,
_
,
_
,
_
)
=>
{
for
ins
.each
|
&
(
c
,
in
)|
{
(
v
.visit_expr
)(
in
,
e
,
v
);
}
for
outs
.each
|
&
(
c
,
out
)|
{
(
v
.visit_expr
)(
out
,
e
,
v
);
}
}
}
(
v
.visit_expr_post
)(
ex
,
e
,
v
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录