1
Fork 0

Remove unused return values from resume and cleanup_ret

Given that these instructions are diverging, not every codegen backend
may be able to produce a return value for them.
This commit is contained in:
bjorn3 2022-01-24 13:48:09 +01:00
parent 19dd2ecc2d
commit e9646fa76b
3 changed files with 13 additions and 18 deletions

View file

@ -1275,7 +1275,7 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> {
// TODO(antoyo) // TODO(antoyo)
} }
fn resume(&mut self, _exn: RValue<'gcc>) -> RValue<'gcc> { fn resume(&mut self, _exn: RValue<'gcc>) {
unimplemented!(); unimplemented!();
} }
@ -1283,7 +1283,7 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> {
unimplemented!(); unimplemented!();
} }
fn cleanup_ret(&mut self, _funclet: &Funclet, _unwind: Option<Block<'gcc>>) -> RValue<'gcc> { fn cleanup_ret(&mut self, _funclet: &Funclet, _unwind: Option<Block<'gcc>>) {
unimplemented!(); unimplemented!();
} }

View file

@ -983,8 +983,10 @@ impl<'a, 'll, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> {
} }
} }
fn resume(&mut self, exn: &'ll Value) -> &'ll Value { fn resume(&mut self, exn: &'ll Value) {
unsafe { llvm::LLVMBuildResume(self.llbuilder, exn) } unsafe {
llvm::LLVMBuildResume(self.llbuilder, exn);
}
} }
fn cleanup_pad(&mut self, parent: Option<&'ll Value>, args: &[&'ll Value]) -> Funclet<'ll> { fn cleanup_pad(&mut self, parent: Option<&'ll Value>, args: &[&'ll Value]) -> Funclet<'ll> {
@ -1001,14 +1003,11 @@ impl<'a, 'll, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> {
Funclet::new(ret.expect("LLVM does not have support for cleanuppad")) Funclet::new(ret.expect("LLVM does not have support for cleanuppad"))
} }
fn cleanup_ret( fn cleanup_ret(&mut self, funclet: &Funclet<'ll>, unwind: Option<&'ll BasicBlock>) {
&mut self, unsafe {
funclet: &Funclet<'ll>, llvm::LLVMRustBuildCleanupRet(self.llbuilder, funclet.cleanuppad(), unwind)
unwind: Option<&'ll BasicBlock>, .expect("LLVM does not have support for cleanupret");
) -> &'ll Value { }
let ret =
unsafe { llvm::LLVMRustBuildCleanupRet(self.llbuilder, funclet.cleanuppad(), unwind) };
ret.expect("LLVM does not have support for cleanupret")
} }
fn catch_pad(&mut self, parent: &'ll Value, args: &[&'ll Value]) -> Funclet<'ll> { fn catch_pad(&mut self, parent: &'ll Value, args: &[&'ll Value]) -> Funclet<'ll> {

View file

@ -431,15 +431,11 @@ pub trait BuilderMethods<'a, 'tcx>:
num_clauses: usize, num_clauses: usize,
) -> Self::Value; ) -> Self::Value;
fn set_cleanup(&mut self, landing_pad: Self::Value); fn set_cleanup(&mut self, landing_pad: Self::Value);
fn resume(&mut self, exn: Self::Value) -> Self::Value; fn resume(&mut self, exn: Self::Value);
// These are used only by msvc // These are used only by msvc
fn cleanup_pad(&mut self, parent: Option<Self::Value>, args: &[Self::Value]) -> Self::Funclet; fn cleanup_pad(&mut self, parent: Option<Self::Value>, args: &[Self::Value]) -> Self::Funclet;
fn cleanup_ret( fn cleanup_ret(&mut self, funclet: &Self::Funclet, unwind: Option<Self::BasicBlock>);
&mut self,
funclet: &Self::Funclet,
unwind: Option<Self::BasicBlock>,
) -> Self::Value;
fn catch_pad(&mut self, parent: Self::Value, args: &[Self::Value]) -> Self::Funclet; fn catch_pad(&mut self, parent: Self::Value, args: &[Self::Value]) -> Self::Funclet;
fn catch_switch( fn catch_switch(
&mut self, &mut self,