|
1 | 1 | // reference: https://github.com/espressif/clang-xtensa/commit/6fb488d2553f06029e6611cf81c6efbd45b56e47#diff-aa74ae1e1ab6b7149789237edb78e688R8450
|
2 | 2 |
|
3 | 3 |
|
4 |
| -use crate::abi::call::{ArgType, FnType, Reg, Uniform}; |
| 4 | +use crate::abi::call::{ArgAbi, FnAbi, Reg, Uniform}; |
5 | 5 |
|
6 | 6 | const NUM_ARG_GPR: u64 = 6;
|
7 | 7 | const MAX_ARG_IN_REGS_SIZE: u64 = 4 * 32;
|
8 | 8 | // const MAX_ARG_DIRECT_SIZE : u64 = MAX_ARG_IN_REGS_SIZE;
|
9 | 9 | const MAX_RET_IN_REGS_SIZE: u64 = 2 * 32;
|
10 | 10 |
|
11 |
| -fn classify_ret_ty<Ty>(arg: &mut ArgType<'_, Ty>, xlen: u64) { |
| 11 | +fn classify_ret_ty<Ty>(arg: &mut ArgAbi<'_, Ty>, xlen: u64) { |
12 | 12 | // The rules for return and argument types are the same, so defer to
|
13 | 13 | // classifyArgumentType.
|
14 | 14 | classify_arg_ty(arg, xlen, &mut 2); // two as max return size
|
15 | 15 | }
|
16 | 16 |
|
17 | 17 |
|
18 |
| -fn classify_arg_ty<Ty>(arg: &mut ArgType<'_, Ty>, xlen: u64, remaining_gpr: &mut u64) { |
| 18 | +fn classify_arg_ty<Ty>(arg: &mut ArgAbi<'_, Ty>, xlen: u64, remaining_gpr: &mut u64) { |
19 | 19 | // Determine the number of GPRs needed to pass the current argument
|
20 | 20 | // according to the ABI. 2*XLen-aligned varargs are passed in "aligned"
|
21 | 21 | // register pairs, so may consume 3 registers.
|
@@ -62,21 +62,21 @@ fn classify_arg_ty<Ty>(arg: &mut ArgType<'_, Ty>, xlen: u64, remaining_gpr: &mut
|
62 | 62 | arg.make_indirect();
|
63 | 63 | }
|
64 | 64 |
|
65 |
| -pub fn compute_abi_info<Ty>(fty: &mut FnType<'_, Ty>, xlen: u64) { |
66 |
| - if !fty.ret.is_ignore() { |
67 |
| - classify_ret_ty(&mut fty.ret, xlen); |
| 65 | +pub fn compute_abi_info<Ty>(fabi: &mut FnAbi<'_, Ty>, xlen: u64) { |
| 66 | + if !fabi.ret.is_ignore() { |
| 67 | + classify_ret_ty(&mut fabi.ret, xlen); |
68 | 68 | }
|
69 | 69 |
|
70 |
| - let return_indirect = fty.ret.layout.size.bits() > MAX_RET_IN_REGS_SIZE || |
71 |
| - fty.ret.is_indirect(); |
| 70 | + let return_indirect = fabi.ret.layout.size.bits() > MAX_RET_IN_REGS_SIZE || |
| 71 | + fabi.ret.is_indirect(); |
72 | 72 |
|
73 | 73 | let mut remaining_gpr = if return_indirect {
|
74 | 74 | NUM_ARG_GPR - 1
|
75 | 75 | } else {
|
76 | 76 | NUM_ARG_GPR
|
77 | 77 | };
|
78 | 78 |
|
79 |
| - for arg in &mut fty.args { |
| 79 | + for arg in &mut fabi.args { |
80 | 80 | if arg.is_ignore() {
|
81 | 81 | continue;
|
82 | 82 | }
|
|
0 commit comments