Skip to content

Commit a55a702

Browse files
committed
---
yaml --- r: 139037 b: refs/heads/try2 c: 59dcbd9 h: refs/heads/master i: 139035: 9f5693f v: v3
1 parent b99fa85 commit a55a702

File tree

3 files changed

+38
-12
lines changed

3 files changed

+38
-12
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: d8ab47e7f9ed4c30c9ff3d4e2351b19992a380dd
8+
refs/heads/try2: 59dcbd9f1c04a670cb12e1127a2f1fd0898050a6
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/src/librustc/middle/trans/build.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -873,7 +873,7 @@ pub fn add_comment(bcx: block, text: &str) {
873873
}
874874
875875
pub fn InlineAsmCall(cx: block, asm: *c_char, cons: *c_char,
876-
inputs: &[ValueRef],
876+
inputs: &[ValueRef], output: ValueRef,
877877
volatile: bool, alignstack: bool,
878878
dia: AsmDialect) -> ValueRef {
879879
unsafe {
@@ -885,10 +885,12 @@ pub fn InlineAsmCall(cx: block, asm: *c_char, cons: *c_char,
885885
else { lib::llvm::False };
886886
887887
let argtys = do inputs.map |v| {
888-
io::println(fmt!("ARG TYPE: %?", val_str(cx.ccx().tn, *v)));
888+
io::println(fmt!("INPUT TYPE: %?", val_str(cx.ccx().tn, *v)));
889889
val_ty(*v)
890890
};
891-
let llfty = T_fn(argtys, T_void());
891+
892+
io::println(fmt!("OUTPUT TYPE: %?", val_str(cx.ccx().tn, output)));
893+
let llfty = T_fn(argtys, val_ty(output));
892894
let v = llvm::LLVMInlineAsm(llfty, asm, cons, volatile,
893895
alignstack, dia as c_uint);
894896

branches/try2/src/librustc/middle/trans/expr.rs

Lines changed: 32 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -562,17 +562,33 @@ fn trans_rvalue_stmt_unadjusted(bcx: block, expr: @ast::expr) -> block {
562562
let mut constraints = ~[];
563563
let mut cleanups = ~[];
564564

565-
// TODO: Handle outputs
565+
let outputs = do outs.map |&(c, out)| {
566+
constraints.push(copy *c);
566567

567-
let inputs = do ins.map |&(c, in)| {
568+
let outty = ty::arg {
569+
mode: ast::expl(ast::by_val),
570+
ty: expr_ty(bcx, out)
571+
};
568572

573+
unpack_result!(bcx, {
574+
callee::trans_arg_expr(bcx, outty, out, &mut cleanups,
575+
None, callee::DontAutorefArg)
576+
})
577+
578+
};
579+
580+
for cleanups.each |c| {
581+
revoke_clean(bcx, *c);
582+
}
583+
cleanups = ~[];
584+
585+
let inputs = do ins.map |&(c, in)| {
569586
constraints.push(copy *c);
570587

571588
let inty = ty::arg {
572589
mode: ast::expl(ast::by_val),
573590
ty: expr_ty(bcx, in)
574591
};
575-
576592

577593
unpack_result!(bcx, {
578594
callee::trans_arg_expr(bcx, inty, in, &mut cleanups,
@@ -598,14 +614,22 @@ fn trans_rvalue_stmt_unadjusted(bcx: block, expr: @ast::expr) -> block {
598614
constraints += *clobs;
599615
}
600616

601-
io::println(fmt!("Inputs: %?\nConstraints: %?\n", ins, constraints));
617+
io::println(fmt!("Constraints: %?\n", constraints));
602618

603-
do str::as_c_str(*asm) |a| {
619+
// TODO: Handle >1 outputs
620+
let output = outputs[0];
621+
622+
let r = do str::as_c_str(*asm) |a| {
604623
do str::as_c_str(constraints) |c| {
605-
InlineAsmCall(bcx, a, c, inputs, volatile, alignstack,
606-
lib::llvm::AD_ATT);
624+
InlineAsmCall(bcx, a, c, inputs, output, volatile,
625+
alignstack, lib::llvm::AD_ATT)
607626
}
608-
}
627+
};
628+
629+
// TODO: Handle >1 outputs
630+
let op = PointerCast(bcx, output, T_ptr(val_ty(output)));
631+
Store(bcx, r, op);
632+
609633
return bcx;
610634
}
611635
_ => {

0 commit comments

Comments
 (0)