@@ -30,7 +30,7 @@ use super::CachedModuleCodegen;
30
30
31
31
use abi;
32
32
use back:: write:: { self , OngoingCodegen } ;
33
- use llvm:: { self , TypeKind , get_param} ;
33
+ use llvm:: { self , get_param} ;
34
34
use metadata;
35
35
use rustc:: dep_graph:: cgu_reuse_tracker:: CguReuse ;
36
36
use rustc:: hir:: def_id:: { CrateNum , DefId , LOCAL_CRATE } ;
@@ -55,7 +55,7 @@ use builder::{Builder, MemFlags};
55
55
use callee;
56
56
use rustc_mir:: monomorphize:: collector:: { self , MonoItemCollectionMode } ;
57
57
use rustc_mir:: monomorphize:: item:: DefPathBasedNames ;
58
- use common:: { self , IntPredicate , RealPredicate } ;
58
+ use common:: { self , IntPredicate , RealPredicate , TypeKind } ;
59
59
use consts;
60
60
use context:: CodegenCx ;
61
61
use debuginfo;
@@ -67,7 +67,6 @@ use monomorphize::partitioning::{CodegenUnit, CodegenUnitExt};
67
67
use rustc_codegen_utils:: symbol_names_test;
68
68
use time_graph;
69
69
use mono_item:: { MonoItem , MonoItemExt } ;
70
- use type_:: Type ;
71
70
use type_of:: LayoutLlvmExt ;
72
71
use rustc:: util:: nodemap:: FxHashMap ;
73
72
use CrateInfo ;
@@ -334,21 +333,31 @@ pub fn coerce_unsized_into(
334
333
}
335
334
}
336
335
337
- pub fn cast_shift_expr_rhs (
338
- bx : & Builder < ' _ , ' ll , ' _ , & ' ll Value > , op : hir:: BinOpKind , lhs : & ' ll Value , rhs : & ' ll Value
339
- ) -> & ' ll Value {
336
+ pub fn cast_shift_expr_rhs < ' a , ' ll : ' a , ' tcx : ' ll , Builder : BuilderMethods < ' a , ' ll , ' tcx > > (
337
+ bx : & Builder ,
338
+ op : hir:: BinOpKind ,
339
+ lhs : <Builder :: CodegenCx as Backend >:: Value ,
340
+ rhs : <Builder :: CodegenCx as Backend >:: Value
341
+ ) -> <Builder :: CodegenCx as Backend >:: Value {
340
342
cast_shift_rhs ( bx, op, lhs, rhs, |a, b| bx. trunc ( a, b) , |a, b| bx. zext ( a, b) )
341
343
}
342
344
343
- fn cast_shift_rhs < ' ll , F , G > ( bx : & Builder < ' _ , ' ll , ' _ , & ' ll Value > ,
344
- op : hir:: BinOpKind ,
345
- lhs : & ' ll Value ,
346
- rhs : & ' ll Value ,
347
- trunc : F ,
348
- zext : G )
349
- -> & ' ll Value
350
- where F : FnOnce ( & ' ll Value , & ' ll Type ) -> & ' ll Value ,
351
- G : FnOnce ( & ' ll Value , & ' ll Type ) -> & ' ll Value
345
+ fn cast_shift_rhs < ' a , ' ll : ' a , ' tcx : ' ll , F , G , Builder : BuilderMethods < ' a , ' ll , ' tcx > > (
346
+ bx : & Builder ,
347
+ op : hir:: BinOpKind ,
348
+ lhs : <Builder :: CodegenCx as Backend >:: Value ,
349
+ rhs : <Builder :: CodegenCx as Backend >:: Value ,
350
+ trunc : F ,
351
+ zext : G
352
+ ) -> <Builder :: CodegenCx as Backend >:: Value
353
+ where F : FnOnce (
354
+ <Builder :: CodegenCx as Backend >:: Value ,
355
+ <Builder :: CodegenCx as Backend >:: Type
356
+ ) -> <Builder :: CodegenCx as Backend >:: Value ,
357
+ G : FnOnce (
358
+ <Builder :: CodegenCx as Backend >:: Value ,
359
+ <Builder :: CodegenCx as Backend >:: Type
360
+ ) -> <Builder :: CodegenCx as Backend >:: Value
352
361
{
353
362
// Shifts may have any size int on the rhs
354
363
if op. is_shift ( ) {
@@ -390,33 +399,33 @@ pub fn call_assume(bx: &Builder<'_, 'll, '_, &'ll Value>, val: &'ll Value) {
390
399
bx. call ( assume_intrinsic, & [ val] , None ) ;
391
400
}
392
401
393
- pub fn from_immediate < ' a , ' ll : ' a , ' tcx : ' ll > (
394
- bx : & Builder < ' _ , ' ll , ' _ , & ' ll Value > ,
395
- val : & ' ll Value
396
- ) -> & ' ll Value {
402
+ pub fn from_immediate < ' a , ' ll : ' a , ' tcx : ' ll , Builder : BuilderMethods < ' a , ' ll , ' tcx > > (
403
+ bx : & Builder ,
404
+ val : < Builder :: CodegenCx as Backend > :: Value
405
+ ) -> < Builder :: CodegenCx as Backend > :: Value {
397
406
if bx. cx ( ) . val_ty ( val) == bx. cx ( ) . type_i1 ( ) {
398
407
bx. zext ( val, bx. cx ( ) . type_i8 ( ) )
399
408
} else {
400
409
val
401
410
}
402
411
}
403
412
404
- pub fn to_immediate (
405
- bx : & Builder < ' _ , ' ll , ' _ , & ' ll Value > ,
406
- val : & ' ll Value ,
413
+ pub fn to_immediate < ' a , ' ll , ' tcx , Builder : BuilderMethods < ' a , ' ll , ' tcx > > (
414
+ bx : & Builder ,
415
+ val : < Builder :: CodegenCx as Backend > :: Value ,
407
416
layout : layout:: TyLayout ,
408
- ) -> & ' ll Value {
417
+ ) -> < Builder :: CodegenCx as Backend > :: Value {
409
418
if let layout:: Abi :: Scalar ( ref scalar) = layout. abi {
410
419
return to_immediate_scalar ( bx, val, scalar) ;
411
420
}
412
421
val
413
422
}
414
423
415
- pub fn to_immediate_scalar (
416
- bx : & Builder < ' _ , ' ll , ' _ , & ' ll Value > ,
417
- val : & ' ll Value ,
424
+ pub fn to_immediate_scalar < ' a , ' ll , ' tcx , Builder : BuilderMethods < ' a , ' ll , ' tcx > > (
425
+ bx : & Builder ,
426
+ val : < Builder :: CodegenCx as Backend > :: Value ,
418
427
scalar : & layout:: Scalar ,
419
- ) -> & ' ll Value {
428
+ ) -> < Builder :: CodegenCx as Backend > :: Value {
420
429
if scalar. is_bool ( ) {
421
430
return bx. trunc ( val, bx. cx ( ) . type_i1 ( ) ) ;
422
431
}
0 commit comments