@@ -562,17 +562,33 @@ fn trans_rvalue_stmt_unadjusted(bcx: block, expr: @ast::expr) -> block {
562
562
let mut constraints = ~[ ] ;
563
563
let mut cleanups = ~[ ] ;
564
564
565
- // TODO: Handle outputs
565
+ let outputs = do outs. map |& ( c, out) | {
566
+ constraints. push ( copy * c) ;
566
567
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
+ } ;
568
572
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) | {
569
586
constraints. push ( copy * c) ;
570
587
571
588
let inty = ty:: arg {
572
589
mode : ast:: expl ( ast:: by_val) ,
573
590
ty : expr_ty ( bcx, in)
574
591
} ;
575
-
576
592
577
593
unpack_result ! ( bcx, {
578
594
callee:: trans_arg_expr( bcx, inty, in, & mut cleanups,
@@ -598,14 +614,22 @@ fn trans_rvalue_stmt_unadjusted(bcx: block, expr: @ast::expr) -> block {
598
614
constraints += * clobs;
599
615
}
600
616
601
- io:: println ( fmt ! ( "Inputs : %?\n Constraints: %? \n " , ins , constraints) ) ;
617
+ io:: println ( fmt ! ( "Constraints : %?\n " , constraints) ) ;
602
618
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| {
604
623
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 )
607
626
}
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
+
609
633
return bcx;
610
634
}
611
635
_ => {
0 commit comments