@@ -24,7 +24,7 @@ use declare;
24
24
use type_:: Type ;
25
25
use type_of:: LayoutLlvmExt ;
26
26
use value:: Value ;
27
- use interfaces:: { Backend , CommonMethods , CommonWriteMethods , TypeMethods } ;
27
+ use interfaces:: { Backend , ConstMethods , TypeMethods } ;
28
28
29
29
use rustc:: ty:: { self , Ty , TyCtxt } ;
30
30
use rustc:: ty:: layout:: { HasDataLayout , LayoutOf } ;
@@ -203,7 +203,7 @@ impl Backend for CodegenCx<'ll, 'tcx, &'ll Value> {
203
203
type Context = & ' ll llvm:: Context ;
204
204
}
205
205
206
- impl < ' ll , ' tcx : ' ll > CommonMethods for CodegenCx < ' ll , ' tcx , & ' ll Value > {
206
+ impl < ' ll , ' tcx : ' ll > ConstMethods for CodegenCx < ' ll , ' tcx , & ' ll Value > {
207
207
208
208
// LLVM constant constructors.
209
209
fn const_null ( & self , t : & ' ll Type ) -> & ' ll Value {
@@ -321,7 +321,7 @@ impl<'ll, 'tcx : 'll> CommonMethods for CodegenCx<'ll, 'tcx, &'ll Value> {
321
321
elts : & [ & ' ll Value ] ,
322
322
packed : bool
323
323
) -> & ' ll Value {
324
- & self . const_struct_in_context ( & self . llcx , elts, packed)
324
+ struct_in_context ( & self . llcx , elts, packed)
325
325
}
326
326
327
327
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> {
337
337
}
338
338
339
339
fn const_bytes ( & self , bytes : & [ u8 ] ) -> & ' ll Value {
340
- & self . const_bytes_in_context ( & self . llcx , bytes)
340
+ bytes_in_context ( & self . llcx , bytes)
341
341
}
342
342
343
343
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 {
408
408
}
409
409
}
410
410
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 {
412
412
unsafe {
413
413
let ptr = bytes. as_ptr ( ) as * const c_char ;
414
414
return llvm:: LLVMConstStringInContext ( llcx, ptr, bytes. len ( ) as c_uint , True ) ;
415
415
}
416
416
}
417
417
418
- pub fn const_struct_in_context (
418
+ pub fn struct_in_context (
419
419
llcx : & ' a llvm:: Context ,
420
420
elts : & [ & ' a Value ] ,
421
421
packed : bool ,
@@ -427,26 +427,6 @@ pub fn const_struct_in_context(
427
427
}
428
428
}
429
429
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
-
450
430
#[ inline]
451
431
fn hi_lo_to_u128 ( lo : u64 , hi : u64 ) -> u128 {
452
432
( ( hi as u128 ) << 64 ) | ( lo as u128 )
0 commit comments