Prefixed type methods & removed trait impl for write::CodegenContext

This commit is contained in:
Denis Merigoux 2018-09-06 13:52:15 -07:00 committed by Eduard-Mihai Burtescu
parent 6d42574b7a
commit e224f063e8
20 changed files with 263 additions and 270 deletions

View file

@ -765,7 +765,7 @@ impl BuilderMethods<'a, 'll, 'tcx> for Builder<'a, 'll, 'tcx> {
}).collect::<Vec<_>>();
debug!("Asm Output Type: {:?}", output);
let fty = &self.cx().func(&argtys[..], output);
let fty = &self.cx().type_func(&argtys[..], output);
unsafe {
// Ask LLVM to verify that the constraints are well-formed.
let constraints_ok = llvm::LLVMRustInlineAsmVerify(fty, cons);
@ -861,9 +861,9 @@ impl BuilderMethods<'a, 'll, 'tcx> for Builder<'a, 'll, 'tcx> {
fn vector_splat(&self, num_elts: usize, elt: &'ll Value) -> &'ll Value {
unsafe {
let elt_ty = self.cx.val_ty(elt);
let undef = llvm::LLVMGetUndef(&self.cx().vector(elt_ty, num_elts as u64));
let undef = llvm::LLVMGetUndef(&self.cx().type_vector(elt_ty, num_elts as u64));
let vec = self.insert_element(undef, elt, self.cx.const_i32(0));
let vec_i32_ty = &self.cx().vector(&self.cx().i32(), num_elts as u64);
let vec_i32_ty = &self.cx().type_vector(&self.cx().type_i32(), num_elts as u64);
self.shuffle_vector(vec, undef, self.cx().const_null(vec_i32_ty))
}
}
@ -1142,9 +1142,9 @@ impl BuilderMethods<'a, 'll, 'tcx> for Builder<'a, 'll, 'tcx> {
ptr: &'ll Value) -> &'ll Value {
let dest_ptr_ty = self.cx.val_ty(ptr);
let stored_ty = self.cx.val_ty(val);
let stored_ptr_ty = self.cx.ptr_to(stored_ty);
let stored_ptr_ty = self.cx.type_ptr_to(stored_ty);
assert_eq!(self.cx.kind(dest_ptr_ty), llvm::TypeKind::Pointer);
assert_eq!(self.cx.type_kind(dest_ptr_ty), llvm::TypeKind::Pointer);
if dest_ptr_ty == stored_ptr_ty {
ptr
@ -1163,14 +1163,14 @@ impl BuilderMethods<'a, 'll, 'tcx> for Builder<'a, 'll, 'tcx> {
args: &'b [&'ll Value]) -> Cow<'b, [&'ll Value]> {
let mut fn_ty = self.cx.val_ty(llfn);
// Strip off pointers
while self.cx.kind(fn_ty) == llvm::TypeKind::Pointer {
while self.cx.type_kind(fn_ty) == llvm::TypeKind::Pointer {
fn_ty = self.cx.element_type(fn_ty);
}
assert!(self.cx.kind(fn_ty) == llvm::TypeKind::Function,
assert!(self.cx.type_kind(fn_ty) == llvm::TypeKind::Function,
"builder::{} not passed a function, but {:?}", typ, fn_ty);
let param_tys = self.cx.func_params(fn_ty);
let param_tys = self.cx.func_params_types(fn_ty);
let all_args_match = param_tys.iter()
.zip(args.iter().map(|&v| self.cx().val_ty(v)))
@ -1227,7 +1227,7 @@ impl BuilderMethods<'a, 'll, 'tcx> for Builder<'a, 'll, 'tcx> {
let lifetime_intrinsic = self.cx.get_intrinsic(intrinsic);
let ptr = self.pointercast(ptr, self.cx.i8p());
let ptr = self.pointercast(ptr, self.cx.type_i8p());
self.call(lifetime_intrinsic, &[self.cx.const_u64(size), ptr], None);
}