Skip to content

Commit 19dd2ec

Browse files
committed
Reorder unwinding related builder methods to differentiate between dwarf and msvc instructions
1 parent ef119d7 commit 19dd2ec

File tree

3 files changed

+15
-11
lines changed

3 files changed

+15
-11
lines changed

compiler/rustc_codegen_gcc/src/builder.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1256,6 +1256,10 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> {
12561256
aggregate_value
12571257
}
12581258

1259+
fn set_personality_fn(&mut self, _personality: RValue<'gcc>) {
1260+
// TODO(antoyo)
1261+
}
1262+
12591263
fn landing_pad(&mut self, _ty: Type<'gcc>, _pers_fn: RValue<'gcc>, _num_clauses: usize) -> RValue<'gcc> {
12601264
let field1 = self.context.new_field(None, self.u8_type, "landing_pad_field_1");
12611265
let field2 = self.context.new_field(None, self.i32_type, "landing_pad_field_1");
@@ -1295,10 +1299,6 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> {
12951299
unimplemented!();
12961300
}
12971301

1298-
fn set_personality_fn(&mut self, _personality: RValue<'gcc>) {
1299-
// TODO(antoyo)
1300-
}
1301-
13021302
// Atomic Operations
13031303
fn atomic_cmpxchg(&mut self, dst: RValue<'gcc>, cmp: RValue<'gcc>, src: RValue<'gcc>, order: AtomicOrdering, failure_order: AtomicOrdering, weak: bool) -> RValue<'gcc> {
13041304
let expected = self.current_func().new_local(None, cmp.get_type(), "expected");

compiler/rustc_codegen_llvm/src/builder.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -956,6 +956,12 @@ impl<'a, 'll, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> {
956956
unsafe { llvm::LLVMBuildInsertValue(self.llbuilder, agg_val, elt, idx as c_uint, UNNAMED) }
957957
}
958958

959+
fn set_personality_fn(&mut self, personality: &'ll Value) {
960+
unsafe {
961+
llvm::LLVMSetPersonalityFn(self.llfn(), personality);
962+
}
963+
}
964+
959965
fn landing_pad(
960966
&mut self,
961967
ty: &'ll Type,
@@ -1044,12 +1050,6 @@ impl<'a, 'll, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> {
10441050
}
10451051
}
10461052

1047-
fn set_personality_fn(&mut self, personality: &'ll Value) {
1048-
unsafe {
1049-
llvm::LLVMSetPersonalityFn(self.llfn(), personality);
1050-
}
1051-
}
1052-
10531053
// Atomic Operations
10541054
fn atomic_cmpxchg(
10551055
&mut self,

compiler/rustc_codegen_ssa/src/traits/builder.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -421,6 +421,9 @@ pub trait BuilderMethods<'a, 'tcx>:
421421
fn extract_value(&mut self, agg_val: Self::Value, idx: u64) -> Self::Value;
422422
fn insert_value(&mut self, agg_val: Self::Value, elt: Self::Value, idx: u64) -> Self::Value;
423423

424+
fn set_personality_fn(&mut self, personality: Self::Value);
425+
426+
// These are used by everyone except msvc
424427
fn landing_pad(
425428
&mut self,
426429
ty: Self::Type,
@@ -429,6 +432,8 @@ pub trait BuilderMethods<'a, 'tcx>:
429432
) -> Self::Value;
430433
fn set_cleanup(&mut self, landing_pad: Self::Value);
431434
fn resume(&mut self, exn: Self::Value) -> Self::Value;
435+
436+
// These are used only by msvc
432437
fn cleanup_pad(&mut self, parent: Option<Self::Value>, args: &[Self::Value]) -> Self::Funclet;
433438
fn cleanup_ret(
434439
&mut self,
@@ -443,7 +448,6 @@ pub trait BuilderMethods<'a, 'tcx>:
443448
num_handlers: usize,
444449
) -> Self::Value;
445450
fn add_handler(&mut self, catch_switch: Self::Value, handler: Self::BasicBlock);
446-
fn set_personality_fn(&mut self, personality: Self::Value);
447451

448452
fn atomic_cmpxchg(
449453
&mut self,

0 commit comments

Comments
 (0)