[RFC] Add a New Byte Type to LLVM IR

uintptr_t maps to unsigned __intcap, which I guess one would view as an extended integral type, at the C language level. The implementation for how that’s compiled by Clang+LLVM is to use ptr (with appropriate addrspace), rather than introduce a new capability-as-integer type in IR. If you do arithmetic on uintptr_t, that’s mapped to “do the arithmetic on the address portion (what ptrtoaddr now gives upstream) and adjust the original pointer to use that address (historically via an intrinsic, but you can also do a GEP/ptradd of the difference)”, or just GEP in the case of addition/subtraction as a special case (we could also use the ptrmask intrinsic for some bitwise operations now I suppose too).

1 Like