@@ -482,12 +482,13 @@ pub(crate) fn inline_asm_call<'ll>(
482
482
483
483
debug ! ( "Asm Output Type: {:?}" , output) ;
484
484
let fty = bx. cx . type_func ( & argtys, output) ;
485
- unsafe {
486
- // Ask LLVM to verify that the constraints are well-formed.
487
- let constraints_ok = llvm:: LLVMRustInlineAsmVerify ( fty, cons. as_c_char_ptr ( ) , cons. len ( ) ) ;
488
- debug ! ( "constraint verification result: {:?}" , constraints_ok) ;
489
- if constraints_ok {
490
- let v = llvm:: LLVMRustInlineAsm (
485
+ // Ask LLVM to verify that the constraints are well-formed.
486
+ let constraints_ok =
487
+ unsafe { llvm:: LLVMRustInlineAsmVerify ( fty, cons. as_c_char_ptr ( ) , cons. len ( ) ) } ;
488
+ debug ! ( "constraint verification result: {:?}" , constraints_ok) ;
489
+ if constraints_ok {
490
+ let v = unsafe {
491
+ llvm:: LLVMRustInlineAsm (
491
492
fty,
492
493
asm. as_c_char_ptr ( ) ,
493
494
asm. len ( ) ,
@@ -497,50 +498,50 @@ pub(crate) fn inline_asm_call<'ll>(
497
498
alignstack,
498
499
dia,
499
500
can_throw,
500
- ) ;
501
-
502
- let call = if !labels. is_empty ( ) {
503
- assert ! ( catch_funclet. is_none( ) ) ;
504
- bx. callbr ( fty, None , None , v, inputs, dest. unwrap ( ) , labels, None , None )
505
- } else if let Some ( ( catch, funclet) ) = catch_funclet {
506
- bx. invoke ( fty, None , None , v, inputs, dest. unwrap ( ) , catch, funclet, None )
507
- } else {
508
- bx. call ( fty, None , None , v, inputs, None , None )
509
- } ;
501
+ )
502
+ } ;
510
503
511
- // Store mark in a metadata node so we can map LLVM errors
512
- // back to source locations. See #17552.
513
- let key = "srcloc" ;
514
- let kind = bx. get_md_kind_id ( key) ;
504
+ let call = if !labels. is_empty ( ) {
505
+ assert ! ( catch_funclet. is_none( ) ) ;
506
+ bx. callbr ( fty, None , None , v, inputs, dest. unwrap ( ) , labels, None , None )
507
+ } else if let Some ( ( catch, funclet) ) = catch_funclet {
508
+ bx. invoke ( fty, None , None , v, inputs, dest. unwrap ( ) , catch, funclet, None )
509
+ } else {
510
+ bx. call ( fty, None , None , v, inputs, None , None )
511
+ } ;
515
512
516
- // `srcloc` contains one 64-bit integer for each line of assembly code,
517
- // where the lower 32 bits hold the lo byte position and the upper 32 bits
518
- // hold the hi byte position.
519
- let mut srcloc = vec ! [ ] ;
520
- if dia == llvm:: AsmDialect :: Intel && line_spans. len ( ) > 1 {
521
- // LLVM inserts an extra line to add the ".intel_syntax", so add
522
- // a dummy srcloc entry for it.
523
- //
524
- // Don't do this if we only have 1 line span since that may be
525
- // due to the asm template string coming from a macro. LLVM will
526
- // default to the first srcloc for lines that don't have an
527
- // associated srcloc.
528
- srcloc. push ( llvm:: LLVMValueAsMetadata ( bx. const_u64 ( 0 ) ) ) ;
529
- }
530
- srcloc. extend ( line_spans. iter ( ) . map ( |span| {
531
- llvm:: LLVMValueAsMetadata ( bx. const_u64 (
532
- u64:: from ( span. lo ( ) . to_u32 ( ) ) | ( u64:: from ( span. hi ( ) . to_u32 ( ) ) << 32 ) ,
533
- ) )
534
- } ) ) ;
535
- let md = llvm:: LLVMMDNodeInContext2 ( bx. llcx , srcloc. as_ptr ( ) , srcloc. len ( ) ) ;
536
- let md = bx. get_metadata_value ( md) ;
537
- llvm:: LLVMSetMetadata ( call, kind, md) ;
513
+ // Store mark in a metadata node so we can map LLVM errors
514
+ // back to source locations. See #17552.
515
+ let key = "srcloc" ;
516
+ let kind = bx. get_md_kind_id ( key) ;
538
517
539
- Some ( call)
540
- } else {
541
- // LLVM has detected an issue with our constraints, bail out
542
- None
518
+ // `srcloc` contains one 64-bit integer for each line of assembly code,
519
+ // where the lower 32 bits hold the lo byte position and the upper 32 bits
520
+ // hold the hi byte position.
521
+ let mut srcloc = vec ! [ ] ;
522
+ if dia == llvm:: AsmDialect :: Intel && line_spans. len ( ) > 1 {
523
+ // LLVM inserts an extra line to add the ".intel_syntax", so add
524
+ // a dummy srcloc entry for it.
525
+ //
526
+ // Don't do this if we only have 1 line span since that may be
527
+ // due to the asm template string coming from a macro. LLVM will
528
+ // default to the first srcloc for lines that don't have an
529
+ // associated srcloc.
530
+ srcloc. push ( llvm:: LLVMValueAsMetadata ( bx. const_u64 ( 0 ) ) ) ;
543
531
}
532
+ srcloc. extend ( line_spans. iter ( ) . map ( |span| {
533
+ llvm:: LLVMValueAsMetadata (
534
+ bx. const_u64 ( u64:: from ( span. lo ( ) . to_u32 ( ) ) | ( u64:: from ( span. hi ( ) . to_u32 ( ) ) << 32 ) ) ,
535
+ )
536
+ } ) ) ;
537
+ let md = unsafe { llvm:: LLVMMDNodeInContext2 ( bx. llcx , srcloc. as_ptr ( ) , srcloc. len ( ) ) } ;
538
+ let md = bx. get_metadata_value ( md) ;
539
+ llvm:: LLVMSetMetadata ( call, kind, md) ;
540
+
541
+ Some ( call)
542
+ } else {
543
+ // LLVM has detected an issue with our constraints, bail out
544
+ None
544
545
}
545
546
}
546
547
0 commit comments