[PATCH] D115169: Create a generic ABI document for _BitInt
Jens Gustedt via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Sep 22 06:30:03 PDT 2022
gustedt added a comment.
>> Also discussing consequences for `va_arg` functions such as `printf` would be nice.
>
> Does the information in the `Passing and Returning an Object` section suffice, or are there more details you're looking for there?
The narrow `_BitInt` types are not promoted to `int` for arithmetic.
For the function call ABI we would need to know if the same strategy holds for `va_arg` parameters. For each of these types with representing standard integer type `T` two scenarios would be possible
- When passed to a `va_arg` function the same rules for `T` as an argument for a prototyped function parameter apply.
- When passed to a `va_arg` function the value is promoted as if it where a `T`, that is in general there is a promotion to `int`.
This has in particular implications to whether or not the `wN` length modifier for `printf` and `scanf` can be used for narrow `_BitInt` types or not: in the first scenario that would not be possible in the second in would be possible without problems.
I would be much in favor of the second choice, `va_arg` functions usually are not made to handle narrow input well.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D115169/new/
https://reviews.llvm.org/D115169
More information about the cfe-commits
mailing list