Page MenuHomePhabricator

Preprocessor: improve ACLE 6.4 support
ClosedPublic

Authored by compnerd on Jun 14 2014, 3:02 PM.

Details

Summary

This improves conformance with ACLE 6.4.1. Define additional macros that
indicate support for the ARM and Thumb instruction set architecture. This
includes the following set of macros:

__ARM_ARCH
__ARM_ARCH_ISA_ARM
__ARM_ARCH_ISA_THUMB
__ARM_32BIT_STATE

These help identify the environment that the code is intended to execute on.

Diff Detail

Event Timeline

compnerd updated this revision to Diff 10420.Jun 14 2014, 3:02 PM
compnerd retitled this revision from to Preprocessor: improve ACLE 6.4 support.
compnerd updated this object.
compnerd edited the test plan for this revision. (Show Details)
compnerd added reviewers: t.p.northover, joey.
compnerd set the repository for this revision to rL LLVM.
compnerd added a subscriber: Unknown Object (MLST).
mroth added a subscriber: mroth.Jun 14 2014, 3:45 PM
t.p.northover edited edge metadata.Jun 15 2014, 3:01 AM

Hi Saleem,

I think this looks fine, but while you're in the area it looks like there's a bug in how __ARM_ARCH_PROFILE is defined:

test/Preprocessor/arm-acle-6.4.c
7

Just noticed this one, and I think it might be a misinterpretation of the ACLE. I would expect this to be the character value 'M' rather than some isolated token.

A quick GCC test suggests this is how they do it ("#define __ARM_ARCH_PROFILE 65" for Cortex-A15, which is also dodgy in C++ mode, but less so).

With Tim's comment fixed, LGTM.

test/Preprocessor/arm-acle-6.4.c
7

I'd prefer a quoted char.

A quick GCC test suggests this is how they do it ("#define __ARM_ARCH_PROFILE 65" for Cortex-A15, which is also dodgy in C++ mode, but less so).

I'd prefer a quoted char.

Me too. From the ACLE wording, I'd expect sizeof(__ARM_ARCH_PROFILE)

1 in C++ mode.

Cheers.

Tim.

Actually, the current handling of 6.4.2 is incorrect. It is *supposed* to be a quoted char. If you look at the example provided in 6.4.10, you will notice that this:

#if __ARCH_ARM_PROFILE == 'R'

Fixed that as well. That was a great catch!

compnerd accepted this revision.Jun 15 2014, 12:15 PM
compnerd added a reviewer: compnerd.
This revision is now accepted and ready to land.Jun 15 2014, 12:15 PM
compnerd closed this revision.Jun 15 2014, 12:15 PM

Committed as SVN r210991.