[compiler-rt] r249953 - builtins: spell inline as __inline

Saleem Abdulrasool via llvm-commits llvm-commits at lists.llvm.org
Sat Oct 10 14:21:29 PDT 2015


Author: compnerd
Date: Sat Oct 10 16:21:28 2015
New Revision: 249953

URL: http://llvm.org/viewvc/llvm-project?rev=249953&view=rev
Log:
builtins: spell inline as __inline

__inline is a vendor specific spelling for inline.  clang and gcc treat it the
same as inline, and is available in MSVC 2013 which does not implement C99
(VS2015 supports the inline keyword though).  This will allow us to build the
builtins using MSVC.

Modified:
    compiler-rt/trunk/lib/builtins/atomic.c
    compiler-rt/trunk/lib/builtins/emutls.c
    compiler-rt/trunk/lib/builtins/fp_add_impl.inc
    compiler-rt/trunk/lib/builtins/fp_extend.h
    compiler-rt/trunk/lib/builtins/fp_extend_impl.inc
    compiler-rt/trunk/lib/builtins/fp_fixint_impl.inc
    compiler-rt/trunk/lib/builtins/fp_fixuint_impl.inc
    compiler-rt/trunk/lib/builtins/fp_lib.h
    compiler-rt/trunk/lib/builtins/fp_mul_impl.inc
    compiler-rt/trunk/lib/builtins/fp_trunc.h
    compiler-rt/trunk/lib/builtins/fp_trunc_impl.inc
    compiler-rt/trunk/lib/builtins/int_types.h
    compiler-rt/trunk/lib/builtins/ppc/DD.h

Modified: compiler-rt/trunk/lib/builtins/atomic.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/builtins/atomic.c?rev=249953&r1=249952&r2=249953&view=diff
==============================================================================
--- compiler-rt/trunk/lib/builtins/atomic.c (original)
+++ compiler-rt/trunk/lib/builtins/atomic.c Sat Oct 10 16:21:28 2015
@@ -56,13 +56,13 @@ static const long SPINLOCK_MASK = SPINLO
 #include <machine/atomic.h>
 #include <sys/umtx.h>
 typedef struct _usem Lock;
