[llvm-commits] [PATCH][GNU Build] Add LLVM_IS_TARGET_BIG_ENDIAN to config.h

Michael Spencer bigcheesegs at gmail.com
Fri Oct 22 01:14:54 PDT 2010


On Fri, Oct 22, 2010 at 2:13 AM, Chris Lattner <clattner at apple.com> wrote:
>
> On Oct 21, 2010, at 6:59 PM, Michael Spencer wrote:
>
>> On Thu, Oct 21, 2010 at 7:01 PM, Dale Johannesen <dalej at apple.com> wrote:
>>> I may have missed earlier discussion, but why do you want this at compile time?  Normally llvm is built to support multiple targets (not necessarily all of the same endianness) and endianness is checked at runtime; see TargetData.
>>
>> This is for the host target. It is used when working with endian
>> dependent data such as object files.
>
> I still don't get it.  If you want the endianness of the host, you can use llvm/System/Host.h.

I want it at compile time.

> Nothing about the target should be hard coded in at compile time.  You should be able to make elf .o files for both powerpc and x86 etc.
>
> -Chris

This isn't about the target. This is about the host, which I now
realize is not what that macro is... I really don't know how I missed
that...

The macro should be LLVM_IS_HOST_BIG_ENDIAN. But everything else is
still the same. I'll fix the CMake version, but I still need someone
to help with autoconf.

The point is so that you can memory map a file, and directly say "read
an unsigned 32 bit integer from this address encoded as littlendian."
On X86 this would just end up as a movl (%addr), %dest. While on PPC
this would expand to a read and a byteswap.

- Michael Spencer




More information about the llvm-commits mailing list