[llvm] [BPF] i128 direct return support (PR #183258)
Claire Fan via llvm-commits
llvm-commits at lists.llvm.org
Sat Mar 7 13:15:25 PST 2026
clairechingching wrote:
> Since we are talking about i128 direct return, maybe we should use the following in calling convention?
>
> ```
> +def RetCC_BPF64 : CallingConv<[
> + // i128 is returned in two 64-bit registers (low then high).
> + CCIfType<[i128], CCAssignToReg<[R0, R1]>>,
> +]>;
> def RetCC_BPF32 : CallingConv<[
> + // i128 is returned in R0/R1 (low then high).
> + CCIfType<[i128], CCAssignToRegWithShadow<[R0, R1], [W0, W1]>>,
> ]>;
> ```
> Also, please check getNumRegistersForCallingConv and getRegisterTypeForCallingConv which are used in other architectures.
`getNumRegistersForCallingConv` and `getRegisterTypeForCallingConv` already make i128 type split into two i64 values at the time of return lowering, so only code change regarding calling convention is to allow return to use R1 in the table gen file
<img width="709" height="203" alt="Screenshot 2026-03-02 at 5 43 47 PM" src="https://github.com/user-attachments/assets/73b992a3-856e-4553-960d-2d904a58b333" />
> No. So you cannot land this patch until the kernel verifier support is there. Even that we may need some flag or some marco to enable this. Otherwise, the newer compiler with old kernel won't work.
yep! i'm also working adding the support at the kernel side and i also added target feature to enable this in the latest commit
https://github.com/llvm/llvm-project/pull/183258
More information about the llvm-commits
mailing list