[compiler-rt] r219182 - builtins: rework use of DEFINE_COMPILERRT_THUMB_FUNCTION

Saleem Abdulrasool compnerd at compnerd.org
Mon Oct 6 19:39:13 PDT 2014


Author: compnerd
Date: Mon Oct  6 21:39:13 2014
New Revision: 219182

URL: http://llvm.org/viewvc/llvm-project?rev=219182&view=rev
Log:
builtins: rework use of DEFINE_COMPILERRT_THUMB_FUNCTION

This is simply to help clarity of the code.  The functions are built as thumb
only if Thumb2 is available (__ARM_ARCH_ISA_THUMB == 2).  Sink the selection
into the location of the definition and make DEFINE_COMPILERRT_THUMB_FUNCTION
always define a thumb function while DEFINE_COMPILERRT_FUNCTION always selects
the default.

Since the .thumb_func directive is always available (at least on Linux, Windows,
and BSD), sinking the macro right into the macro works just as well.

No functional change intended.

Modified:
    compiler-rt/trunk/lib/builtins/arm/bswapdi2.S
    compiler-rt/trunk/lib/builtins/arm/bswapsi2.S
    compiler-rt/trunk/lib/builtins/arm/clzdi2.S
    compiler-rt/trunk/lib/builtins/arm/clzsi2.S
    compiler-rt/trunk/lib/builtins/arm/divmodsi4.S
    compiler-rt/trunk/lib/builtins/arm/divsi3.S
    compiler-rt/trunk/lib/builtins/arm/modsi3.S
    compiler-rt/trunk/lib/builtins/arm/udivmodsi4.S
    compiler-rt/trunk/lib/builtins/arm/udivsi3.S
    compiler-rt/trunk/lib/builtins/arm/umodsi3.S
    compiler-rt/trunk/lib/builtins/assembly.h

Modified: compiler-rt/trunk/lib/builtins/arm/bswapdi2.S
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/builtins/arm/bswapdi2.S?rev=219182&r1=219181&r2=219182&view=diff
==============================================================================
--- compiler-rt/trunk/lib/builtins/arm/bswapdi2.S (original)
+++ compiler-rt/trunk/lib/builtins/arm/bswapdi2.S Mon Oct  6 21:39:13 2014
@@ -21,7 +21,11 @@
 // Reverse all the bytes in a 64-bit integer.
 //
 	.p2align 2
+#if __ARM_ARCH_ISA_THUMB == 2
 DEFINE_COMPILERRT_THUMB_FUNCTION(__bswapdi2)
+#else
+DEFINE_COMPILERRT_FUNCTION(__bswapdi2)
+#endif
 #if __ARM_ARCH < 6
     // before armv6 does not have "rev" instruction
     // r2 = rev(r0)

Modified: compiler-rt/trunk/lib/builtins/arm/bswapsi2.S
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/builtins/arm/bswapsi2.S?rev=219182&r1=219181&r2=219182&view=diff
==============================================================================
--- compiler-rt/trunk/lib/builtins/arm/bswapsi2.S (original)
+++ compiler-rt/trunk/lib/builtins/arm/bswapsi2.S Mon Oct  6 21:39:13 2014
@@ -21,7 +21,11 @@
 // Reverse all the bytes in a 32-bit integer.
 //
 	.p2align 2
+#if __ARM_ARCH_ISA_THUMB == 2
 DEFINE_COMPILERRT_THUMB_FUNCTION(__bswapsi2)
+#else
+DEFINE_COMPILERRT_FUNCTION(__bswapsi2)
+#endif
 #if __ARM_ARCH < 6
     // before armv6 does not have "rev" instruction
  	eor	r1, r0, r0, ror #16

Modified: compiler-rt/trunk/lib/builtins/arm/clzdi2.S
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/builtins/arm/clzdi2.S?rev=219182&r1=219181&r2=219182&view=diff
==============================================================================
--- compiler-rt/trunk/lib/builtins/arm/clzdi2.S (original)
+++ compiler-rt/trunk/lib/builtins/arm/clzdi2.S Mon Oct  6 21:39:13 2014
@@ -21,7 +21,11 @@
 
 
 	.p2align	2
+#if __ARM_ARCH_ISA_THUMB == 2
 DEFINE_COMPILERRT_THUMB_FUNCTION(__clzdi2)
+#else
+DEFINE_COMPILERRT_FUNCTION(__clzdi2)
+#endif
 #ifdef __ARM_FEATURE_CLZ
 #ifdef __ARMEB__
 	cmp	r0, 0