-inline static void unlock(Lock *l) {
+__inline static void unlock(Lock *l) {
   __c11_atomic_store((_Atomic(uint32_t)*)&l->_count, 1, __ATOMIC_RELEASE);
   __c11_atomic_thread_fence(__ATOMIC_SEQ_CST);
   if (l->_has_waiters)
       _umtx_op(l, UMTX_OP_SEM_WAKE, 1, 0, 0);
 }
-inline static void lock(Lock *l) {
+__inline static void lock(Lock *l) {
   uint32_t old = 1;
   while (!__c11_atomic_compare_exchange_weak((_Atomic(uint32_t)*)&l->_count, &old,
         0, __ATOMIC_ACQUIRE, __ATOMIC_RELAXED)) {
@@ -76,12 +76,12 @@ static Lock locks[SPINLOCK_COUNT] = { [0
 #elif defined(__APPLE__)
 #include <libkern/OSAtomic.h>
 typedef OSSpinLock Lock;
-inline static void unlock(Lock *l) {
+__inline static void unlock(Lock *l) {
   OSSpinLockUnlock(l);
 }
 /// Locks a lock.  In the current implementation, this is potentially
 /// unbounded in the contended case.
-inline static void lock(Lock *l) {  
+__inline static void lock(Lock *l) {
   OSSpinLockLock(l);
 }
 static Lock locks[SPINLOCK_COUNT]; // initialized to OS_SPINLOCK_INIT which is 0
@@ -89,12 +89,12 @@ static Lock locks[SPINLOCK_COUNT]; // in
 #else
 typedef _Atomic(uintptr_t) Lock;
 /// Unlock a lock.  This is a release operation.
-inline static void unlock(Lock *l) {
+__inline static void unlock(Lock *l) {
   __c11_atomic_store(l, 0, __ATOMIC_RELEASE);
 }
 /// Locks a lock.  In the current implementation, this is potentially
 /// unbounded in the contended case.
-inline static void lock(Lock *l) {
+__inline static void lock(Lock *l) {
   uintptr_t old = 0;
   while (!__c11_atomic_compare_exchange_weak(l, &old, 1, __ATOMIC_ACQUIRE,
         __ATOMIC_RELAXED))
@@ -106,7 +106,7 @@ static Lock locks[SPINLOCK_COUNT];
 
 
 /// Returns a lock to use for a given pointer.  
-static inline Lock *lock_for_pointer(void *ptr) {
+static __inline Lock *lock_for_pointer(void *ptr) {
   intptr_t hash = (intptr_t)ptr;
   // Disregard the lowest 4 bits.  We want all values that may be part of the
   // same memory operation to hash to the same value and therefore use the same

Modified: compiler-rt/trunk/lib/builtins/emutls.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/builtins/emutls.c?rev=249953&r1=249952&r2=249953&view=diff
==============================================================================
--- compiler-rt/trunk/lib/builtins/emutls.c (original)
+++ compiler-rt/trunk/lib/builtins/emutls.c Sat Oct 10 16:21:28 2015
@@ -37,7 +37,7 @@ typedef struct __emutls_control {
     void* value;  /* null or non-zero initial value for the object */
 } __emutls_control;
 
-static inline void* emutls_memalign_alloc(size_t align, size_t size) {
+static __inline void *emutls_memalign_alloc(size_t align, size_t size) {
     void *base;
 #if EMUTLS_USE_POSIX_MEMALIGN
     if (posix_memalign(&base, align, size) != 0)
@@ -55,7 +55,7 @@ static inline void* emutls_memalign_allo
     return base;
 }
 
-static inline void emutls_memalign_free(void* base) {
+static __inline void emutls_memalign_free(void *base) {
 #if EMUTLS_USE_POSIX_MEMALIGN
     free(base);
 #else
@@ -65,7 +65,7 @@ static inline void emutls_memalign_free(
 }
 
 /* Emulated TLS objects are always allocated at run-time. */
-static inline void* emutls_allocate_object(__emutls_control* control) {
+static __inline void *emutls_allocate_object(__emutls_control *control) {
     /* Use standard C types, check with gcc's emutls.o. */
     typedef unsigned int gcc_word __attribute__((mode(word)));
     typedef unsigned int gcc_pointer __attribute__((mode(pointer)));
@@ -116,7 +116,7 @@ static void emutls_init(void) {
 }
 
 /* Returns control->object.index; set index if not allocated yet. */
-static inline uintptr_t emutls_get_index(__emutls_control* control) {
+static __inline uintptr_t emutls_get_index(__emutls_control *control) {
     uintptr_t index = __atomic_load_n(&control->object.index, __ATOMIC_ACQUIRE);
     if (!index) {
         static pthread_once_t once = PTHREAD_ONCE_INIT;
@@ -133,8 +133,8 @@ static inline uintptr_t emutls_get_index
 }
 
 /* Updates newly allocated thread local emutls_address_array. */
-static inline void emutls_check_array_set_size(emutls_address_array* array,
-                                               uintptr_t size) {
+static __inline void emutls_check_array_set_size(emutls_address_array *array,
+                                                 uintptr_t size) {
     if (array == NULL)
         abort();
     array->size = size;
@@ -144,7 +144,7 @@ static inline void emutls_check_array_se
 /* Returns the new 'data' array size, number of elements,
  * which must be no smaller than the given index.
  */
-static inline uintptr_t emutls_new_data_array_size(uintptr_t index) {
+static __inline uintptr_t emutls_new_data_array_size(uintptr_t index) {
    /* Need to allocate emutls_address_array with one extra slot
     * to store the data array size.
     * Round up the emutls_address_array size to multiple of 16.
@@ -155,7 +155,8 @@ static inline uintptr_t emutls_new_data_
 /* Returns the thread local emutls_address_array.
  * Extends its size if necessary to hold address at index.
  */
-static inline emutls_address_array* emutls_get_address_array(uintptr_t index) {
+static __inline emutls_address_array *
+emutls_get_address_array(uintptr_t index) {
     emutls_address_array* array = pthread_getspecific(emutls_pthread_key);
     if (array == NULL) {
         uintptr_t new_size = emutls_new_data_array_size(index);

Modified: compiler-rt/trunk/lib/builtins/fp_add_impl.inc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/builtins/fp_add_impl.inc?rev=249953&r1=249952&r2=249953&view=diff
==============================================================================
--- compiler-rt/trunk/lib/builtins/fp_add_impl.inc (original)
+++ compiler-rt/trunk/lib/builtins/fp_add_impl.inc Sat Oct 10 16:21:28 2015
@@ -14,7 +14,7 @@
 
 #include "fp_lib.h"
 
-static inline fp_t __addXf3__(fp_t a, fp_t b) {
+static __inline fp_t __addXf3__(fp_t a, fp_t b) {
     rep_t aRep = toRep(a);
     rep_t bRep = toRep(b);
     const rep_t aAbs = aRep & absMask;

Modified: compiler-rt/trunk/lib/builtins/fp_extend.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/builtins/fp_extend.h?rev=249953&r1=249952&r2=249953&view=diff
==============================================================================
--- compiler-rt/trunk/lib/builtins/fp_extend.h (original)
+++ compiler-rt/trunk/lib/builtins/fp_extend.h Sat Oct 10 16:21:28 2015
@@ -28,7 +28,7 @@ typedef double src_t;
 typedef uint64_t src_rep_t;
 #define SRC_REP_C UINT64_C
 static const int srcSigBits = 52;
-static inline int src_rep_t_clz(src_rep_t a) {
+static __inline int src_rep_t_clz(src_rep_t a) {
 #if defined __LP64__
     return __builtin_clzl(a);
 #else
@@ -75,12 +75,12 @@ static const int dstSigBits = 112;
 // End of specialization parameters.  Two helper routines for conversion to and
 // from the representation of floating-point data as integer values follow.
 
-static inline src_rep_t srcToRep(src_t x) {
+static __inline src_rep_t srcToRep(src_t x) {
     const union { src_t f; src_rep_t i; } rep = {.f = x};
     return rep.i;
 }
 
-static inline dst_t dstFromRep(dst_rep_t x) {
+static __inline dst_t dstFromRep(dst_rep_t x) {
     const union { dst_t f; dst_rep_t i; } rep = {.i = x};
     return rep.f;
 }

Modified: compiler-rt/trunk/lib/builtins/fp_extend_impl.inc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/builtins/fp_extend_impl.inc?rev=249953&r1=249952&r2=249953&view=diff
==============================================================================
--- compiler-rt/trunk/lib/builtins/fp_extend_impl.inc (original)
+++ compiler-rt/trunk/lib/builtins/fp_extend_impl.inc Sat Oct 10 16:21:28 2015
@@ -38,7 +38,7 @@
 
 #include "fp_extend.h"
 
-static inline dst_t __extendXfYf2__(src_t a) {
+static __inline dst_t __extendXfYf2__(src_t a) {
     // Various constants whose values follow from the type parameters.
     // Any reasonable optimizer will fold and propagate all of these.
     const int srcBits = sizeof(src_t)*CHAR_BIT;

Modified: compiler-rt/trunk/lib/builtins/fp_fixint_impl.inc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/builtins/fp_fixint_impl.inc?rev=249953&r1=249952&r2=249953&view=diff
==============================================================================
--- compiler-rt/trunk/lib/builtins/fp_fixint_impl.inc (original)
+++ compiler-rt/trunk/lib/builtins/fp_fixint_impl.inc Sat Oct 10 16:21:28 2015
@@ -14,7 +14,7 @@
 
 #include "fp_lib.h"
 
-static inline fixint_t __fixint(fp_t a) {
+static __inline fixint_t __fixint(fp_t a) {
     const fixint_t fixint_max = (fixint_t)((~(fixuint_t)0) / 2);
     const fixint_t fixint_min = -fixint_max - 1;
     // Break a into sign, exponent, significand

Modified: compiler-rt/trunk/lib/builtins/fp_fixuint_impl.inc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/builtins/fp_fixuint_impl.inc?rev=249953&r1=249952&r2=249953&view=diff
==============================================================================
--- compiler-rt/trunk/lib/builtins/fp_fixuint_impl.inc (original)
+++ compiler-rt/trunk/lib/builtins/fp_fixuint_impl.inc Sat Oct 10 16:21:28 2015
@@ -14,7 +14,7 @@
 
 #include "fp_lib.h"
 
-static inline fixuint_t __fixuint(fp_t a) {
+static __inline fixuint_t __fixuint(fp_t a) {
     // Break a into sign, exponent, significand
     const rep_t aRep = toRep(a);
     const rep_t aAbs = aRep & absMask;

Modified: compiler-rt/trunk/lib/builtins/fp_lib.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/builtins/fp_lib.h?rev=249953&r1=249952&r2=249953&view=diff
==============================================================================
--- compiler-rt/trunk/lib/builtins/fp_lib.h (original)
+++ compiler-rt/trunk/lib/builtins/fp_lib.h Sat Oct 10 16:21:28 2015
@@ -46,12 +46,12 @@ typedef float fp_t;
 #define REP_C UINT32_C
 #define significandBits 23
 
-static inline int rep_clz(rep_t a) {
+static __inline int rep_clz(rep_t a) {
     return __builtin_clz(a);
 }
 
 // 32x32 --> 64 bit multiply
-static inline void wideMultiply(rep_t a, rep_t b, rep_t *hi, rep_t *lo) {
+static __inline void wideMultiply(rep_t a, rep_t b, rep_t *hi, rep_t *lo) {
     const uint64_t product = (uint64_t)a*b;
     *hi = product >> 32;
     *lo = product;
@@ -66,7 +66,7 @@ typedef double fp_t;
 #define REP_C UINT64_C
 #define significandBits 52
 
-static inline int rep_clz(rep_t a) {
+static __inline int rep_clz(rep_t a) {
 #if defined __LP64__
     return __builtin_clzl(a);
 #else
@@ -83,7 +83,7 @@ static inline int rep_clz(rep_t a) {
 // 64x64 -> 128 wide multiply for platforms that don't have such an operation;
 // many 64-bit platforms have this operation, but they tend to have hardware
 // floating-point, so we don't bother with a special case for them here.
-static inline void wideMultiply(rep_t a, rep_t b, rep_t *hi, rep_t *lo) {
+static __inline void wideMultiply(rep_t a, rep_t b, rep_t *hi, rep_t *lo) {
     // Each of the component 32x32 -> 64 products
     const uint64_t plolo = loWord(a) * loWord(b);
     const uint64_t plohi = loWord(a) * hiWord(b);
@@ -112,7 +112,7 @@ typedef long double fp_t;
 // 128-bit integer, we let the constant be casted to 128-bit integer
 #define significandBits 112
 
-static inline int rep_clz(rep_t a) {
+static __inline int rep_clz(rep_t a) {
     const union
         {
              __uint128_t ll;
@@ -148,7 +148,7 @@ static inline int rep_clz(rep_t a) {
 // 128x128 -> 256 wide multiply for platforms that don't have such an operation;
 // many 64-bit platforms have this operation, but they tend to have hardware
 // floating-point, so we don't bother with a special case for them here.
-static inline void wideMultiply(rep_t a, rep_t b, rep_t *hi, rep_t *lo) {
+static __inline void wideMultiply(rep_t a, rep_t b, rep_t *hi, rep_t *lo) {
 
     const uint64_t product11 = Word_1(a) * Word_1(b);
     const uint64_t product12 = Word_1(a) * Word_2(b);
@@ -228,28 +228,28 @@ static inline void wideMultiply(rep_t a,
 #define quietBit        (implicitBit >> 1)
 #define qnanRep         (exponentMask | quietBit)
 
-static inline rep_t toRep(fp_t x) {
+static __inline rep_t toRep(fp_t x) {
     const union { fp_t f; rep_t i; } rep = {.f = x};
     return rep.i;
 }
 
-static inline fp_t fromRep(rep_t x) {
+static __inline fp_t fromRep(rep_t x) {
     const union { fp_t f; rep_t i; } rep = {.i = x};
     return rep.f;
 }
 
-static inline int normalize(rep_t *significand) {
+static __inline int normalize(rep_t *significand) {
     const int shift = rep_clz(*significand) - rep_clz(implicitBit);
     *significand <<= shift;
     return 1 - shift;
 }
 
-static inline void wideLeftShift(rep_t *hi, rep_t *lo, int count) {
+static __inline void wideLeftShift(rep_t *hi, rep_t *lo, int count) {
     *hi = *hi << count | *lo >> (typeWidth - count);
     *lo = *lo << count;
 }
 
-static inline void wideRightShiftWithSticky(rep_t *hi, rep_t *lo, unsigned int count) {
+static __inline void wideRightShiftWithSticky(rep_t *hi, rep_t *lo, unsigned int count) {
     if (count < typeWidth) {
         const bool sticky = *lo << (typeWidth - count);
         *lo = *hi << (typeWidth - count) | *lo >> count | sticky;

Modified: compiler-rt/trunk/lib/builtins/fp_mul_impl.inc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/builtins/fp_mul_impl.inc?rev=249953&r1=249952&r2=249953&view=diff
==============================================================================
--- compiler-rt/trunk/lib/builtins/fp_mul_impl.inc (original)
+++ compiler-rt/trunk/lib/builtins/fp_mul_impl.inc Sat Oct 10 16:21:28 2015
@@ -14,7 +14,7 @@
 
 #include "fp_lib.h"
 
-static inline fp_t __mulXf3__(fp_t a, fp_t b) {
+static __inline fp_t __mulXf3__(fp_t a, fp_t b) {
     const unsigned int aExponent = toRep(a) >> significandBits & maxExponent;
     const unsigned int bExponent = toRep(b) >> significandBits & maxExponent;
     const rep_t productSign = (toRep(a) ^ toRep(b)) & signBit;

Modified: compiler-rt/trunk/lib/builtins/fp_trunc.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/builtins/fp_trunc.h?rev=249953&r1=249952&r2=249953&view=diff
==============================================================================
--- compiler-rt/trunk/lib/builtins/fp_trunc.h (original)
+++ compiler-rt/trunk/lib/builtins/fp_trunc.h Sat Oct 10 16:21:28 2015
@@ -63,12 +63,12 @@ static const int dstSigBits = 10;
 // End of specialization parameters.  Two helper routines for conversion to and
 // from the representation of floating-point data as integer values follow.
 
-static inline src_rep_t srcToRep(src_t x) {
+static __inline src_rep_t srcToRep(src_t x) {
     const union { src_t f; src_rep_t i; } rep = {.f = x};
     return rep.i;
 }
 
-static inline dst_t dstFromRep(dst_rep_t x) {
+static __inline dst_t dstFromRep(dst_rep_t x) {
     const union { dst_t f; dst_rep_t i; } rep = {.i = x};
     return rep.f;
 }

Modified: compiler-rt/trunk/lib/builtins/fp_trunc_impl.inc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/builtins/fp_trunc_impl.inc?rev=249953&r1=249952&r2=249953&view=diff
==============================================================================
--- compiler-rt/trunk/lib/builtins/fp_trunc_impl.inc (original)
+++ compiler-rt/trunk/lib/builtins/fp_trunc_impl.inc Sat Oct 10 16:21:28 2015
@@ -39,7 +39,7 @@
 
 #include "fp_trunc.h"
 
-static inline dst_t __truncXfYf2__(src_t a) {
+static __inline dst_t __truncXfYf2__(src_t a) {
     // Various constants whose values follow from the type parameters.
     // Any reasonable optimizer will fold and propagate all of these.
     const int srcBits = sizeof(src_t)*CHAR_BIT;

Modified: compiler-rt/trunk/lib/builtins/int_types.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/builtins/int_types.h?rev=249953&r1=249952&r2=249953&view=diff
==============================================================================
--- compiler-rt/trunk/lib/builtins/int_types.h (original)
+++ compiler-rt/trunk/lib/builtins/int_types.h Sat Oct 10 16:21:28 2015
@@ -95,14 +95,14 @@ typedef union
     }s;
 } utwords;
 
-static inline ti_int make_ti(di_int h, di_int l) {
+static __inline ti_int make_ti(di_int h, di_int l) {
     twords r;
     r.s.high = h;
     r.s.low = l;
     return r.all;
 }
 
-static inline tu_int make_tu(du_int h, du_int l) {
+static __inline tu_int make_tu(du_int h, du_int l) {
     utwords r;
     r.s.high = h;
     r.s.low = l;

Modified: compiler-rt/trunk/lib/builtins/ppc/DD.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/builtins/ppc/DD.h?rev=249953&r1=249952&r2=249953&view=diff
==============================================================================
--- compiler-rt/trunk/lib/builtins/ppc/DD.h (original)
+++ compiler-rt/trunk/lib/builtins/ppc/DD.h Sat Oct 10 16:21:28 2015
@@ -19,28 +19,23 @@ typedef union {
 #define LOWORDER(xy,xHi,xLo,yHi,yLo) \
 	(((((xHi)*(yHi) - (xy)) + (xHi)*(yLo)) + (xLo)*(yHi)) + (xLo)*(yLo))
 
-static inline double __attribute__((always_inline))
-local_fabs(double x)
-{
-	doublebits result = { .d = x };
-	result.x &= UINT64_C(0x7fffffffffffffff);
-	return result.d;
+static __inline double __attribute__((always_inline)) local_fabs(double x) {
+  doublebits result = {.d = x};
+  result.x &= UINT64_C(0x7fffffffffffffff);
+  return result.d;
 }
 
-static inline double __attribute__((always_inline))
-high26bits(double x)
-{
-	doublebits result = { .d = x };
-	result.x &= UINT64_C(0xfffffffff8000000);
-	return result.d;
+static __inline double __attribute__((always_inline)) high26bits(double x) {
+  doublebits result = {.d = x};
+  result.x &= UINT64_C(0xfffffffff8000000);
+  return result.d;
 }
 
-static inline int __attribute__((always_inline))
-different_sign(double x, double y)
-{
-	doublebits xsignbit = { .d = x }, ysignbit = { .d = y };
-	int result = (int)(xsignbit.x >> 63) ^ (int)(ysignbit.x >> 63);
-	return result;
+static __inline int __attribute__((always_inline))
+different_sign(double x, double y) {
+  doublebits xsignbit = {.d = x}, ysignbit = {.d = y};
+  int result = (int)(xsignbit.x >> 63) ^ (int)(ysignbit.x >> 63);
+  return result;
 }
 
 #endif /* __DD_HEADER */




More information about the llvm-commits mailing list