|
10 | 10 |
|
11 | 11 | use llvm::{self, ValueRef, Integer, Pointer, Float, Double, Struct, Array, Vector, AttributePlace}; |
12 | 12 | use base; |
13 | | -use build::AllocaFcx; |
14 | 13 | use common::{type_is_fat_ptr, BlockAndBuilder, C_uint}; |
15 | 14 | use context::CrateContext; |
16 | 15 | use cabi_x86; |
@@ -99,21 +98,11 @@ impl ArgAttributes { |
99 | 98 | self |
100 | 99 | } |
101 | 100 |
|
102 | | - pub fn unset(&mut self, attr: ArgAttribute) -> &mut Self { |
103 | | - self.regular = self.regular - attr; |
104 | | - self |
105 | | - } |
106 | | - |
107 | 101 | pub fn set_dereferenceable(&mut self, bytes: u64) -> &mut Self { |
108 | 102 | self.dereferenceable_bytes = bytes; |
109 | 103 | self |
110 | 104 | } |
111 | 105 |
|
112 | | - pub fn unset_dereferenceable(&mut self) -> &mut Self { |
113 | | - self.dereferenceable_bytes = 0; |
114 | | - self |
115 | | - } |
116 | | - |
117 | 106 | pub fn apply_llfn(&self, idx: AttributePlace, llfn: ValueRef) { |
118 | 107 | unsafe { |
119 | 108 | self.regular.for_each_kind(|attr| attr.apply_llfn(idx, llfn)); |
@@ -246,7 +235,7 @@ impl ArgType { |
246 | 235 | if self.is_ignore() { |
247 | 236 | return; |
248 | 237 | } |
249 | | - let ccx = bcx.ccx(); |
| 238 | + let ccx = bcx.ccx; |
250 | 239 | if self.is_indirect() { |
251 | 240 | let llsz = llsize_of(ccx, self.ty); |
252 | 241 | let llalign = llalign_of_min(ccx, self.ty); |
@@ -278,7 +267,7 @@ impl ArgType { |
278 | 267 | // bitcasting to the struct type yields invalid cast errors. |
279 | 268 |
|
280 | 269 | // We instead thus allocate some scratch space... |
281 | | - let llscratch = AllocaFcx(bcx.fcx(), ty, "abi_cast"); |
| 270 | + let llscratch = bcx.fcx().alloca(ty, "abi_cast"); |
282 | 271 | base::Lifetime::Start.call(bcx, llscratch); |
283 | 272 |
|
284 | 273 | // ...where we first store the value... |
@@ -431,7 +420,7 @@ impl FnType { |
431 | 420 | let ret_ty = sig.output(); |
432 | 421 | let mut ret = arg_of(ret_ty, true); |
433 | 422 |
|
434 | | - if !type_is_fat_ptr(ccx.tcx(), ret_ty) { |
| 423 | + if !type_is_fat_ptr(ccx, ret_ty) { |
435 | 424 | // The `noalias` attribute on the return value is useful to a |
436 | 425 | // function ptr caller. |
437 | 426 | if let ty::TyBox(_) = ret_ty.sty { |
@@ -496,7 +485,7 @@ impl FnType { |
496 | 485 | for ty in inputs.iter().chain(extra_args.iter()) { |
497 | 486 | let mut arg = arg_of(ty, false); |
498 | 487 |
|
499 | | - if type_is_fat_ptr(ccx.tcx(), ty) { |
| 488 | + if type_is_fat_ptr(ccx, ty) { |
500 | 489 | let original_tys = arg.original_ty.field_types(); |
501 | 490 | let sizing_tys = arg.ty.field_types(); |
502 | 491 | assert_eq!((original_tys.len(), sizing_tys.len()), (2, 2)); |
@@ -569,7 +558,7 @@ impl FnType { |
569 | 558 | }; |
570 | 559 | // Fat pointers are returned by-value. |
571 | 560 | if !self.ret.is_ignore() { |
572 | | - if !type_is_fat_ptr(ccx.tcx(), sig.output()) { |
| 561 | + if !type_is_fat_ptr(ccx, sig.output()) { |
573 | 562 | fixup(&mut self.ret); |
574 | 563 | } |
575 | 564 | } |
|
0 commit comments