Modified: compiler-rt/trunk/lib/builtins/arm/clzsi2.S
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/builtins/arm/clzsi2.S?rev=219182&r1=219181&r2=219182&view=diff
==============================================================================
--- compiler-rt/trunk/lib/builtins/arm/clzsi2.S (original)
+++ compiler-rt/trunk/lib/builtins/arm/clzsi2.S Mon Oct  6 21:39:13 2014
@@ -20,7 +20,11 @@
 #endif
 
 	.p2align	2
+#if __ARM_ARCH_ISA_THUMB == 2
 DEFINE_COMPILERRT_THUMB_FUNCTION(__clzsi2)
+#else
+DEFINE_COMPILERRT_FUNCTION(__clzsi2)
+#endif
 #ifdef __ARM_FEATURE_CLZ
 	clz	r0, r0
 	JMP(lr)

Modified: compiler-rt/trunk/lib/builtins/arm/divmodsi4.S
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/builtins/arm/divmodsi4.S?rev=219182&r1=219181&r2=219182&view=diff
==============================================================================
--- compiler-rt/trunk/lib/builtins/arm/divmodsi4.S (original)
+++ compiler-rt/trunk/lib/builtins/arm/divmodsi4.S Mon Oct  6 21:39:13 2014
@@ -32,7 +32,11 @@
 @   value is the quotient, the remainder is placed in the variable.
 
 	.p2align 3
+#if __ARM_ARCH_ISA_THUMB == 2
 DEFINE_COMPILERRT_THUMB_FUNCTION(__divmodsi4)
+#else
+DEFINE_COMPILERRT_FUNCTION(__divmodsi4)
+#endif
 #if __ARM_ARCH_EXT_IDIV__
 	tst     r1, r1
 	beq     LOCAL_LABEL(divzero)

