From ce63005ac164a30ee4fd585dc88a7d679b7e15c5 Mon Sep 17 00:00:00 2001 From: Brian Gaeke Date: Fri, 10 Dec 2004 05:44:45 +0000 Subject: [PATCH] Emit correct prototype for __builtin_alloca on V8. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18745 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/CBackend/CBackend.cpp | 9 ++++++++- lib/Target/CBackend/Writer.cpp | 9 ++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/lib/Target/CBackend/CBackend.cpp b/lib/Target/CBackend/CBackend.cpp index 40800b9d434..dc8ce2e4742 100644 --- a/lib/Target/CBackend/CBackend.cpp +++ b/lib/Target/CBackend/CBackend.cpp @@ -715,9 +715,16 @@ void CWriter::writeOperand(Value *Operand) { static void generateCompilerSpecificCode(std::ostream& Out) { // Alloca is hard to get, and we don't want to include stdlib.h here... Out << "/* get a declaration for alloca */\n" - << "#if defined(sun) || defined(__CYGWIN__) || defined(__APPLE__)\n" + << "#if defined(__CYGWIN__) || defined(__APPLE__)\n" << "extern void *__builtin_alloca(unsigned long);\n" << "#define alloca(x) __builtin_alloca(x)\n" + << "#elif defined(__sun__)\n" + << "#if defined(__sparcv9)\n" + << "extern void *__builtin_alloca(unsigned long);\n" + << "#else\n" + << "extern void *__builtin_alloca(unsigned int);\n" + << "#endif\n" + << "#define alloca(x) __builtin_alloca(x)\n" << "#elif defined(__FreeBSD__)\n" << "#define alloca(x) __builtin_alloca(x)\n" << "#else\n" diff --git a/lib/Target/CBackend/Writer.cpp b/lib/Target/CBackend/Writer.cpp index 40800b9d434..dc8ce2e4742 100644 --- a/lib/Target/CBackend/Writer.cpp +++ b/lib/Target/CBackend/Writer.cpp @@ -715,9 +715,16 @@ void CWriter::writeOperand(Value *Operand) { static void generateCompilerSpecificCode(std::ostream& Out) { // Alloca is hard to get, and we don't want to include stdlib.h here... Out << "/* get a declaration for alloca */\n" - << "#if defined(sun) || defined(__CYGWIN__) || defined(__APPLE__)\n" + << "#if defined(__CYGWIN__) || defined(__APPLE__)\n" << "extern void *__builtin_alloca(unsigned long);\n" << "#define alloca(x) __builtin_alloca(x)\n" + << "#elif defined(__sun__)\n" + << "#if defined(__sparcv9)\n" + << "extern void *__builtin_alloca(unsigned long);\n" + << "#else\n" + << "extern void *__builtin_alloca(unsigned int);\n" + << "#endif\n" + << "#define alloca(x) __builtin_alloca(x)\n" << "#elif defined(__FreeBSD__)\n" << "#define alloca(x) __builtin_alloca(x)\n" << "#else\n"