@@ -12,7 +12,7 @@ use llvm::{AtomicRmwBinOp, AtomicOrdering, SynchronizationScope, AsmDialect};
12
12
use llvm:: { self , False , OperandBundleDef , BasicBlock } ;
13
13
use common:: { self , * } ;
14
14
use context:: CodegenCx ;
15
- use type_;
15
+ use type_:: Type ;
16
16
use value:: Value ;
17
17
use libc:: { c_uint, c_char} ;
18
18
use rustc:: ty:: TyCtxt ;
@@ -59,14 +59,16 @@ bitflags! {
59
59
impl Backend for Builder < ' a , ' ll , ' tcx , & ' ll Value > {
60
60
type Value = & ' ll Value ;
61
61
type BasicBlock = & ' ll BasicBlock ;
62
- type Type = & ' ll type_ :: Type ;
62
+ type Type = & ' ll Type ;
63
63
type TypeKind = llvm:: TypeKind ;
64
64
type Context = & ' ll llvm:: Context ;
65
65
}
66
66
67
67
impl BuilderMethods < ' a , ' ll , ' tcx >
68
68
for Builder < ' a , ' ll , ' tcx , & ' ll Value > {
69
69
70
+ type CodegenCx = CodegenCx < ' ll , ' tcx , & ' ll Value > ;
71
+
70
72
fn new_block < ' b > (
71
73
cx : & ' a CodegenCx < ' ll , ' tcx , & ' ll Value > ,
72
74
llfn : & ' ll Value ,
@@ -455,15 +457,15 @@ impl BuilderMethods<'a, 'll, 'tcx>
455
457
}
456
458
}
457
459
458
- fn alloca ( & self , ty : Self :: Type , name : & str , align : Align ) -> & ' ll Value {
460
+ fn alloca ( & self , ty : & ' ll Type , name : & str , align : Align ) -> & ' ll Value {
459
461
let bx = Builder :: with_cx ( self . cx ) ;
460
462
bx. position_at_start ( unsafe {
461
463
llvm:: LLVMGetFirstBasicBlock ( self . llfn ( ) )
462
464
} ) ;
463
465
bx. dynamic_alloca ( ty, name, align)
464
466
}
465
467
466
- fn dynamic_alloca ( & self , ty : Self :: Type , name : & str , align : Align ) -> & ' ll Value {
468
+ fn dynamic_alloca ( & self , ty : & ' ll Type , name : & str , align : Align ) -> & ' ll Value {
467
469
self . count_insn ( "alloca" ) ;
468
470
unsafe {
469
471
let alloca = if name. is_empty ( ) {
@@ -479,7 +481,7 @@ impl BuilderMethods<'a, 'll, 'tcx>
479
481
}
480
482
481
483
fn array_alloca ( & self ,
482
- ty : Self :: Type ,
484
+ ty : & ' ll Type ,
483
485
len : & ' ll Value ,
484
486
name : & str ,
485
487
align : Align ) -> & ' ll Value {
@@ -638,92 +640,92 @@ impl BuilderMethods<'a, 'll, 'tcx>
638
640
}
639
641
640
642
/* Casts */
641
- fn trunc ( & self , val : & ' ll Value , dest_ty : Self :: Type ) -> & ' ll Value {
643
+ fn trunc ( & self , val : & ' ll Value , dest_ty : & ' ll Type ) -> & ' ll Value {
642
644
self . count_insn ( "trunc" ) ;
643
645
unsafe {
644
646
llvm:: LLVMBuildTrunc ( self . llbuilder , val, dest_ty, noname ( ) )
645
647
}
646
648
}
647
649
648
- fn sext ( & self , val : & ' ll Value , dest_ty : Self :: Type ) -> & ' ll Value {
650
+ fn sext ( & self , val : & ' ll Value , dest_ty : & ' ll Type ) -> & ' ll Value {
649
651
self . count_insn ( "sext" ) ;
650
652
unsafe {
651
653
llvm:: LLVMBuildSExt ( self . llbuilder , val, dest_ty, noname ( ) )
652
654
}
653
655
}
654
656
655
- fn fptoui ( & self , val : & ' ll Value , dest_ty : Self :: Type ) -> & ' ll Value {
657
+ fn fptoui ( & self , val : & ' ll Value , dest_ty : & ' ll Type ) -> & ' ll Value {
656
658
self . count_insn ( "fptoui" ) ;
657
659
unsafe {
658
660
llvm:: LLVMBuildFPToUI ( self . llbuilder , val, dest_ty, noname ( ) )
659
661
}
660
662
}
661
663
662
- fn fptosi ( & self , val : & ' ll Value , dest_ty : Self :: Type ) -> & ' ll Value {
664
+ fn fptosi ( & self , val : & ' ll Value , dest_ty : & ' ll Type ) -> & ' ll Value {
663
665
self . count_insn ( "fptosi" ) ;
664
666
unsafe {
665
667
llvm:: LLVMBuildFPToSI ( self . llbuilder , val, dest_ty, noname ( ) )
666
668
}
667
669
}
668
670
669
- fn uitofp ( & self , val : & ' ll Value , dest_ty : Self :: Type ) -> & ' ll Value {
671
+ fn uitofp ( & self , val : & ' ll Value , dest_ty : & ' ll Type ) -> & ' ll Value {
670
672
self . count_insn ( "uitofp" ) ;
671
673
unsafe {
672
674
llvm:: LLVMBuildUIToFP ( self . llbuilder , val, dest_ty, noname ( ) )
673
675
}
674
676
}
675
677
676
- fn sitofp ( & self , val : & ' ll Value , dest_ty : Self :: Type ) -> & ' ll Value {
678
+ fn sitofp ( & self , val : & ' ll Value , dest_ty : & ' ll Type ) -> & ' ll Value {
677
679
self . count_insn ( "sitofp" ) ;
678
680
unsafe {
679
681
llvm:: LLVMBuildSIToFP ( self . llbuilder , val, dest_ty, noname ( ) )
680
682
}
681
683
}
682
684
683
- fn fptrunc ( & self , val : & ' ll Value , dest_ty : Self :: Type ) -> & ' ll Value {
685
+ fn fptrunc ( & self , val : & ' ll Value , dest_ty : & ' ll Type ) -> & ' ll Value {
684
686
self . count_insn ( "fptrunc" ) ;
685
687
unsafe {
686
688
llvm:: LLVMBuildFPTrunc ( self . llbuilder , val, dest_ty, noname ( ) )
687
689
}
688
690
}
689
691
690
- fn fpext ( & self , val : & ' ll Value , dest_ty : Self :: Type ) -> & ' ll Value {
692
+ fn fpext ( & self , val : & ' ll Value , dest_ty : & ' ll Type ) -> & ' ll Value {
691
693
self . count_insn ( "fpext" ) ;
692
694
unsafe {
693
695
llvm:: LLVMBuildFPExt ( self . llbuilder , val, dest_ty, noname ( ) )
694
696
}
695
697
}
696
698
697
- fn ptrtoint ( & self , val : & ' ll Value , dest_ty : Self :: Type ) -> & ' ll Value {
699
+ fn ptrtoint ( & self , val : & ' ll Value , dest_ty : & ' ll Type ) -> & ' ll Value {
698
700
self . count_insn ( "ptrtoint" ) ;
699
701
unsafe {
700
702
llvm:: LLVMBuildPtrToInt ( self . llbuilder , val, dest_ty, noname ( ) )
701
703
}
702
704
}
703
705
704
- fn inttoptr ( & self , val : & ' ll Value , dest_ty : Self :: Type ) -> & ' ll Value {
706
+ fn inttoptr ( & self , val : & ' ll Value , dest_ty : & ' ll Type ) -> & ' ll Value {
705
707
self . count_insn ( "inttoptr" ) ;
706
708
unsafe {
707
709
llvm:: LLVMBuildIntToPtr ( self . llbuilder , val, dest_ty, noname ( ) )
708
710
}
709
711
}
710
712
711
- fn bitcast ( & self , val : & ' ll Value , dest_ty : Self :: Type ) -> & ' ll Value {
713
+ fn bitcast ( & self , val : & ' ll Value , dest_ty : & ' ll Type ) -> & ' ll Value {
712
714
self . count_insn ( "bitcast" ) ;
713
715
unsafe {
714
716
llvm:: LLVMBuildBitCast ( self . llbuilder , val, dest_ty, noname ( ) )
715
717
}
716
718
}
717
719
718
720
719
- fn intcast ( & self , val : & ' ll Value , dest_ty : Self :: Type , is_signed : bool ) -> & ' ll Value {
721
+ fn intcast ( & self , val : & ' ll Value , dest_ty : & ' ll Type , is_signed : bool ) -> & ' ll Value {
720
722
self . count_insn ( "intcast" ) ;
721
723
unsafe {
722
724
llvm:: LLVMRustBuildIntCast ( self . llbuilder , val, dest_ty, is_signed)
723
725
}
724
726
}
725
727
726
- fn pointercast ( & self , val : & ' ll Value , dest_ty : Self :: Type ) -> & ' ll Value {
728
+ fn pointercast ( & self , val : & ' ll Value , dest_ty : & ' ll Type ) -> & ' ll Value {
727
729
self . count_insn ( "pointercast" ) ;
728
730
unsafe {
729
731
llvm:: LLVMBuildPointerCast ( self . llbuilder , val, dest_ty, noname ( ) )
@@ -747,14 +749,14 @@ impl BuilderMethods<'a, 'll, 'tcx>
747
749
}
748
750
749
751
/* Miscellaneous instructions */
750
- fn empty_phi ( & self , ty : Self :: Type ) -> & ' ll Value {
752
+ fn empty_phi ( & self , ty : & ' ll Type ) -> & ' ll Value {
751
753
self . count_insn ( "emptyphi" ) ;
752
754
unsafe {
753
755
llvm:: LLVMBuildPhi ( self . llbuilder , ty, noname ( ) )
754
756
}
755
757
}
756
758
757
- fn phi ( & self , ty : Self :: Type , vals : & [ & ' ll Value ] , bbs : & [ & ' ll BasicBlock ] ) -> & ' ll Value {
759
+ fn phi ( & self , ty : & ' ll Type , vals : & [ & ' ll Value ] , bbs : & [ & ' ll BasicBlock ] ) -> & ' ll Value {
758
760
assert_eq ! ( vals. len( ) , bbs. len( ) ) ;
759
761
let phi = self . empty_phi ( ty) ;
760
762
self . count_insn ( "addincoming" ) ;
@@ -767,7 +769,7 @@ impl BuilderMethods<'a, 'll, 'tcx>
767
769
}
768
770
769
771
fn inline_asm_call ( & self , asm : * const c_char , cons : * const c_char ,
770
- inputs : & [ & ' ll Value ] , output : Self :: Type ,
772
+ inputs : & [ & ' ll Value ] , output : & ' ll Type ,
771
773
volatile : bool , alignstack : bool ,
772
774
dia : syntax:: ast:: AsmDialect ) -> Option < & ' ll Value > {
773
775
self . count_insn ( "inlineasm" ) ;
@@ -826,7 +828,7 @@ impl BuilderMethods<'a, 'll, 'tcx>
826
828
}
827
829
828
830
#[ allow( dead_code) ]
829
- fn va_arg ( & self , list : & ' ll Value , ty : Self :: Type ) -> & ' ll Value {
831
+ fn va_arg ( & self , list : & ' ll Value , ty : & ' ll Type ) -> & ' ll Value {
830
832
self . count_insn ( "vaarg" ) ;
831
833
unsafe {
832
834
llvm:: LLVMBuildVAArg ( self . llbuilder , list, ty, noname ( ) )
@@ -992,7 +994,7 @@ impl BuilderMethods<'a, 'll, 'tcx>
992
994
}
993
995
}
994
996
995
- fn landing_pad ( & self , ty : Self :: Type , pers_fn : & ' ll Value ,
997
+ fn landing_pad ( & self , ty : & ' ll Type , pers_fn : & ' ll Value ,
996
998
num_clauses : usize ) -> & ' ll Value {
997
999
self . count_insn ( "landingpad" ) ;
998
1000
unsafe {
@@ -1296,7 +1298,7 @@ impl BuilderMethods<'a, 'll, 'tcx>
1296
1298
}
1297
1299
}
1298
1300
1299
- fn zext ( & self , val : & ' ll Value , dest_ty : Self :: Type ) -> & ' ll Value {
1301
+ fn zext ( & self , val : & ' ll Value , dest_ty : & ' ll Type ) -> & ' ll Value {
1300
1302
self . count_insn ( "zext" ) ;
1301
1303
unsafe {
1302
1304
llvm:: LLVMBuildZExt ( self . llbuilder , val, dest_ty, noname ( ) )
0 commit comments