Modified: compiler-rt/trunk/lib/builtins/arm/divsi3.S
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/builtins/arm/divsi3.S?rev=219182&r1=219181&r2=219182&view=diff
==============================================================================
--- compiler-rt/trunk/lib/builtins/arm/divsi3.S (original)
+++ compiler-rt/trunk/lib/builtins/arm/divsi3.S Mon Oct  6 21:39:13 2014
@@ -33,7 +33,11 @@ DEFINE_AEABI_FUNCTION_ALIAS(__aeabi_idiv
 @ int __divsi3(int divident, int divisor)
 @   Calculate and return the quotient of the (signed) division.
 
+#if __ARM_ARCH_ISA_THUMB == 2
 DEFINE_COMPILERRT_THUMB_FUNCTION(__divsi3)
+#else
+DEFINE_COMPILERRT_FUNCTION(__divsi3)
+#endif
 #if __ARM_ARCH_EXT_IDIV__
    tst     r1,r1
    beq     LOCAL_LABEL(divzero)

Modified: compiler-rt/trunk/lib/builtins/arm/modsi3.S
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/builtins/arm/modsi3.S?rev=219182&r1=219181&r2=219182&view=diff
==============================================================================
--- compiler-rt/trunk/lib/builtins/arm/modsi3.S (original)
+++ compiler-rt/trunk/lib/builtins/arm/modsi3.S Mon Oct  6 21:39:13 2014
@@ -30,7 +30,11 @@
 @   Calculate and return the remainder of the (signed) division.
 
 	.p2align 3
+#if __ARM_ARCH_ISA_THUMB == 2
 DEFINE_COMPILERRT_THUMB_FUNCTION(__modsi3)
+#else
+DEFINE_COMPILERRT_FUNCTION(__modsi3)
+#endif
 #if __ARM_ARCH_EXT_IDIV__
 	tst     r1, r1
 	beq     LOCAL_LABEL(divzero)

Modified: compiler-rt/trunk/lib/builtins/arm/udivmodsi4.S
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/builtins/arm/udivmodsi4.S?rev=219182&r1=219181&r2=219182&view=diff
==============================================================================
--- compiler-rt/trunk/lib/builtins/arm/udivmodsi4.S (original)
+++ compiler-rt/trunk/lib/builtins/arm/udivmodsi4.S Mon Oct  6 21:39:13 2014
@@ -27,7 +27,11 @@
 @   value is the quotient, the remainder is placed in the variable.
 
 	.p2align 2
+#if __ARM_ARCH_ISA_THUMB == 2
 DEFINE_COMPILERRT_THUMB_FUNCTION(__udivmodsi4)
+#else
+DEFINE_COMPILERRT_FUNCTION(__udivmodsi4)
+#endif
 #if __ARM_ARCH_EXT_IDIV__
 	tst     r1, r1
 	beq     LOCAL_LABEL(divby0)

Modified: compiler-rt/trunk/lib/builtins/arm/udivsi3.S
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/builtins/arm/udivsi3.S?rev=219182&r1=219181&r2=219182&view=diff
==============================================================================
--- compiler-rt/trunk/lib/builtins/arm/udivsi3.S (original)
+++ compiler-rt/trunk/lib/builtins/arm/udivsi3.S Mon Oct  6 21:39:13 2014
@@ -27,7 +27,11 @@ DEFINE_AEABI_FUNCTION_ALIAS(__aeabi_uidi
 @ unsigned int __udivsi3(unsigned int divident, unsigned int divisor)
 @   Calculate and return the quotient of the (unsigned) division.
 
+#if __ARM_ARCH_ISA_THUMB == 2
 DEFINE_COMPILERRT_THUMB_FUNCTION(__udivsi3)
+#else
+DEFINE_COMPILERRT_FUNCTION(__udivsi3)
+#endif
 #if __ARM_ARCH_EXT_IDIV__
 	tst     r1, r1
 	beq     LOCAL_LABEL(divby0)

Modified: compiler-rt/trunk/lib/builtins/arm/umodsi3.S
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/builtins/arm/umodsi3.S?rev=219182&r1=219181&r2=219182&view=diff
==============================================================================
--- compiler-rt/trunk/lib/builtins/arm/umodsi3.S (original)
+++ compiler-rt/trunk/lib/builtins/arm/umodsi3.S Mon Oct  6 21:39:13 2014
@@ -24,7 +24,11 @@
 @   Calculate and return the remainder of the (unsigned) division.
 
 	.p2align 2
+#if __ARM_ARCH_ISA_THUMB == 2
 DEFINE_COMPILERRT_THUMB_FUNCTION(__umodsi3)
+#else
+DEFINE_COMPILERRT_FUNCTION(__umodsi3)
+#endif
 #if __ARM_ARCH_EXT_IDIV__
 	tst     r1, r1
 	beq     LOCAL_LABEL(divby0)

Modified: compiler-rt/trunk/lib/builtins/assembly.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/builtins/assembly.h?rev=219182&r1=219181&r2=219182&view=diff
==============================================================================
--- compiler-rt/trunk/lib/builtins/assembly.h (original)
+++ compiler-rt/trunk/lib/builtins/assembly.h Mon Oct  6 21:39:13 2014
@@ -28,15 +28,11 @@
 // tell linker it can break up file at label boundaries
 #define FILE_LEVEL_DIRECTIVE .subsections_via_symbols
 #define SYMBOL_IS_FUNC(name)
-#if __ARM_ARCH_ISA_THUMB == 2
-#define THUMB_FUNC .thumb_func
-#endif
 
 #elif defined(__ELF__)
 
 #define HIDDEN(name) .hidden name
 #define LOCAL_LABEL(name) .L_##name
-#define THUMB_FUNC
 #define FILE_LEVEL_DIRECTIVE
 #if defined(__arm__)
 #define SYMBOL_IS_FUNC(name) .type name,%function
@@ -48,13 +44,13 @@
 
 #define HIDDEN_DIRECTIVE(name)
 #define LOCAL_LABEL(name) .L ## name
+#define FILE_LEVEL_DIRECTIVE
 #define SYMBOL_IS_FUNC(name)                                                   \
   .def name SEPARATOR                                                          \
     .scl 2 SEPARATOR                                                           \
     .type 32 SEPARATOR                                                         \
   .endef
-#define THUMB_FUNC
-#define FILE_LEVEL_DIRECTIVE
+
 #endif
 
 #if defined(__arm__)
@@ -110,9 +106,9 @@
 #define DEFINE_COMPILERRT_THUMB_FUNCTION(name)                                 \
   FILE_LEVEL_DIRECTIVE SEPARATOR                                               \
   .globl SYMBOL_NAME(name) SEPARATOR                                           \
-  THUMB_FUNC                                                                   \
   SYMBOL_IS_FUNC(SYMBOL_NAME(name)) SEPARATOR                                  \
-  DECLARE_SYMBOL_VISIBILITY(name)                                              \
+  DECLARE_SYMBOL_VISIBILITY(name) SEPARATOR                                    \
+  .thumb_func                                                                  \
   SYMBOL_NAME(name):
 
 #define DEFINE_COMPILERRT_PRIVATE_FUNCTION(name)                               \





More information about the llvm-commits mailing list