Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion compiler/rustc_codegen_ssa/src/mir/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1737,7 +1737,8 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
op.store_with_annotation(bx, scratch);
(scratch.val.llval, scratch.val.align, true)
}
_ => (op.immediate_or_packed_pair(bx), arg.layout.align.abi, false),
PassMode::Direct(_) => (op.immediate(), arg.layout.align.abi, false),
PassMode::Ignore | PassMode::Pair(..) => unreachable!("handled above"),
},
Ref(op_place_val) => match arg.mode {
PassMode::Indirect { attrs, on_stack, .. } => {
Expand Down
9 changes: 6 additions & 3 deletions compiler/rustc_codegen_ssa/src/mir/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -499,9 +499,12 @@ fn arg_local_refs<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
PassMode::Direct(_) => {
let llarg = bx.get_param(llarg_idx);
llarg_idx += 1;
return local(OperandRef::from_immediate_or_packed_pair(
bx, llarg, arg.layout,
));
debug_assert!(bx.is_backend_immediate(arg.layout));
return local(OperandRef {
val: OperandValue::Immediate(llarg),
layout: arg.layout,
move_annotation: None,
});
}
PassMode::Pair(..) => {
let (a, b) = (bx.get_param(llarg_idx), bx.get_param(llarg_idx + 1));
Expand Down
6 changes: 6 additions & 0 deletions compiler/rustc_codegen_ssa/src/mir/operand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,9 @@ impl<'a, 'tcx, V: CodegenObject> OperandRef<'tcx, V> {

/// If this operand is a `Pair`, we return an aggregate with the two values.
/// For other cases, see `immediate`.
///
/// Note: The use of this is discouraged outside cg_llvm, as some other backends
/// don't natively support packing multiple things into one like this.
pub fn immediate_or_packed_pair<Bx: BuilderMethods<'a, 'tcx, Value = V>>(
self,
bx: &mut Bx,
Expand All @@ -324,6 +327,9 @@ impl<'a, 'tcx, V: CodegenObject> OperandRef<'tcx, V> {
}

/// If the type is a pair, we return a `Pair`, otherwise, an `Immediate`.
///
/// Note: The use of this is discouraged outside cg_llvm, as some other backends
/// don't natively support packing multiple things into one like this.
pub fn from_immediate_or_packed_pair<Bx: BuilderMethods<'a, 'tcx, Value = V>>(
bx: &mut Bx,
llval: V,
Expand Down
Loading