[llvm-dev] Non-native endianness support in Clang
Finkel, Hal J. via llvm-dev
llvm-dev at lists.llvm.org
Mon Aug 26 11:59:13 PDT 2019
On 8/26/19 9:18 AM, Guy Benyei via llvm-dev wrote:
> I'd like to implement the gnu attribute "scalar_storage_order" to mark structs with non-native endianness. My rational is working on network protocols over little endian architecture (for instance: RiscV).
> An old bug is open on this issue here:
> I'd like to discuss the possible ways to implement this.
> The GCC implementation is pretty complicated, touching almost everything, modifying optimizations, etc...:
> I think, it would be better, to implement this attribute in the frontend only, adding the required byte-swaps early.
I agree. Adding the swaps in the frontend seems relatively
straightforward. As I understand it, for non-packed structs, you also
need to adjust the relative position of the padding?
> Any thoughts, ideas, objections?
> Guy Benyei
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
Lead, Compiler Technology and Programming Languages
Leadership Computing Facility
Argonne National Laboratory
More information about the llvm-dev