@@ -167,7 +167,7 @@ impl<'ll, 'tcx> IntrinsicCallBuilderMethods<'tcx> for Builder<'_, 'll, 'tcx> {
167
167
instance : ty:: Instance < ' tcx > ,
168
168
fn_abi : & FnAbi < ' tcx , Ty < ' tcx > > ,
169
169
args : & [ OperandRef < ' tcx , & ' ll Value > ] ,
170
- llresult : & ' ll Value ,
170
+ result : PlaceRef < ' tcx , & ' ll Value > ,
171
171
span : Span ,
172
172
) -> Result < ( ) , ty:: Instance < ' tcx > > {
173
173
let tcx = self . tcx ;
@@ -184,7 +184,6 @@ impl<'ll, 'tcx> IntrinsicCallBuilderMethods<'tcx> for Builder<'_, 'll, 'tcx> {
184
184
let name = tcx. item_name ( def_id) ;
185
185
186
186
let llret_ty = self . layout_of ( ret_ty) . llvm_type ( self ) ;
187
- let result = PlaceRef :: new_sized ( llresult, fn_abi. ret . layout ) ;
188
187
189
188
let simple = get_simple_intrinsic ( self , name) ;
190
189
let llval = match name {
@@ -255,7 +254,7 @@ impl<'ll, 'tcx> IntrinsicCallBuilderMethods<'tcx> for Builder<'_, 'll, 'tcx> {
255
254
args[ 0 ] . immediate ( ) ,
256
255
args[ 1 ] . immediate ( ) ,
257
256
args[ 2 ] . immediate ( ) ,
258
- llresult ,
257
+ result ,
259
258
) ;
260
259
return Ok ( ( ) ) ;
261
260
}
@@ -688,20 +687,19 @@ impl<'ll, 'tcx> IntrinsicCallBuilderMethods<'tcx> for Builder<'_, 'll, 'tcx> {
688
687
}
689
688
}
690
689
691
- fn catch_unwind_intrinsic < ' ll > (
692
- bx : & mut Builder < ' _ , ' ll , ' _ > ,
690
+ fn catch_unwind_intrinsic < ' ll , ' tcx > (
691
+ bx : & mut Builder < ' _ , ' ll , ' tcx > ,
693
692
try_func : & ' ll Value ,
694
693
data : & ' ll Value ,
695
694
catch_func : & ' ll Value ,
696
- dest : & ' ll Value ,
695
+ dest : PlaceRef < ' tcx , & ' ll Value > ,
697
696
) {
698
697
if bx. sess ( ) . panic_strategy ( ) == PanicStrategy :: Abort {
699
698
let try_func_ty = bx. type_func ( & [ bx. type_ptr ( ) ] , bx. type_void ( ) ) ;
700
699
bx. call ( try_func_ty, None , None , try_func, & [ data] , None , None ) ;
701
700
// Return 0 unconditionally from the intrinsic call;
702
701
// we can never unwind.
703
- let ret_align = bx. tcx ( ) . data_layout . i32_align . abi ;
704
- bx. store ( bx. const_i32 ( 0 ) , dest, ret_align) ;
702
+ OperandValue :: Immediate ( bx. const_i32 ( 0 ) ) . store ( bx, dest) ;
705
703
} else if wants_msvc_seh ( bx. sess ( ) ) {
706
704
codegen_msvc_try ( bx, try_func, data, catch_func, dest) ;
707
705
} else if wants_wasm_eh ( bx. sess ( ) ) {
@@ -720,12 +718,12 @@ fn catch_unwind_intrinsic<'ll>(
720
718
// instructions are meant to work for all targets, as of the time of this
721
719
// writing, however, LLVM does not recommend the usage of these new instructions
722
720
// as the old ones are still more optimized.
723
- fn codegen_msvc_try < ' ll > (
724
- bx : & mut Builder < ' _ , ' ll , ' _ > ,
721
+ fn codegen_msvc_try < ' ll , ' tcx > (
722
+ bx : & mut Builder < ' _ , ' ll , ' tcx > ,
725
723
try_func : & ' ll Value ,
726
724
data : & ' ll Value ,
727
725
catch_func : & ' ll Value ,
728
- dest : & ' ll Value ,
726
+ dest : PlaceRef < ' tcx , & ' ll Value > ,
729
727
) {
730
728
let ( llty, llfn) = get_rust_try_fn ( bx, & mut |mut bx| {
731
729
bx. set_personality_fn ( bx. eh_personality ( ) ) ;
@@ -865,17 +863,16 @@ fn codegen_msvc_try<'ll>(
865
863
// Note that no invoke is used here because by definition this function
866
864
// can't panic (that's what it's catching).
867
865
let ret = bx. call ( llty, None , None , llfn, & [ try_func, data, catch_func] , None , None ) ;
868
- let i32_align = bx. tcx ( ) . data_layout . i32_align . abi ;
869
- bx. store ( ret, dest, i32_align) ;
866
+ OperandValue :: Immediate ( ret) . store ( bx, dest) ;
870
867
}
871
868
872
869
// WASM's definition of the `rust_try` function.
873
- fn codegen_wasm_try < ' ll > (
874
- bx : & mut Builder < ' _ , ' ll , ' _ > ,
870
+ fn codegen_wasm_try < ' ll , ' tcx > (
871
+ bx : & mut Builder < ' _ , ' ll , ' tcx > ,
875
872
try_func : & ' ll Value ,
876
873
data : & ' ll Value ,
877
874
catch_func : & ' ll Value ,
878
- dest : & ' ll Value ,
875
+ dest : PlaceRef < ' tcx , & ' ll Value > ,
879
876
) {
880
877
let ( llty, llfn) = get_rust_try_fn ( bx, & mut |mut bx| {
881
878
bx. set_personality_fn ( bx. eh_personality ( ) ) ;
@@ -939,8 +936,7 @@ fn codegen_wasm_try<'ll>(
939
936
// Note that no invoke is used here because by definition this function
940
937
// can't panic (that's what it's catching).
941
938
let ret = bx. call ( llty, None , None , llfn, & [ try_func, data, catch_func] , None , None ) ;
942
- let i32_align = bx. tcx ( ) . data_layout . i32_align . abi ;
943
- bx. store ( ret, dest, i32_align) ;
939
+ OperandValue :: Immediate ( ret) . store ( bx, dest) ;
944
940
}
945
941
946
942
// Definition of the standard `try` function for Rust using the GNU-like model
@@ -954,12 +950,12 @@ fn codegen_wasm_try<'ll>(
954
950
// function calling it, and that function may already have other personality
955
951
// functions in play. By calling a shim we're guaranteed that our shim will have
956
952
// the right personality function.
957
- fn codegen_gnu_try < ' ll > (
958
- bx : & mut Builder < ' _ , ' ll , ' _ > ,
953
+ fn codegen_gnu_try < ' ll , ' tcx > (
954
+ bx : & mut Builder < ' _ , ' ll , ' tcx > ,
959
955
try_func : & ' ll Value ,
960
956
data : & ' ll Value ,
961
957
catch_func : & ' ll Value ,
962
- dest : & ' ll Value ,
958
+ dest : PlaceRef < ' tcx , & ' ll Value > ,
963
959
) {
964
960
let ( llty, llfn) = get_rust_try_fn ( bx, & mut |mut bx| {
965
961
// Codegens the shims described above:
@@ -1006,19 +1002,18 @@ fn codegen_gnu_try<'ll>(
1006
1002
// Note that no invoke is used here because by definition this function
1007
1003
// can't panic (that's what it's catching).
1008
1004
let ret = bx. call ( llty, None , None , llfn, & [ try_func, data, catch_func] , None , None ) ;
1009
- let i32_align = bx. tcx ( ) . data_layout . i32_align . abi ;
1010
- bx. store ( ret, dest, i32_align) ;
1005
+ OperandValue :: Immediate ( ret) . store ( bx, dest) ;
1011
1006
}
1012
1007
1013
1008
// Variant of codegen_gnu_try used for emscripten where Rust panics are
1014
1009
// implemented using C++ exceptions. Here we use exceptions of a specific type
1015
1010
// (`struct rust_panic`) to represent Rust panics.
1016
- fn codegen_emcc_try < ' ll > (
1017
- bx : & mut Builder < ' _ , ' ll , ' _ > ,
1011
+ fn codegen_emcc_try < ' ll , ' tcx > (
1012
+ bx : & mut Builder < ' _ , ' ll , ' tcx > ,
1018
1013
try_func : & ' ll Value ,
1019
1014
data : & ' ll Value ,
1020
1015
catch_func : & ' ll Value ,
1021
- dest : & ' ll Value ,
1016
+ dest : PlaceRef < ' tcx , & ' ll Value > ,
1022
1017
) {
1023
1018
let ( llty, llfn) = get_rust_try_fn ( bx, & mut |mut bx| {
1024
1019
// Codegens the shims described above:
@@ -1089,8 +1084,7 @@ fn codegen_emcc_try<'ll>(
1089
1084
// Note that no invoke is used here because by definition this function
1090
1085
// can't panic (that's what it's catching).
1091
1086
let ret = bx. call ( llty, None , None , llfn, & [ try_func, data, catch_func] , None , None ) ;
1092
- let i32_align = bx. tcx ( ) . data_layout . i32_align . abi ;
1093
- bx. store ( ret, dest, i32_align) ;
1087
+ OperandValue :: Immediate ( ret) . store ( bx, dest) ;
1094
1088
}
1095
1089
1096
1090
// Helper function to give a Block to a closure to codegen a shim function.
0 commit comments