[llvm-dev] [elf2] How to support both big and little endian MIPS targets

Simon Atanasyan via llvm-dev llvm-dev at lists.llvm.org
Tue Oct 13 03:17:24 PDT 2015


Hi,

I need an advice how to support both big and little endian MIPS
targets in the new LLD ELF design and escape code duplication. MIPS
32-bit big and little endian targets are very similar and differ in
read/write functions. There are some options how to support both but I
cannot make the best choice.

1. Make MipsTargetInfo a class template. Use the template's argument
to select read/write routines.
2. Pass boolean argument to the MipsTargetInfo constructor. Use this
argument to select read/write routines.
3. Create a hierarchy of MipsTargetInfo classes. Keep common code in
the MipsTargetInfo class, move endian-dependent code into the
MipsELTargetInfo / MipsBETargetInfo descendants.
4. Anything else?

-- 
Simon Atanasyan


More information about the llvm-dev mailing list