diff options
| author | bors <bors@rust-lang.org> | 2022-12-12 10:38:31 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2022-12-12 10:38:31 +0000 |
| commit | 37d7de337903a558dbeb1e82c844fe915ab8ff25 (patch) | |
| tree | d4919a64af3b34d516f096975fb26454240aeaa5 /compiler/rustc_codegen_llvm/src/builder.rs | |
| parent | 2176e3a7a4a8dfbea92f3104244fbf8fad4faf9a (diff) | |
| parent | 262ace528425e6e22ccc0a5afd6321a566ab18d7 (diff) | |
| download | rust-37d7de337903a558dbeb1e82c844fe915ab8ff25.tar.gz rust-37d7de337903a558dbeb1e82c844fe915ab8ff25.zip | |
Auto merge of #105252 - bjorn3:codegen_less_pair_values, r=nagisa
Use struct types during codegen in less places This makes it easier to use cg_ssa from a backend like Cranelift that doesn't have any struct types at all. After this PR struct types are still used for function arguments and return values. Removing those usages is harder but should still be doable.
Diffstat (limited to 'compiler/rustc_codegen_llvm/src/builder.rs')
| -rw-r--r-- | compiler/rustc_codegen_llvm/src/builder.rs | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/compiler/rustc_codegen_llvm/src/builder.rs b/compiler/rustc_codegen_llvm/src/builder.rs index 83bffb20e0c..853a8b82853 100644 --- a/compiler/rustc_codegen_llvm/src/builder.rs +++ b/compiler/rustc_codegen_llvm/src/builder.rs @@ -979,15 +979,20 @@ impl<'a, 'll, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> { } } - fn cleanup_landing_pad(&mut self, ty: &'ll Type, pers_fn: &'ll Value) -> &'ll Value { + fn cleanup_landing_pad(&mut self, pers_fn: &'ll Value) -> (&'ll Value, &'ll Value) { + let ty = self.type_struct(&[self.type_i8p(), self.type_i32()], false); let landing_pad = self.landing_pad(ty, pers_fn, 1 /* FIXME should this be 0? */); unsafe { llvm::LLVMSetCleanup(landing_pad, llvm::True); } - landing_pad + (self.extract_value(landing_pad, 0), self.extract_value(landing_pad, 1)) } - fn resume(&mut self, exn: &'ll Value) { + fn resume(&mut self, exn0: &'ll Value, exn1: &'ll Value) { + let ty = self.type_struct(&[self.type_i8p(), self.type_i32()], false); + let mut exn = self.const_undef(ty); + exn = self.insert_value(exn, exn0, 0); + exn = self.insert_value(exn, exn1, 1); unsafe { llvm::LLVMBuildResume(self.llbuilder, exn); } |
