@@ -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 : %?\n Constraints: %? \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