Remove call_lifetime_intrinsic from cg_ssa
This commit is contained in:
parent
187c4cf257
commit
9a9045573f
2 changed files with 23 additions and 27 deletions
|
|
@ -1350,22 +1350,6 @@ impl BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> {
|
|||
self.call_lifetime_intrinsic("llvm.lifetime.end", ptr, size);
|
||||
}
|
||||
|
||||
fn call_lifetime_intrinsic(&mut self, intrinsic: &str, ptr: &'ll Value, size: Size) {
|
||||
if self.cx.sess().opts.optimize == config::OptLevel::No {
|
||||
return;
|
||||
}
|
||||
|
||||
let size = size.bytes();
|
||||
if size == 0 {
|
||||
return;
|
||||
}
|
||||
|
||||
let lifetime_intrinsic = self.cx.get_intrinsic(intrinsic);
|
||||
|
||||
let ptr = self.pointercast(ptr, self.cx.type_i8p());
|
||||
self.call(lifetime_intrinsic, &[self.cx.const_u64(size), ptr], None);
|
||||
}
|
||||
|
||||
fn call(
|
||||
&mut self,
|
||||
llfn: &'ll Value,
|
||||
|
|
@ -1420,3 +1404,21 @@ impl BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> {
|
|||
llvm::Attribute::NoInline.apply_callsite(llvm::AttributePlace::Function, llret);
|
||||
}
|
||||
}
|
||||
|
||||
impl Builder<'a, 'll, 'tcx> {
|
||||
fn call_lifetime_intrinsic(&mut self, intrinsic: &str, ptr: &'ll Value, size: Size) {
|
||||
if self.cx.sess().opts.optimize == config::OptLevel::No {
|
||||
return;
|
||||
}
|
||||
|
||||
let size = size.bytes();
|
||||
if size == 0 {
|
||||
return;
|
||||
}
|
||||
|
||||
let lifetime_intrinsic = self.cx.get_intrinsic(intrinsic);
|
||||
|
||||
let ptr = self.pointercast(ptr, self.cx.type_i8p());
|
||||
self.call(lifetime_intrinsic, &[self.cx.const_u64(size), ptr], None);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -297,18 +297,12 @@ pub trait BuilderMethods<'a, 'tcx: 'a>:
|
|||
) -> Cow<'b, [Self::Value]>
|
||||
where
|
||||
[Self::Value]: ToOwned;
|
||||
fn lifetime_start(&mut self, ptr: Self::Value, size: Size);
|
||||
fn lifetime_end(&mut self, ptr: Self::Value, size: Size);
|
||||
|
||||
/// If LLVM lifetime intrinsic support is enabled (i.e. optimizations
|
||||
/// on), and `ptr` is nonzero-sized, then extracts the size of `ptr`
|
||||
/// and the intrinsic for `lt` and passes them to `emit`, which is in
|
||||
/// charge of generating code to call the passed intrinsic on whatever
|
||||
/// block of generated code is targeted for the intrinsic.
|
||||
///
|
||||
/// If LLVM lifetime intrinsic support is disabled (i.e. optimizations
|
||||
/// off) or `ptr` is zero-sized, then no-op (does not call `emit`).
|
||||
fn call_lifetime_intrinsic(&mut self, intrinsic: &str, ptr: Self::Value, size: Size);
|
||||
/// Called for `StorageLive`
|
||||
fn lifetime_start(&mut self, ptr: Self::Value, size: Size);
|
||||
|
||||
/// Called for `StorageDead`
|
||||
fn lifetime_end(&mut self, ptr: Self::Value, size: Size);
|
||||
|
||||
fn call(
|
||||
&mut self,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue