CommonWriteMethods are not static any more
This commit is contained in:
parent
3aee77277e
commit
4cc18d3de5
10 changed files with 179 additions and 85 deletions
|
@ -527,7 +527,7 @@ impl BuilderMethods<'a, 'll, 'tcx> for Builder<'a, 'll, 'tcx> {
|
|||
}
|
||||
|
||||
unsafe {
|
||||
let llty = CodegenCx::val_ty(load);
|
||||
let llty = self.cx.val_ty(load);
|
||||
let v = [
|
||||
self.cx.c_uint_big(llty, range.start),
|
||||
self.cx.c_uint_big(llty, range.end)
|
||||
|
@ -760,7 +760,7 @@ impl BuilderMethods<'a, 'll, 'tcx> for Builder<'a, 'll, 'tcx> {
|
|||
|
||||
let argtys = inputs.iter().map(|v| {
|
||||
debug!("Asm Input Type: {:?}", *v);
|
||||
CodegenCx::val_ty(*v)
|
||||
self.cx.val_ty(*v)
|
||||
}).collect::<Vec<_>>();
|
||||
|
||||
debug!("Asm Output Type: {:?}", output);
|
||||
|
@ -859,7 +859,7 @@ 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 = CodegenCx::val_ty(elt);
|
||||
let elt_ty = self.cx.val_ty(elt);
|
||||
let undef = llvm::LLVMGetUndef(type_::Type::vector(elt_ty, num_elts as u64));
|
||||
let vec = self.insert_element(undef, elt, CodegenCx::c_i32(self.cx, 0));
|
||||
let vec_i32_ty = type_::Type::vector(type_::Type::i32(self.cx), num_elts as u64);
|
||||
|
@ -1139,8 +1139,8 @@ impl BuilderMethods<'a, 'll, 'tcx> for Builder<'a, 'll, 'tcx> {
|
|||
fn check_store<'b>(&self,
|
||||
val: &'ll Value,
|
||||
ptr: &'ll Value) -> &'ll Value {
|
||||
let dest_ptr_ty = CodegenCx::val_ty(ptr);
|
||||
let stored_ty = CodegenCx::val_ty(val);
|
||||
let dest_ptr_ty = self.cx.val_ty(ptr);
|
||||
let stored_ty = self.cx.val_ty(val);
|
||||
let stored_ptr_ty = stored_ty.ptr_to();
|
||||
|
||||
assert_eq!(dest_ptr_ty.kind(), llvm::TypeKind::Pointer);
|
||||
|
@ -1160,7 +1160,7 @@ impl BuilderMethods<'a, 'll, 'tcx> for Builder<'a, 'll, 'tcx> {
|
|||
typ: &str,
|
||||
llfn: &'ll Value,
|
||||
args: &'b [&'ll Value]) -> Cow<'b, [&'ll Value]> {
|
||||
let mut fn_ty = CodegenCx::val_ty(llfn);
|
||||
let mut fn_ty = self.cx.val_ty(llfn);
|
||||
// Strip off pointers
|
||||
while fn_ty.kind() == llvm::TypeKind::Pointer {
|
||||
fn_ty = fn_ty.element_type();
|
||||
|
@ -1172,7 +1172,7 @@ impl BuilderMethods<'a, 'll, 'tcx> for Builder<'a, 'll, 'tcx> {
|
|||
let param_tys = fn_ty.func_params();
|
||||
|
||||
let all_args_match = param_tys.iter()
|
||||
.zip(args.iter().map(|&v| CodegenCx::val_ty(v)))
|
||||
.zip(args.iter().map(|&v| self.cx().val_ty(v)))
|
||||
.all(|(expected_ty, actual_ty)| *expected_ty == actual_ty);
|
||||
|
||||
if all_args_match {
|
||||
|
@ -1183,7 +1183,7 @@ impl BuilderMethods<'a, 'll, 'tcx> for Builder<'a, 'll, 'tcx> {
|
|||
.zip(args.iter())
|
||||
.enumerate()
|
||||
.map(|(i, (expected_ty, &actual_val))| {
|
||||
let actual_ty = CodegenCx::val_ty(actual_val);
|
||||
let actual_ty = self.cx().val_ty(actual_val);
|
||||
if expected_ty != actual_ty {
|
||||
debug!("Type mismatch in function call of {:?}. \
|
||||
Expected {:?} for param {}, got {:?}; injecting bitcast",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue