@@ -24,7 +24,7 @@ use declare;
2424use type_:: Type ;
2525use type_of:: LayoutLlvmExt ;
2626use value:: Value ;
27- use interfaces:: { Backend , CommonMethods , CommonWriteMethods , TypeMethods } ;
27+ use interfaces:: { Backend , ConstMethods , TypeMethods } ;
2828
2929use rustc:: ty:: { self , Ty , TyCtxt } ;
3030use rustc:: ty:: layout:: { HasDataLayout , LayoutOf } ;
@@ -203,7 +203,7 @@ impl Backend for CodegenCx<'ll, 'tcx, &'ll Value> {
203203 type Context = & ' ll llvm:: Context ;
204204}
205205
206- impl < ' ll , ' tcx : ' ll > CommonMethods for CodegenCx < ' ll , ' tcx , & ' ll Value > {
206+ impl < ' ll , ' tcx : ' ll > ConstMethods for CodegenCx < ' ll , ' tcx , & ' ll Value > {
207207
208208 // LLVM constant constructors.
209209 fn const_null ( & self , t : & ' ll Type ) -> & ' ll Value {
@@ -321,7 +321,7 @@ impl<'ll, 'tcx : 'll> CommonMethods for CodegenCx<'ll, 'tcx, &'ll Value> {
321321 elts : & [ & ' ll Value ] ,
322322 packed : bool
323323 ) -> & ' ll Value {
324- & self . const_struct_in_context ( & self . llcx , elts, packed)
324+ struct_in_context ( & self . llcx , elts, packed)
325325 }
326326
327327 fn const_array ( & self , ty : & ' ll Type , elts : & [ & ' ll Value ] ) -> & ' ll Value {
@@ -337,7 +337,7 @@ impl<'ll, 'tcx : 'll> CommonMethods for CodegenCx<'ll, 'tcx, &'ll Value> {
337337 }
338338
339339 fn const_bytes ( & self , bytes : & [ u8 ] ) -> & ' ll Value {
340- & self . const_bytes_in_context ( & self . llcx , bytes)
340+ bytes_in_context ( & self . llcx , bytes)
341341 }
342342
343343 fn const_get_elt ( & self , v : & ' ll Value , idx : u64 ) -> & ' ll Value {
@@ -408,14 +408,14 @@ pub fn val_ty(v: &'ll Value) -> &'ll Type {
408408 }
409409}
410410
411- pub fn const_bytes_in_context ( llcx : & ' ll llvm:: Context , bytes : & [ u8 ] ) -> & ' ll Value {
411+ pub fn bytes_in_context ( llcx : & ' ll llvm:: Context , bytes : & [ u8 ] ) -> & ' ll Value {
412412 unsafe {
413413 let ptr = bytes. as_ptr ( ) as * const c_char ;
414414 return llvm:: LLVMConstStringInContext ( llcx, ptr, bytes. len ( ) as c_uint , True ) ;
415415 }
416416}
417417
418- pub fn const_struct_in_context (
418+ pub fn struct_in_context (
419419 llcx : & ' a llvm:: Context ,
420420 elts : & [ & ' a Value ] ,
421421 packed : bool ,
@@ -427,26 +427,6 @@ pub fn const_struct_in_context(
427427 }
428428}
429429
430- impl < ' ll , ' tcx : ' ll > CommonWriteMethods for CodegenCx < ' ll , ' tcx , & ' ll Value > {
431- fn val_ty ( & self , v : & ' ll Value ) -> & ' ll Type {
432- val_ty ( v)
433- }
434-
435- fn const_bytes_in_context ( & self , llcx : & ' ll llvm:: Context , bytes : & [ u8 ] ) -> & ' ll Value {
436- const_bytes_in_context ( llcx, bytes)
437- }
438-
439- fn const_struct_in_context (
440- & self ,
441- llcx : & ' a llvm:: Context ,
442- elts : & [ & ' a Value ] ,
443- packed : bool ,
444- ) -> & ' a Value {
445- const_struct_in_context ( llcx, elts, packed)
446- }
447- }
448-
449-
450430#[ inline]
451431fn hi_lo_to_u128 ( lo : u64 , hi : u64 ) -> u128 {
452432 ( ( hi as u128 ) << 64 ) | ( lo as u128 )
0 commit comments