Support for byte sizes larger than 8 bits

Hello LLVMdev,

lately the company I work for has bumped into a need for a way to specify a size of byte larger than the regular 8 bits for our targets. After a bit of research we found out that the feature would require changes across most of the LLVM framework (including clang) and maintaining such changes without involving the LLVM devs would be tedious to say the least.

So my first question would be if such a feature would be welcome in the LLVM framework. The motivation for implementing the feature is that certain embedded processors often use custom byte sizes, such as 12 bits, to conserve power while addressing its memory.

The first solution sketch we came up with is to introduce a new field into the data layout string that would specify the size of a byte (or char). The default value of the field would be the regular 8 bits. This way, the information should be propagated through all the necessary parts of LLVM.

The second issue is how to find and modify the existing code that relies on the assumption that a byte (or char) in the target is always 8 bits.

The changes we would introduce, should the feature be accepted, would of course be tested against an existing LLVM target and test-suites to ensure that we didn't break anything.


Marek Surovic

We maintain a set of patches, supporting 16-bit bytes for LLVM (currently not Clang), which may be provided upon request.

/Patrik Hägglund