cg_ssa: remove pointee types and pointercast/bitcast-of-ptr

This commit is contained in:
Erik Desjardins 2023-07-28 20:24:33 -04:00
parent 9e58bacf90
commit bc4a65d47f
4 changed files with 26 additions and 11 deletions

View file

@ -54,6 +54,23 @@ impl<'gcc, 'tcx> CodegenCx<'gcc, 'tcx> {
self.u128_type
}
pub fn type_ptr_to(&self, ty: Type<'gcc>) -> Type<'gcc> {
ty.make_pointer()
}
pub fn type_ptr_to_ext(&self, ty: Type<'gcc>, _address_space: AddressSpace) -> Type<'gcc> {
// TODO(antoyo): use address_space, perhaps with TYPE_ADDR_SPACE?
ty.make_pointer()
}
pub fn type_i8p(&self) -> Type<'gcc> {
self.type_ptr_to(self.type_i8())
}
pub fn type_i8p_ext(&self, address_space: AddressSpace) -> Type<'gcc> {
self.type_ptr_to_ext(self.type_i8(), address_space)
}
pub fn type_pointee_for_align(&self, align: Align) -> Type<'gcc> {
// FIXME(eddyb) We could find a better approximation if ity.align < align.
let ity = Integer::approximate_align(self, align);
@ -149,13 +166,12 @@ impl<'gcc, 'tcx> BaseTypeMethods<'tcx> for CodegenCx<'gcc, 'tcx> {
}
}
fn type_ptr_to(&self, ty: Type<'gcc>) -> Type<'gcc> {
ty.make_pointer()
fn type_ptr(&self) -> Type<'gcc> {
self.type_ptr_to(self.type_void())
}
fn type_ptr_to_ext(&self, ty: Type<'gcc>, _address_space: AddressSpace) -> Type<'gcc> {
// TODO(antoyo): use address_space, perhaps with TYPE_ADDR_SPACE?
ty.make_pointer()
fn type_ptr_ext(&self, address_space: AddressSpace) -> Type<'gcc> {
self.type_ptr_to_ext(self.type_void(), address_space)
}
fn element_type(&self, ty: Type<'gcc>) -> Type<'gcc> {