@@ -12,7 +12,7 @@ use rustc_abi::{Align, HasDataLayout, Size, TargetDataLayout, WrappingRange};
12
12
use rustc_apfloat:: { Float , Round , Status , ieee} ;
13
13
use rustc_codegen_ssa:: MemFlags ;
14
14
use rustc_codegen_ssa:: common:: {
15
- AtomicOrdering , AtomicRmwBinOp , IntPredicate , RealPredicate , SynchronizationScope , TypeKind ,
15
+ AtomicRmwBinOp , IntPredicate , RealPredicate , SynchronizationScope , TypeKind ,
16
16
} ;
17
17
use rustc_codegen_ssa:: mir:: operand:: { OperandRef , OperandValue } ;
18
18
use rustc_codegen_ssa:: mir:: place:: PlaceRef ;
@@ -26,7 +26,7 @@ use rustc_middle::middle::codegen_fn_attrs::CodegenFnAttrs;
26
26
use rustc_middle:: ty:: layout:: {
27
27
FnAbiError , FnAbiOfHelpers , FnAbiRequest , HasTyCtxt , HasTypingEnv , LayoutError , LayoutOfHelpers ,
28
28
} ;
29
- use rustc_middle:: ty:: { self , Instance , Ty , TyCtxt } ;
29
+ use rustc_middle:: ty:: { self , AtomicOrdering , Instance , Ty , TyCtxt } ;
30
30
use rustc_span:: Span ;
31
31
use rustc_span:: def_id:: DefId ;
32
32
use rustc_target:: callconv:: FnAbi ;
@@ -75,7 +75,7 @@ impl<'a, 'gcc, 'tcx> Builder<'a, 'gcc, 'tcx> {
75
75
76
76
let load_ordering = match order {
77
77
// TODO(antoyo): does this make sense?
78
- AtomicOrdering :: AcquireRelease | AtomicOrdering :: Release => AtomicOrdering :: Acquire ,
78
+ AtomicOrdering :: AcqRel | AtomicOrdering :: Release => AtomicOrdering :: Acquire ,
79
79
_ => order,
80
80
} ;
81
81
let previous_value =
@@ -781,6 +781,7 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> {
781
781
return self . context . new_call ( self . location , fmod, & [ a, b] ) ;
782
782
}
783
783
TypeKind :: FP128 => {
784
+ // TODO(antoyo): use get_simple_function_f128_2args.
784
785
let f128_type = self . type_f128 ( ) ;
785
786
let fmodf128 = self . context . new_function (
786
787
None ,
@@ -1118,7 +1119,13 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> {
1118
1119
// TODO(antoyo)
1119
1120
}
1120
1121
1121
- fn store ( & mut self , val : RValue < ' gcc > , ptr : RValue < ' gcc > , align : Align ) -> RValue < ' gcc > {
1122
+ fn store ( & mut self , mut val : RValue < ' gcc > , ptr : RValue < ' gcc > , align : Align ) -> RValue < ' gcc > {
1123
+ if self . structs_as_pointer . borrow ( ) . contains ( & val) {
1124
+ // NOTE: hack to workaround a limitation of the rustc API: see comment on
1125
+ // CodegenCx.structs_as_pointer
1126
+ val = val. dereference ( self . location ) . to_rvalue ( ) ;
1127
+ }
1128
+
1122
1129
self . store_with_flags ( val, ptr, align, MemFlags :: empty ( ) )
1123
1130
}
1124
1131
@@ -1564,16 +1571,13 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> {
1564
1571
aggregate_value
1565
1572
}
1566
1573
1567
- fn set_personality_fn ( & mut self , _personality : RValue < ' gcc > ) {
1574
+ fn set_personality_fn ( & mut self , _personality : Function < ' gcc > ) {
1568
1575
#[ cfg( feature = "master" ) ]
1569
- {
1570
- let personality = self . rvalue_as_function ( _personality) ;
1571
- self . current_func ( ) . set_personality_function ( personality) ;
1572
- }
1576
+ self . current_func ( ) . set_personality_function ( _personality) ;
1573
1577
}
1574
1578
1575
1579
#[ cfg( feature = "master" ) ]
1576
- fn cleanup_landing_pad ( & mut self , pers_fn : RValue < ' gcc > ) -> ( RValue < ' gcc > , RValue < ' gcc > ) {
1580
+ fn cleanup_landing_pad ( & mut self , pers_fn : Function < ' gcc > ) -> ( RValue < ' gcc > , RValue < ' gcc > ) {
1577
1581
self . set_personality_fn ( pers_fn) ;
1578
1582
1579
1583
// NOTE: insert the current block in a variable so that a later call to invoke knows to
@@ -1594,7 +1598,7 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> {
1594
1598
}
1595
1599
1596
1600
#[ cfg( not( feature = "master" ) ) ]
1597
- fn cleanup_landing_pad ( & mut self , _pers_fn : RValue < ' gcc > ) -> ( RValue < ' gcc > , RValue < ' gcc > ) {
1601
+ fn cleanup_landing_pad ( & mut self , _pers_fn : Function < ' gcc > ) -> ( RValue < ' gcc > , RValue < ' gcc > ) {
1598
1602
let value1 = self
1599
1603
. current_func ( )
1600
1604
. new_local ( self . location , self . u8_type . make_pointer ( ) , "landing_pad0" )
@@ -1604,7 +1608,7 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> {
1604
1608
( value1, value2)
1605
1609
}
1606
1610
1607
- fn filter_landing_pad ( & mut self , pers_fn : RValue < ' gcc > ) -> ( RValue < ' gcc > , RValue < ' gcc > ) {
1611
+ fn filter_landing_pad ( & mut self , pers_fn : Function < ' gcc > ) -> ( RValue < ' gcc > , RValue < ' gcc > ) {
1608
1612
// TODO(antoyo): generate the correct landing pad
1609
1613
self . cleanup_landing_pad ( pers_fn)
1610
1614
}
@@ -2511,8 +2515,8 @@ impl ToGccOrdering for AtomicOrdering {
2511
2515
AtomicOrdering :: Relaxed => __ATOMIC_RELAXED, // TODO(antoyo): check if that's the same.
2512
2516
AtomicOrdering :: Acquire => __ATOMIC_ACQUIRE,
2513
2517
AtomicOrdering :: Release => __ATOMIC_RELEASE,
2514
- AtomicOrdering :: AcquireRelease => __ATOMIC_ACQ_REL,
2515
- AtomicOrdering :: SequentiallyConsistent => __ATOMIC_SEQ_CST,
2518
+ AtomicOrdering :: AcqRel => __ATOMIC_ACQ_REL,
2519
+ AtomicOrdering :: SeqCst => __ATOMIC_SEQ_CST,
2516
2520
} ;
2517
2521
ordering as i32
2518
2522
}
0 commit comments