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

Saleem Abdulrasool via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 24 10:20:30 PDT 2017

compnerd added inline comments.

Comment at: lib/builtins/assembly.h:105
+#define USE_THUMB_1
+#define DEFINE_CODE_MODE .thumb
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__)

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?


More information about the llvm-commits mailing list