Skip to content

Commit b35a323

Browse files
committed
[pr2] base
1 parent f8162ae commit b35a323

File tree

9 files changed

+3091
-97
lines changed

9 files changed

+3091
-97
lines changed

cranelift/codegen/src/ir/function.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,13 @@ impl FunctionStencil {
255255
self.get_dyn_scale(dyn_ty)
256256
}
257257

258+
/// Find the data for the given stack slot
259+
pub fn get_stack_slot_data(&self, stack_slot: StackSlot) -> &StackSlotData {
260+
self.sized_stack_slots
261+
.get(stack_slot)
262+
.expect("undeclared stack slot: {stack_slot}")
263+
}
264+
258265
/// Get a concrete `Type` from a user defined `DynamicType`.
259266
pub fn get_concrete_dynamic_ty(&self, ty: DynamicType) -> Option<Type> {
260267
self.dfg

cranelift/codegen/src/isa/x64/abi.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ impl ABIMachineSpec for X64ABIMachineSpec {
104104
mut args: ArgsAccumulator,
105105
) -> CodegenResult<(u32, Option<usize>)> {
106106
let is_fastcall = call_conv == CallConv::WindowsFastcall;
107+
let is_tail = call_conv == CallConv::Tail;
107108

108109
let mut next_gpr = 0;
109110
let mut next_vreg = 0;
@@ -182,6 +183,11 @@ impl ABIMachineSpec for X64ABIMachineSpec {
182183
// This is consistent with LLVM's behavior, and is needed for
183184
// some uses of Cranelift (e.g., the rustc backend).
184185
//
186+
// - Otherwise, if the calling convention is Tail, we behave as in
187+
// the previous case, even if `enable_llvm_abi_extensions` is not
188+
// set in the flags: This is a custom calling convention defined
189+
// by Cranelift, LLVM doesn't know about it.
190+
//
185191
// - Otherwise, both SysV and Fastcall specify behavior (use of
186192
// vector register, a register pair, or passing by reference
187193
// depending on the case), but for simplicity, we will just panic if
@@ -195,6 +201,7 @@ impl ABIMachineSpec for X64ABIMachineSpec {
195201
if param.value_type.bits() > 64
196202
&& !(param.value_type.is_vector() || param.value_type.is_float())
197203
&& !flags.enable_llvm_abi_extensions()
204+
&& !is_tail
198205
{
199206
panic!(
200207
"i128 args/return values not supported unless LLVM ABI extensions are enabled"

0 commit comments

Comments
 (0)