Remove inherent methods from llvm::Type
This commit is contained in:
@@ -44,7 +44,7 @@ use crate::errors::{
|
||||
};
|
||||
use crate::llvm::diagnostic::OptimizationDiagnosticKind::*;
|
||||
use crate::llvm::{self, DiagnosticInfo};
|
||||
use crate::type_::Type;
|
||||
use crate::type_::llvm_type_ptr;
|
||||
use crate::{LlvmCodegenBackend, ModuleLlvm, base, common, llvm_util};
|
||||
|
||||
pub(crate) fn llvm_err<'a>(dcx: DiagCtxtHandle<'_>, err: LlvmError<'a>) -> ! {
|
||||
@@ -1160,7 +1160,7 @@ fn create_msvc_imps(
|
||||
// underscores added in front).
|
||||
let prefix = if cgcx.target_arch == "x86" { "\x01__imp__" } else { "\x01__imp_" };
|
||||
|
||||
let ptr_ty = Type::ptr_llcx(llcx);
|
||||
let ptr_ty = llvm_type_ptr(llcx);
|
||||
let globals = base::iter_globals(llmod)
|
||||
.filter(|&val| {
|
||||
llvm::get_linkage(val) == llvm::Linkage::ExternalLinkage && !llvm::is_declaration(val)
|
||||
|
||||
@@ -740,7 +740,7 @@ impl<'ll> SimpleCx<'ll> {
|
||||
llcx: &'ll llvm::Context,
|
||||
pointer_size: Size,
|
||||
) -> Self {
|
||||
let isize_ty = llvm::Type::ix_llcx(llcx, pointer_size.bits());
|
||||
let isize_ty = llvm::LLVMIntTypeInContext(llcx, pointer_size.bits() as c_uint);
|
||||
Self(SCx { llmod, llcx, isize_ty }, PhantomData)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -954,7 +954,7 @@ unsafe extern "C" {
|
||||
pub(crate) fn LLVMInt16TypeInContext(C: &Context) -> &Type;
|
||||
pub(crate) fn LLVMInt32TypeInContext(C: &Context) -> &Type;
|
||||
pub(crate) fn LLVMInt64TypeInContext(C: &Context) -> &Type;
|
||||
pub(crate) fn LLVMIntTypeInContext(C: &Context, NumBits: c_uint) -> &Type;
|
||||
pub(crate) safe fn LLVMIntTypeInContext(C: &Context, NumBits: c_uint) -> &Type;
|
||||
|
||||
pub(crate) fn LLVMGetIntTypeWidth(IntegerTy: &Type) -> c_uint;
|
||||
|
||||
@@ -983,7 +983,7 @@ unsafe extern "C" {
|
||||
) -> &'a Type;
|
||||
|
||||
// Operations on array, pointer, and vector types (sequence types)
|
||||
pub(crate) fn LLVMPointerTypeInContext(C: &Context, AddressSpace: c_uint) -> &Type;
|
||||
pub(crate) safe fn LLVMPointerTypeInContext(C: &Context, AddressSpace: c_uint) -> &Type;
|
||||
pub(crate) fn LLVMVectorType(ElementType: &Type, ElementCount: c_uint) -> &Type;
|
||||
|
||||
pub(crate) fn LLVMGetElementType(Ty: &Type) -> &Type;
|
||||
|
||||
@@ -63,7 +63,7 @@ impl<'ll, CX: Borrow<SCx<'ll>>> GenericCx<'ll, CX> {
|
||||
|
||||
///x Creates an integer type with the given number of bits, e.g., i24
|
||||
pub(crate) fn type_ix(&self, num_bits: u64) -> &'ll Type {
|
||||
unsafe { llvm::LLVMIntTypeInContext(self.llcx(), num_bits as c_uint) }
|
||||
llvm::LLVMIntTypeInContext(self.llcx(), num_bits as c_uint)
|
||||
}
|
||||
|
||||
pub(crate) fn type_vector(&self, ty: &'ll Type, len: u64) -> &'ll Type {
|
||||
@@ -178,7 +178,7 @@ impl<'ll, CX: Borrow<SCx<'ll>>> BaseTypeCodegenMethods for GenericCx<'ll, CX> {
|
||||
}
|
||||
|
||||
fn type_i128(&self) -> &'ll Type {
|
||||
unsafe { llvm::LLVMIntTypeInContext(self.llcx(), 128) }
|
||||
self.type_ix(128)
|
||||
}
|
||||
|
||||
fn type_isize(&self) -> &'ll Type {
|
||||
@@ -210,11 +210,11 @@ impl<'ll, CX: Borrow<SCx<'ll>>> BaseTypeCodegenMethods for GenericCx<'ll, CX> {
|
||||
}
|
||||
|
||||
fn type_ptr(&self) -> &'ll Type {
|
||||
self.type_ptr_ext(AddressSpace::ZERO)
|
||||
llvm_type_ptr(self.llcx())
|
||||
}
|
||||
|
||||
fn type_ptr_ext(&self, address_space: AddressSpace) -> &'ll Type {
|
||||
unsafe { llvm::LLVMPointerTypeInContext(self.llcx(), address_space.0) }
|
||||
llvm_type_ptr_in_address_space(self.llcx(), address_space)
|
||||
}
|
||||
|
||||
fn element_type(&self, ty: &'ll Type) -> &'ll Type {
|
||||
@@ -253,15 +253,15 @@ impl<'ll, CX: Borrow<SCx<'ll>>> BaseTypeCodegenMethods for GenericCx<'ll, CX> {
|
||||
}
|
||||
}
|
||||
|
||||
impl Type {
|
||||
/// Creates an integer type with the given number of bits, e.g., i24
|
||||
pub(crate) fn ix_llcx(llcx: &llvm::Context, num_bits: u64) -> &Type {
|
||||
unsafe { llvm::LLVMIntTypeInContext(llcx, num_bits as c_uint) }
|
||||
}
|
||||
pub(crate) fn llvm_type_ptr(llcx: &llvm::Context) -> &Type {
|
||||
llvm_type_ptr_in_address_space(llcx, AddressSpace::ZERO)
|
||||
}
|
||||
|
||||
pub(crate) fn ptr_llcx(llcx: &llvm::Context) -> &Type {
|
||||
unsafe { llvm::LLVMPointerTypeInContext(llcx, AddressSpace::ZERO.0) }
|
||||
}
|
||||
pub(crate) fn llvm_type_ptr_in_address_space<'ll>(
|
||||
llcx: &'ll llvm::Context,
|
||||
addr_space: AddressSpace,
|
||||
) -> &'ll Type {
|
||||
llvm::LLVMPointerTypeInContext(llcx, addr_space.0)
|
||||
}
|
||||
|
||||
impl<'ll, 'tcx> LayoutTypeCodegenMethods<'tcx> for CodegenCx<'ll, 'tcx> {
|
||||
|
||||
Reference in New Issue
Block a user