This is an archive of the discontinued LLVM Phabricator instance.

AArch64: Add command line option to select big or little endian
ClosedPublic

Authored by cpirker on Mar 28 2014, 1:14 PM.

Details

Reviewers
atanasyan
Summary

Hi All,

I added -EL to select little endian and -EB to select big endian AArch64.
I also added -mlittle-endian as alias for -EL and -mbig-endian as alias for -EB.

Little endian:

--target=aarch64
--target=aarch64 -EL
--target=aarch64 -mlittle-endian
--target=aarch64_be -EL
--target=aarch64_be -mlittle-endian

Big endian:

--target=aarch64_be
--target=aarch64 -EB
--target=aarch64 -mbig-endian
--target=aarch64_be -EB
--target=aarch64_be -mbig-endian

Please review.

Thanks,
Christian

Diff Detail

Event Timeline

Hi Chrisitan,

I'm not entirely convinced by the -EB/-EL version. It seems to be completely MIPS-specific in the GCC documentation, but -mbig-endian & -mlittle-endian apply to a few more (including ARM).

On the other hand, making it an alias does seem like rather a lot of sense implementation-wise. Perhaps make EB the alias for mbig--endian instead and drop the -EB tests? (On the grounds that it's not supported, but it's not really a big enough problem to bother with an error for).

Cheers.

Tim.

Hi Tim,

these options are costumer driven.

Thanks,
Christian

Hi Tim,

sorry, there is typo, I mean customer driven.

Thanks,
Christian

Hi Christian,

sorry, there is typo, I mean customer driven.

I don't think that really changes anything. If the customers *want*
them, then they need to provide justification.

If they're already using them (or, say, GCC is adding them and we need
to for compatibility) then there should be some evidence of that.
Google didn't turn it up when I tried.

Cheers.

Tim.

rnk added a comment.Apr 2 2014, 1:03 PM

Looks like -mbig-endian and -mlittle-endian are GCC options. We should
implement them for compatibility.
http://gcc.gnu.org/onlinedocs/gcc/ARM-Options.html

I don't think we should add -EL or -EB. They don't fit in with the set of
flags clang currently accepts.

The -EB/-EL options already exist, but effect only the MIPS backend (they are silently ignored for ARM target). This patch introduces -mbig-endian/-mlittle-endian as aliases for them. The options are:

[this is really just a restatement of what Tim said earlier]

  1. leave it as it is (possibly removing the tests for -EB/-EL from ARM targets)
  2. invert the aliasing (but that would mean otherwise needless changes to the MIPS targets)
  3. explicitly fault use of -EL/-EB for ARM targets (doesn't seem worthwhile)

Personally I vote for 1 with the -EB/-EL tests removed (or left in).

Support -EB/-EL is essential for MIPS. But I do not see any problems in inverting the aliasing. It looks like we need to change only a couple of lines in the computeTargetTriple() routine in that case.

Hi All,

I made already a similar path for ARM targets (D3307).

As written by Scott, he would prefer it as it is, with the -EB/-EL tests removed.
I think we can leave these tests in.
So would it be accepted to commit this patch (with all test cases)?

Thanks,
Christian

I'm also happy with inverting the aliasing; given the other comments, that seems to be the way to go.

Hi Christian,

Yep. That sounds like a good idea.

cpirker updated this revision to Unknown Object (????).Apr 10 2014, 6:28 AM

Hi,

I inverted the aliasing, and removed the -EL/-EB tests.
I made the same in D3307.

Thanks,
Christian

I committed this patch as r205966.

cpirker added a reviewer: atanasyan.EditedMay 15 2014, 1:41 AM

Hi Simon,

I added you as reviewer.
Can you please "Accepted Revision" so that I can "Close Revision"?
As you can see in the comment above, the patch is already committed (rL205966).

Thanks,
Christian

atanasyan accepted this revision.May 15 2014, 1:59 AM
atanasyan edited edge metadata.
This revision is now accepted and ready to land.May 15 2014, 1:59 AM
cpirker closed this revision.May 15 2014, 2:01 AM

Hi Christian,

I added you as reviewer.
Can you please "Accepted Revision" so that I can "Close Revision"?
As you can see in the comment above, the patch is already committed.

You can accept and close the revision yourself if you want. Phab is
just a convenience to us: as long as the review takes place somehow we
don't really care about its state changes.

(Oh, and if you leave the comment box blank, no e-mail notification
gets sent. It's obviously up to you whether you want that in any given
situation).

Cheers.

Tim.