@@ -72,14 +72,18 @@ use mir::operand::OperandValue;
7272use std:: marker:: PhantomData ;
7373
7474
75- pub struct StatRecorder < ' a , ' ll : ' a , ' tcx : ' ll , Cx : ' a + CodegenMethods < ' ll , ' tcx > > {
75+ pub struct StatRecorder < ' a , ' ll : ' a , ' tcx : ' ll , Cx : ' a + CodegenMethods < ' a , ' ll , ' tcx > >
76+ where & ' a Cx : LayoutOf < Ty = Ty < ' tcx > , TyLayout = TyLayout < ' tcx > > + HasTyCtxt < ' tcx >
77+ {
7678 cx : & ' a Cx ,
7779 name : Option < String > ,
7880 istart : usize ,
7981 phantom : PhantomData < ( & ' ll ( ) , & ' tcx ( ) ) >
8082}
8183
82- impl < ' a , ' ll : ' a , ' tcx : ' ll , Cx : ' a + CodegenMethods < ' ll , ' tcx > > StatRecorder < ' a , ' ll , ' tcx , Cx > {
84+ impl < ' a , ' ll : ' a , ' tcx : ' ll , Cx : ' a + CodegenMethods < ' a , ' ll , ' tcx > > StatRecorder < ' a , ' ll , ' tcx , Cx >
85+ where & ' a Cx : LayoutOf < Ty = Ty < ' tcx > , TyLayout = TyLayout < ' tcx > > + HasTyCtxt < ' tcx >
86+ {
8387 pub fn new ( cx : & ' a Cx , name : String ) -> Self {
8488 let istart = cx. stats ( ) . borrow ( ) . n_llvm_insns ;
8589 StatRecorder {
@@ -91,8 +95,9 @@ impl<'a, 'll: 'a, 'tcx: 'll, Cx: 'a + CodegenMethods<'ll, 'tcx>> StatRecorder<'a
9195 }
9296}
9397
94- impl < ' a , ' ll : ' a , ' tcx : ' ll , Cx : ' a + CodegenMethods < ' ll , ' tcx > > Drop for
98+ impl < ' a , ' ll : ' a , ' tcx : ' ll , Cx : ' a + CodegenMethods < ' a , ' ll , ' tcx > > Drop for
9599 StatRecorder < ' a , ' ll , ' tcx , Cx >
100+ where & ' a Cx : LayoutOf < Ty = Ty < ' tcx > , TyLayout = TyLayout < ' tcx > > + HasTyCtxt < ' tcx >
96101{
97102 fn drop ( & mut self ) {
98103 if self . cx . sess ( ) . codegen_stats ( ) {
@@ -147,7 +152,9 @@ pub fn compare_simd_types<'a, 'll:'a, 'tcx:'ll, Bx : BuilderMethods<'a, 'll, 'tc
147152 t : Ty < ' tcx > ,
148153 ret_ty : <Bx :: CodegenCx as Backend < ' ll > >:: Type ,
149154 op : hir:: BinOpKind
150- ) -> <Bx :: CodegenCx as Backend < ' ll > >:: Value {
155+ ) -> <Bx :: CodegenCx as Backend < ' ll > >:: Value
156+ where & ' a Bx :: CodegenCx : LayoutOf < Ty = Ty < ' tcx > , TyLayout = TyLayout < ' tcx > > + HasTyCtxt < ' tcx >
157+ {
151158 let signed = match t. sty {
152159 ty:: Float ( _) => {
153160 let cmp = bin_op_to_fcmp_predicate ( op) ;
@@ -174,7 +181,7 @@ pub fn compare_simd_types<'a, 'll:'a, 'tcx:'ll, Bx : BuilderMethods<'a, 'll, 'tc
174181/// The `old_info` argument is a bit funny. It is intended for use
175182/// in an upcast, where the new vtable for an object will be derived
176183/// from the old one.
177- pub fn unsized_info < ' a , ' ll : ' a , ' tcx : ' ll , Cx : ' a + CodegenMethods < ' ll , ' tcx > > (
184+ pub fn unsized_info < ' a , ' ll : ' a , ' tcx : ' ll , Cx : ' a + CodegenMethods < ' a , ' ll , ' tcx > > (
178185 cx : & ' a Cx ,
179186 source : Ty < ' tcx > ,
180187 target : Ty < ' tcx > ,
@@ -326,7 +333,9 @@ pub fn cast_shift_expr_rhs<'a, 'll: 'a, 'tcx: 'll, Bx : BuilderMethods<'a, 'll,
326333 op : hir:: BinOpKind ,
327334 lhs : <Bx :: CodegenCx as Backend < ' ll > >:: Value ,
328335 rhs : <Bx :: CodegenCx as Backend < ' ll > >:: Value
329- ) -> <Bx :: CodegenCx as Backend < ' ll > >:: Value {
336+ ) -> <Bx :: CodegenCx as Backend < ' ll > >:: Value
337+ where & ' a Bx :: CodegenCx : LayoutOf < Ty = Ty < ' tcx > , TyLayout = TyLayout < ' tcx > > + HasTyCtxt < ' tcx >
338+ {
330339 cast_shift_rhs ( bx, op, lhs, rhs)
331340}
332341
@@ -335,7 +344,9 @@ fn cast_shift_rhs<'a, 'll :'a, 'tcx : 'll, Bx : BuilderMethods<'a, 'll, 'tcx>>(
335344 op : hir:: BinOpKind ,
336345 lhs : <Bx :: CodegenCx as Backend < ' ll > >:: Value ,
337346 rhs : <Bx :: CodegenCx as Backend < ' ll > >:: Value ,
338- ) -> <Bx :: CodegenCx as Backend < ' ll > >:: Value {
347+ ) -> <Bx :: CodegenCx as Backend < ' ll > >:: Value
348+ where & ' a Bx :: CodegenCx : LayoutOf < Ty = Ty < ' tcx > , TyLayout = TyLayout < ' tcx > > + HasTyCtxt < ' tcx >
349+ {
339350 // Shifts may have any size int on the rhs
340351 if op. is_shift ( ) {
341352 let mut rhs_llty = bx. cx ( ) . val_ty ( rhs) ;
@@ -374,15 +385,19 @@ pub fn wants_msvc_seh(sess: &Session) -> bool {
374385pub fn call_assume < ' a , ' ll : ' a , ' tcx : ' ll , Bx : BuilderMethods < ' a , ' ll , ' tcx > > (
375386 bx : & mut Bx ,
376387 val : <Bx :: CodegenCx as Backend < ' ll > >:: Value
377- ) {
388+ )
389+ where & ' a Bx :: CodegenCx : LayoutOf < Ty = Ty < ' tcx > , TyLayout = TyLayout < ' tcx > > + HasTyCtxt < ' tcx >
390+ {
378391 let assume_intrinsic = bx. cx ( ) . get_intrinsic ( "llvm.assume" ) ;
379392 bx. call ( assume_intrinsic, & [ val] , None ) ;
380393}
381394
382395pub fn from_immediate < ' a , ' ll : ' a , ' tcx : ' ll , Bx : BuilderMethods < ' a , ' ll , ' tcx > > (
383396 bx : & mut Bx ,
384397 val : <Bx :: CodegenCx as Backend < ' ll > >:: Value
385- ) -> <Bx :: CodegenCx as Backend < ' ll > >:: Value {
398+ ) -> <Bx :: CodegenCx as Backend < ' ll > >:: Value
399+ where & ' a Bx :: CodegenCx : LayoutOf < Ty = Ty < ' tcx > , TyLayout = TyLayout < ' tcx > > + HasTyCtxt < ' tcx >
400+ {
386401 if bx. cx ( ) . val_ty ( val) == bx. cx ( ) . type_i1 ( ) {
387402 bx. zext ( val, bx. cx ( ) . type_i8 ( ) )
388403 } else {
@@ -394,7 +409,9 @@ pub fn to_immediate<'a, 'll: 'a, 'tcx: 'll, Bx : BuilderMethods<'a, 'll, 'tcx>>(
394409 bx : & mut Bx ,
395410 val : <Bx :: CodegenCx as Backend < ' ll > >:: Value ,
396411 layout : layout:: TyLayout ,
397- ) -> <Bx :: CodegenCx as Backend < ' ll > >:: Value {
412+ ) -> <Bx :: CodegenCx as Backend < ' ll > >:: Value
413+ where & ' a Bx :: CodegenCx : LayoutOf < Ty = Ty < ' tcx > , TyLayout = TyLayout < ' tcx > > + HasTyCtxt < ' tcx >
414+ {
398415 if let layout:: Abi :: Scalar ( ref scalar) = layout. abi {
399416 return to_immediate_scalar ( bx, val, scalar) ;
400417 }
@@ -405,7 +422,9 @@ pub fn to_immediate_scalar<'a, 'll :'a, 'tcx :'ll, Bx : BuilderMethods<'a, 'll,
405422 bx : & mut Bx ,
406423 val : <Bx :: CodegenCx as Backend < ' ll > >:: Value ,
407424 scalar : & layout:: Scalar ,
408- ) -> <Bx :: CodegenCx as Backend < ' ll > >:: Value {
425+ ) -> <Bx :: CodegenCx as Backend < ' ll > >:: Value
426+ where & ' a Bx :: CodegenCx : LayoutOf < Ty = Ty < ' tcx > , TyLayout = TyLayout < ' tcx > > + HasTyCtxt < ' tcx >
427+ {
409428 if scalar. is_bool ( ) {
410429 return bx. trunc ( val, bx. cx ( ) . type_i1 ( ) ) ;
411430 }
@@ -419,7 +438,9 @@ pub fn memcpy_ty<'a, 'll: 'a, 'tcx: 'll, Bx : BuilderMethods<'a, 'll, 'tcx>>(
419438 layout : TyLayout < ' tcx > ,
420439 align : Align ,
421440 flags : MemFlags ,
422- ) {
441+ )
442+ where & ' a Bx :: CodegenCx : LayoutOf < Ty = Ty < ' tcx > , TyLayout = TyLayout < ' tcx > > + HasTyCtxt < ' tcx >
443+ {
423444 let size = layout. size . bytes ( ) ;
424445 if size == 0 {
425446 return ;
@@ -467,7 +488,9 @@ pub fn codegen_instance<'a, 'll: 'a, 'tcx: 'll, Bx: BuilderMethods<'a, 'll, 'tcx
467488/// users main function.
468489pub fn maybe_create_entry_wrapper < ' a , ' ll : ' a , ' tcx : ' ll , Bx : BuilderMethods < ' a , ' ll , ' tcx > > (
469490 cx : & ' a Bx :: CodegenCx
470- ) {
491+ )
492+ where & ' a Bx :: CodegenCx : LayoutOf < Ty = Ty < ' tcx > , TyLayout = TyLayout < ' tcx > > + HasTyCtxt < ' tcx >
493+ {
471494 let ( main_def_id, span) = match * cx. sess ( ) . entry_fn . borrow ( ) {
472495 Some ( ( id, span, _) ) => {
473496 ( cx. tcx ( ) . hir . local_def_id ( id) , span)
@@ -498,7 +521,10 @@ pub fn maybe_create_entry_wrapper<'a, 'll: 'a, 'tcx: 'll, Bx: BuilderMethods<'a,
498521 rust_main : <Bx :: CodegenCx as Backend < ' ll > >:: Value ,
499522 rust_main_def_id : DefId ,
500523 use_start_lang_item : bool ,
501- ) {
524+ )
525+ where & ' a Bx :: CodegenCx :
526+ LayoutOf < Ty = Ty < ' tcx > , TyLayout = TyLayout < ' tcx > > + HasTyCtxt < ' tcx >
527+ {
502528 let llfty =
503529 cx. type_func ( & [ cx. type_int ( ) , cx. type_ptr_to ( cx. type_i8p ( ) ) ] , cx. type_int ( ) ) ;
504530
@@ -551,7 +577,7 @@ pub fn maybe_create_entry_wrapper<'a, 'll: 'a, 'tcx: 'll, Bx: BuilderMethods<'a,
551577 } ;
552578
553579 let result = bx. call ( start_fn, & args, None ) ;
554- let cast = bx. intcast ( result, cx. type_int ( ) , true ) ;
580+ let cast = bx. intcast ( result, cx. type_int ( ) , true ) ;
555581 bx. ret ( cast) ;
556582 }
557583}
0 commit comments