[PATCH] D31220: [builtins][ARM] Select correct code fragments when compiling for Thumb1/Thum2/ARM ISA

Weiming Zhao via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 24 10:27:09 PDT 2017


weimingz added inline comments.


================
Comment at: lib/builtins/assembly.h:105
+#define USE_THUMB_1
+#endif
+#define DEFINE_CODE_MODE .thumb
----------------
compnerd wrote:
> weimingz wrote:
> > compnerd wrote:
> > > Is there a reason to use this alternate macro rather than directly using `__thumb2__` and `__thumb__` and ordering the sources to prefer thumb2, thumb, arm?
> > Sort of. For example, to check if it is Thumb1 only, we need to do
> > #if defined(__thumb__) && !defined(__thumb2)
> > To check if it's on ARM mode, we need to do
> > #if defined(__arm__) && !defined(__thumb__) && !defined(__thumb2__)
> > 
> > So still nice to have an indirect macro.
> Or we can do the following:
> 
>     #if defined(__thumb2__)
>       ...
>     #elif defined(__thumb__)
>       ...
>     #else
>       ...
>     #endif
> 
> The idea being that thumb2 is preferred, thumb1 accepted, and we fall back to ARM otherwise.  Is there something which cannot be represented that way?
A lot of code work for both thumb2 and arm under the unified syntax.
What we need is to specialize for thumb1.



https://reviews.llvm.org/D31220





More information about the llvm-commits mailing list