@@ -173,7 +173,36 @@ fn call_simple_intrinsic<'ll, 'tcx>(
173173 ) )
174174}
175175
176+ fn emit_offload_preload < ' ll , ' tcx > (
177+ bx : & mut Builder < ' _ , ' ll , ' tcx > ,
178+ tcx : TyCtxt < ' tcx > ,
179+ instance : ty:: Instance < ' tcx > ,
180+ args : & [ OperandRef < ' tcx , & ' ll llvm:: Value > ] ,
181+ is_mut : bool ,
182+ ) {
183+ if tcx. sess . opts . unstable_opts . offload . is_empty ( ) {
184+ let _ = tcx. dcx ( ) . emit_almost_fatal ( OffloadWithoutEnable ) ;
185+ }
186+
187+ if tcx. sess . lto ( ) != rustc_session:: config:: Lto :: Fat {
188+ let _ = tcx. dcx ( ) . emit_almost_fatal ( OffloadWithoutFatLTO ) ;
189+ }
190+
191+ dbg ! ( "HI!" ) ;
192+ codegen_offload_preload ( bx, tcx, instance, args) ;
193+ }
194+
176195impl < ' ll , ' tcx > IntrinsicCallBuilderMethods < ' tcx > for Builder < ' _ , ' ll , ' tcx > {
196+ fn codegen_offload_preload_call (
197+ & mut self ,
198+ instance : ty:: Instance < ' tcx > ,
199+ args : & [ OperandRef < ' tcx , & ' ll llvm:: Value > ] ,
200+ is_mut : bool ,
201+ ) {
202+ let tcx = self . tcx ;
203+ emit_offload_preload ( self , tcx, instance, args, is_mut) ;
204+ }
205+
177206 fn codegen_intrinsic_call (
178207 & mut self ,
179208 instance : ty:: Instance < ' tcx > ,
@@ -246,18 +275,18 @@ impl<'ll, 'tcx> IntrinsicCallBuilderMethods<'tcx> for Builder<'_, 'll, 'tcx> {
246275 // offload *has* a return type, but somehow works without mentioning the place
247276 return IntrinsicResult :: WroteIntoPlace ;
248277 }
249- sym:: preload => {
250- if tcx. sess . opts . unstable_opts . offload . is_empty ( ) {
251- let _ = tcx. dcx ( ) . emit_almost_fatal ( OffloadWithoutEnable ) ;
252- }
278+ // sym::preload => {
279+ // if tcx.sess.opts.unstable_opts.offload.is_empty() {
280+ // let _ = tcx.dcx().emit_almost_fatal(OffloadWithoutEnable);
281+ // }
253282
254- if tcx. sess . lto ( ) != rustc_session:: config:: Lto :: Fat {
255- let _ = tcx. dcx ( ) . emit_almost_fatal ( OffloadWithoutFatLTO ) ;
256- }
283+ // if tcx.sess.lto() != rustc_session::config::Lto::Fat {
284+ // let _ = tcx.dcx().emit_almost_fatal(OffloadWithoutFatLTO);
285+ // }
257286
258- codegen_offload_preload ( self , tcx, instance, args) ;
259- return IntrinsicResult :: WroteIntoPlace ;
260- }
287+ // codegen_offload_preload(self, tcx, instance, args);
288+ // return IntrinsicResult::WroteIntoPlace;
289+ // }
261290 sym:: is_val_statically_known => {
262291 if let OperandValue :: Immediate ( imm) = args[ 0 ] . val {
263292 self . call_intrinsic (
@@ -1960,6 +1989,7 @@ fn codegen_offload_preload<'ll, 'tcx>(
19601989 let metadata = & [ meta] ;
19611990 let types = bx. cx . layout_of ( pointee_ty) . llvm_type ( bx. cx ) ;
19621991
1992+ dbg ! ( "asdf" ) ;
19631993 let offload_globals_ref = cx. offload_globals . borrow ( ) ;
19641994 let offload_globals = match offload_globals_ref. as_ref ( ) {
19651995 Some ( globals) => globals,
@@ -1968,6 +1998,7 @@ fn codegen_offload_preload<'ll, 'tcx>(
19681998 return ;
19691999 }
19702000 } ;
2001+ dbg ! ( "asdf" ) ;
19712002 let target_symbol = "asdf_I_ll_nameclash" . to_owned ( ) ;
19722003 let offload_data = gen_define_handling ( & cx, metadata, target_symbol, offload_globals) ;
19732004 let has_dynamic = metadata. iter ( ) . any ( |m| !matches ! ( m. payload_size, OffloadSize :: Static ( _) ) ) ;
0 commit comments