@@ -167,7 +167,7 @@ impl<'ll, 'tcx> IntrinsicCallBuilderMethods<'tcx> for Builder<'_, 'll, 'tcx> {
167167 instance : ty:: Instance < ' tcx > ,
168168 fn_abi : & FnAbi < ' tcx , Ty < ' tcx > > ,
169169 args : & [ OperandRef < ' tcx , & ' ll Value > ] ,
170- llresult : & ' ll Value ,
170+ result : PlaceRef < ' tcx , & ' ll Value > ,
171171 span : Span ,
172172 ) -> Result < ( ) , ty:: Instance < ' tcx > > {
173173 let tcx = self . tcx ;
@@ -184,7 +184,6 @@ impl<'ll, 'tcx> IntrinsicCallBuilderMethods<'tcx> for Builder<'_, 'll, 'tcx> {
184184 let name = tcx. item_name ( def_id) ;
185185
186186 let llret_ty = self . layout_of ( ret_ty) . llvm_type ( self ) ;
187- let result = PlaceRef :: new_sized ( llresult, fn_abi. ret . layout ) ;
188187
189188 let simple = get_simple_intrinsic ( self , name) ;
190189 let llval = match name {
@@ -255,7 +254,7 @@ impl<'ll, 'tcx> IntrinsicCallBuilderMethods<'tcx> for Builder<'_, 'll, 'tcx> {
255254 args[ 0 ] . immediate ( ) ,
256255 args[ 1 ] . immediate ( ) ,
257256 args[ 2 ] . immediate ( ) ,
258- llresult ,
257+ result ,
259258 ) ;
260259 return Ok ( ( ) ) ;
261260 }
@@ -688,20 +687,19 @@ impl<'ll, 'tcx> IntrinsicCallBuilderMethods<'tcx> for Builder<'_, 'll, 'tcx> {
688687 }
689688}
690689
691- fn catch_unwind_intrinsic < ' ll > (
692- bx : & mut Builder < ' _ , ' ll , ' _ > ,
690+ fn catch_unwind_intrinsic < ' ll , ' tcx > (
691+ bx : & mut Builder < ' _ , ' ll , ' tcx > ,
693692 try_func : & ' ll Value ,
694693 data : & ' ll Value ,
695694 catch_func : & ' ll Value ,
696- dest : & ' ll Value ,
695+ dest : PlaceRef < ' tcx , & ' ll Value > ,
697696) {
698697 if bx. sess ( ) . panic_strategy ( ) == PanicStrategy :: Abort {
699698 let try_func_ty = bx. type_func ( & [ bx. type_ptr ( ) ] , bx. type_void ( ) ) ;
700699 bx. call ( try_func_ty, None , None , try_func, & [ data] , None , None ) ;
701700 // Return 0 unconditionally from the intrinsic call;
702701 // 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) ;
705703 } else if wants_msvc_seh ( bx. sess ( ) ) {
706704 codegen_msvc_try ( bx, try_func, data, catch_func, dest) ;
707705 } else if wants_wasm_eh ( bx. sess ( ) ) {
@@ -720,12 +718,12 @@ fn catch_unwind_intrinsic<'ll>(
720718// instructions are meant to work for all targets, as of the time of this
721719// writing, however, LLVM does not recommend the usage of these new instructions
722720// 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 > ,
725723 try_func : & ' ll Value ,
726724 data : & ' ll Value ,
727725 catch_func : & ' ll Value ,
728- dest : & ' ll Value ,
726+ dest : PlaceRef < ' tcx , & ' ll Value > ,
729727) {
730728 let ( llty, llfn) = get_rust_try_fn ( bx, & mut |mut bx| {
731729 bx. set_personality_fn ( bx. eh_personality ( ) ) ;
@@ -865,17 +863,16 @@ fn codegen_msvc_try<'ll>(
865863 // Note that no invoke is used here because by definition this function
866864 // can't panic (that's what it's catching).
867865 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) ;
870867}
871868
872869// 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 > ,
875872 try_func : & ' ll Value ,
876873 data : & ' ll Value ,
877874 catch_func : & ' ll Value ,
878- dest : & ' ll Value ,
875+ dest : PlaceRef < ' tcx , & ' ll Value > ,
879876) {
880877 let ( llty, llfn) = get_rust_try_fn ( bx, & mut |mut bx| {
881878 bx. set_personality_fn ( bx. eh_personality ( ) ) ;
@@ -939,8 +936,7 @@ fn codegen_wasm_try<'ll>(
939936 // Note that no invoke is used here because by definition this function
940937 // can't panic (that's what it's catching).
941938 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) ;
944940}
945941
946942// Definition of the standard `try` function for Rust using the GNU-like model
@@ -954,12 +950,12 @@ fn codegen_wasm_try<'ll>(
954950// function calling it, and that function may already have other personality
955951// functions in play. By calling a shim we're guaranteed that our shim will have
956952// 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 > ,
959955 try_func : & ' ll Value ,
960956 data : & ' ll Value ,
961957 catch_func : & ' ll Value ,
962- dest : & ' ll Value ,
958+ dest : PlaceRef < ' tcx , & ' ll Value > ,
963959) {
964960 let ( llty, llfn) = get_rust_try_fn ( bx, & mut |mut bx| {
965961 // Codegens the shims described above:
@@ -1006,19 +1002,18 @@ fn codegen_gnu_try<'ll>(
10061002 // Note that no invoke is used here because by definition this function
10071003 // can't panic (that's what it's catching).
10081004 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) ;
10111006}
10121007
10131008// Variant of codegen_gnu_try used for emscripten where Rust panics are
10141009// implemented using C++ exceptions. Here we use exceptions of a specific type
10151010// (`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 > ,
10181013 try_func : & ' ll Value ,
10191014 data : & ' ll Value ,
10201015 catch_func : & ' ll Value ,
1021- dest : & ' ll Value ,
1016+ dest : PlaceRef < ' tcx , & ' ll Value > ,
10221017) {
10231018 let ( llty, llfn) = get_rust_try_fn ( bx, & mut |mut bx| {
10241019 // Codegens the shims described above:
@@ -1089,8 +1084,7 @@ fn codegen_emcc_try<'ll>(
10891084 // Note that no invoke is used here because by definition this function
10901085 // can't panic (that's what it's catching).
10911086 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) ;
10941088}
10951089
10961090// Helper function to give a Block to a closure to codegen a shim function.
0 commit comments