|
1 | 1 | use gccjit::LValue; |
2 | | -use gccjit::{Block, RValue, Type, ToRValue}; |
| 2 | +use gccjit::{RValue, Type, ToRValue}; |
3 | 3 | use rustc_codegen_ssa::mir::place::PlaceRef; |
4 | 4 | use rustc_codegen_ssa::traits::{ |
5 | 5 | BaseTypeMethods, |
@@ -45,27 +45,6 @@ impl<'gcc, 'tcx> CodegenCx<'gcc, 'tcx> { |
45 | 45 | global |
46 | 46 | // TODO(antoyo): set linkage. |
47 | 47 | } |
48 | | - |
49 | | - pub fn inttoptr(&self, block: Block<'gcc>, value: RValue<'gcc>, dest_ty: Type<'gcc>) -> RValue<'gcc> { |
50 | | - let func = block.get_function(); |
51 | | - let local = func.new_local(None, value.get_type(), "intLocal"); |
52 | | - block.add_assignment(None, local, value); |
53 | | - let value_address = local.get_address(None); |
54 | | - |
55 | | - let ptr = self.context.new_cast(None, value_address, dest_ty.make_pointer()); |
56 | | - ptr.dereference(None).to_rvalue() |
57 | | - } |
58 | | - |
59 | | - pub fn ptrtoint(&self, block: Block<'gcc>, value: RValue<'gcc>, dest_ty: Type<'gcc>) -> RValue<'gcc> { |
60 | | - // TODO(antoyo): when libgccjit allow casting from pointer to int, remove this. |
61 | | - let func = block.get_function(); |
62 | | - let local = func.new_local(None, value.get_type(), "ptrLocal"); |
63 | | - block.add_assignment(None, local, value); |
64 | | - let ptr_address = local.get_address(None); |
65 | | - |
66 | | - let ptr = self.context.new_cast(None, ptr_address, dest_ty.make_pointer()); |
67 | | - ptr.dereference(None).to_rvalue() |
68 | | - } |
69 | 48 | } |
70 | 49 |
|
71 | 50 | pub fn bytes_in_context<'gcc, 'tcx>(cx: &CodegenCx<'gcc, 'tcx>, bytes: &[u8]) -> RValue<'gcc> { |
@@ -202,11 +181,7 @@ impl<'gcc, 'tcx> ConstMethods<'tcx> for CodegenCx<'gcc, 'tcx> { |
202 | 181 | } |
203 | 182 |
|
204 | 183 | let value = self.const_uint_big(self.type_ix(bitsize), data); |
205 | | - if layout.value == Pointer { |
206 | | - self.inttoptr(self.current_block.borrow().expect("block"), value, ty) |
207 | | - } else { |
208 | | - self.const_bitcast(value, ty) |
209 | | - } |
| 184 | + self.const_bitcast(value, ty) |
210 | 185 | } |
211 | 186 | Scalar::Ptr(ptr, _size) => { |
212 | 187 | let (alloc_id, offset) = ptr.into_parts(); |
|
0 commit comments