[compiler-rt] r269592 - Use __builtin_alloca with __GNUC__

Xinliang David Li via llvm-commits llvm-commits at lists.llvm.org
Sun May 15 09:41:58 PDT 2016


Author: davidxl
Date: Sun May 15 11:41:58 2016
New Revision: 269592

URL: http://llvm.org/viewvc/llvm-project?rev=269592&view=rev
Log:
Use __builtin_alloca with __GNUC__

Modified:
    compiler-rt/trunk/lib/profile/InstrProfilingPort.h
    compiler-rt/trunk/lib/profile/InstrProfilingWriter.c

Modified: compiler-rt/trunk/lib/profile/InstrProfilingPort.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/profile/InstrProfilingPort.h?rev=269592&r1=269591&r2=269592&view=diff
==============================================================================
--- compiler-rt/trunk/lib/profile/InstrProfilingPort.h (original)
+++ compiler-rt/trunk/lib/profile/InstrProfilingPort.h Sun May 15 11:41:58 2016
@@ -14,10 +14,12 @@
 #define COMPILER_RT_ALIGNAS(x) __declspec(align(x))
 #define COMPILER_RT_VISIBILITY
 #define COMPILER_RT_WEAK __declspec(selectany)
+#define COMPILER_RT_ALLOCA _alloca
 #elif __GNUC__
 #define COMPILER_RT_ALIGNAS(x) __attribute__((aligned(x)))
 #define COMPILER_RT_VISIBILITY __attribute__((visibility("hidden")))
 #define COMPILER_RT_WEAK __attribute__((weak))
+#define COMPILER_RT_ALLOCA __builtin_alloca
 #endif
 
 #define COMPILER_RT_SECTION(Sect) __attribute__((section(Sect)))
@@ -25,14 +27,11 @@
 #define COMPILER_RT_MAX_HOSTLEN 128
 #ifdef _MSC_VER
 #define COMPILER_RT_GETHOSTNAME(Name, Len) gethostname(Name, Len)
-#define COMPILER_RT_ALLOCA _alloca
 #elif defined(__PS4__)
 #define COMPILER_RT_GETHOSTNAME(Name, Len) (-1)
-#define COMPILER_RT_ALLOCA alloca
 #else
 #define COMPILER_RT_GETHOSTNAME(Name, Len) lprofGetHostName(Name, Len)
 #define COMPILER_RT_HAS_UNAME 1
-#define COMPILER_RT_ALLOCA alloca
 #endif
 
 #if COMPILER_RT_HAS_ATOMICS == 1

Modified: compiler-rt/trunk/lib/profile/InstrProfilingWriter.c
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/profile/InstrProfilingWriter.c?rev=269592&r1=269591&r2=269592&view=diff
==============================================================================
--- compiler-rt/trunk/lib/profile/InstrProfilingWriter.c (original)
+++ compiler-rt/trunk/lib/profile/InstrProfilingWriter.c Sun May 15 11:41:58 2016
@@ -10,11 +10,8 @@
 #include "InstrProfiling.h"
 #include "InstrProfilingInternal.h"
 #ifdef _MSC_VER
+/* For _alloca */
 #include <malloc.h>
-#elif defined(__FreeBSD__)
-#include <stdlib.h>
-#else
-#include <alloca.h>
 #endif
 #include <string.h>
 




More information about the llvm-commits mailing list