@@ -121,25 +121,12 @@ impl BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> {
121121 Builder :: new_block ( self . cx , self . llfn ( ) , name)
122122 }
123123
124- fn llfn ( & self ) -> & ' ll Value {
125- unsafe {
126- llvm:: LLVMGetBasicBlockParent ( self . llbb ( ) )
127- }
128- }
129-
130124 fn llbb ( & self ) -> & ' ll BasicBlock {
131125 unsafe {
132126 llvm:: LLVMGetInsertBlock ( self . llbuilder )
133127 }
134128 }
135129
136- fn set_value_name ( & mut self , value : & ' ll Value , name : & str ) {
137- let cname = SmallCStr :: new ( name) ;
138- unsafe {
139- llvm:: LLVMSetValueName ( value, cname. as_ptr ( ) ) ;
140- }
141- }
142-
143130 fn position_at_end ( & mut self , llbb : & ' ll BasicBlock ) {
144131 unsafe {
145132 llvm:: LLVMPositionBuilderAtEnd ( self . llbuilder , llbb) ;
@@ -768,6 +755,14 @@ impl BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> {
768755 }
769756 }
770757
758+ fn struct_gep ( & mut self , ptr : & ' ll Value , idx : u64 ) -> & ' ll Value {
759+ self . count_insn ( "structgep" ) ;
760+ assert_eq ! ( idx as c_uint as u64 , idx) ;
761+ unsafe {
762+ llvm:: LLVMBuildStructGEP ( self . llbuilder , ptr, idx as c_uint , noname ( ) )
763+ }
764+ }
765+
771766 /* Casts */
772767 fn trunc ( & mut self , val : & ' ll Value , dest_ty : & ' ll Type ) -> & ' ll Value {
773768 self . count_insn ( "trunc" ) ;
@@ -999,6 +994,14 @@ impl BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> {
999994 }
1000995 }
1001996
997+ #[ allow( dead_code) ]
998+ fn va_arg ( & mut self , list : & ' ll Value , ty : & ' ll Type ) -> & ' ll Value {
999+ self . count_insn ( "vaarg" ) ;
1000+ unsafe {
1001+ llvm:: LLVMBuildVAArg ( self . llbuilder , list, ty, noname ( ) )
1002+ }
1003+ }
1004+
10021005 fn extract_element ( & mut self , vec : & ' ll Value , idx : & ' ll Value ) -> & ' ll Value {
10031006 self . count_insn ( "extractelement" ) ;
10041007 unsafe {
@@ -1241,13 +1244,6 @@ impl BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> {
12411244 }
12421245 }
12431246
1244- fn struct_gep ( & mut self , ptr : & ' ll Value , idx : u64 ) -> & ' ll Value {
1245- self . count_insn ( "structgep" ) ;
1246- assert_eq ! ( idx as c_uint as u64 , idx) ;
1247- unsafe {
1248- llvm:: LLVMBuildStructGEP ( self . llbuilder , ptr, idx as c_uint , noname ( ) )
1249- }
1250- }
12511247
12521248 fn cx ( & self ) -> & CodegenCx < ' ll , ' tcx > {
12531249 self . cx
@@ -1263,7 +1259,7 @@ impl BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> {
12631259}
12641260
12651261impl StaticBuilderMethods < ' tcx > for Builder < ' a , ' ll , ' tcx > {
1266- fn get_static ( & mut self , def_id : DefId ) -> & ' ll Value {
1262+ fn get_static ( & mut self , def_id : DefId ) -> & ' ll Value {
12671263 // Forward to the `get_static` method of `CodegenCx`
12681264 self . cx ( ) . get_static ( def_id)
12691265 }
@@ -1300,6 +1296,12 @@ impl StaticBuilderMethods<'tcx> for Builder<'a, 'll, 'tcx> {
13001296}
13011297
13021298impl Builder < ' a , ' ll , ' tcx > {
1299+ pub fn llfn ( & self ) -> & ' ll Value {
1300+ unsafe {
1301+ llvm:: LLVMGetBasicBlockParent ( self . llbb ( ) )
1302+ }
1303+ }
1304+
13031305 fn count_insn ( & self , category : & str ) {
13041306 if self . sess ( ) . codegen_stats ( ) {
13051307 self . stats . borrow_mut ( ) . n_llvm_insns += 1 ;
0 commit comments