[PATCH] D81285: [builtins] Change si_int to int in some helper declarations

Ayke via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 9 08:12:22 PDT 2020


aykevl added a comment.

I'm not sure whether `native_int` is any clearer than just `int`. I'm afraid it only introduces more complexity ("What's `native_int`? Oh, it's just `int`").

Perhaps a controversial idea: what about changing to use stdint.h types?
`si_int` -> `int32_t`
`su_int` -> `uint32_t`
`di_int` -> `int64_t`
etc
These types are clearly defined and immediately recognizable. The meaning is, as far as I can see, exactly the same (`si_int` etc seems to be a leftover from GCC internal naming conventions, such as `SImode`).

Also note that the libgcc documentation does not always reflect the real world. For example, `__divmodsi4` on AVR libgcc has a very different signature: it returns both the division result and the remainder in registers.



================
Comment at: compiler-rt/lib/builtins/int_lib.h:112
 
-uint32_t __inline __builtin_ctz(uint32_t value) {
+int __inline __builtin_ctz(uint32_t value) {
   unsigned long trailing_zero = 0;
----------------
Why `int` and not `native_int` here?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D81285/new/

https://reviews.llvm.org/D81285





More information about the cfe-commits mailing list