Isolate machine-dependent use of <alloca.h> in "Support/Alloca.h",
authorBrian Gaeke <gaeke@uiuc.edu>
Mon, 16 Jun 2003 21:54:01 +0000 (21:54 +0000)
committerBrian Gaeke <gaeke@uiuc.edu>
Mon, 16 Jun 2003 21:54:01 +0000 (21:54 +0000)
so that we can easily change its use to be conditional on the result of
an autoconf test later.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6723 91177308-0d34-0410-b5e6-96231b3b80d8

include/Support/Alloca.h [new file with mode: 0644]
lib/CodeGen/InstrSelection/InstrForest.cpp
lib/Support/SystemUtils.cpp
lib/Target/SparcV9/InstrSelection/InstrForest.cpp
lib/Target/X86/X86CodeEmitter.cpp
support/lib/Support/SystemUtils.cpp
tools/bugpoint/SystemUtils.cpp

diff --git a/include/Support/Alloca.h b/include/Support/Alloca.h
new file mode 100644 (file)
index 0000000..3c163ed
--- /dev/null
@@ -0,0 +1,30 @@
+//===-- include/Support/Alloca.h - Support for alloca header -----*- C++ -*--=//
+//
+// Some platforms do not have alloca.h; others do. You can include this
+// file instead of <alloca.h> and it will include <alloca.h> on the platforms
+// that require you to do so to use alloca().
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_SUPPORT_ALLOCA_H
+#define LLVM_SUPPORT_ALLOCA_H
+
+// TODO: Determine HAVE_ALLOCA_H based on autoconf results.
+// The following method is too brittle.
+#if defined(HAVE_ALLOCA_H)
+#undef HAVE_ALLOCA_H
+#endif
+
+#if defined(__linux__)
+#define HAVE_ALLOCA_H 1
+#elif defined(__sparc__)
+#define HAVE_ALLOCA_H 1
+#elif defined(__FreeBSD__)
+// not defined here
+#endif
+
+#if HAVE_ALLOCA_H
+#include <alloca.h>
+#endif
+
+#endif  /* LLVM_SUPPORT_ALLOCA_H */
index c33faec9a04a6774f09bb2977f14aff52748a544..5afa1daccd88b8a5f8bc2e98b265a0cc837d877a 100644 (file)
@@ -21,7 +21,7 @@
 #include "llvm/Type.h"
 #include "llvm/CodeGen/MachineInstr.h"
 #include "Support/STLExtras.h"
-#include <alloca.h>
+#include "Support/Alloca.h"
 using std::cerr;
 using std::vector;
 
index 034c141f794f732db4e248620a12cabd38a28942..c88a516e9f38ce3053ffb49799122e188cf2d086 100644 (file)
@@ -10,7 +10,7 @@
 #include <fstream>
 #include <iostream>
 #include <cstdlib>
-#include <alloca.h>
+#include "Support/Alloca.h"
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>
index c33faec9a04a6774f09bb2977f14aff52748a544..5afa1daccd88b8a5f8bc2e98b265a0cc837d877a 100644 (file)
@@ -21,7 +21,7 @@
 #include "llvm/Type.h"
 #include "llvm/CodeGen/MachineInstr.h"
 #include "Support/STLExtras.h"
-#include <alloca.h>
+#include "Support/Alloca.h"
 using std::cerr;
 using std::vector;
 
index 45d0b8c547eff5eeac7b28d99817d45daff90a28..bfb4aaa951403024e7d62e790cee19fddd47b221 100644 (file)
@@ -13,7 +13,7 @@
 #include "llvm/CodeGen/MachineInstr.h"
 #include "llvm/Value.h"
 #include "Support/Statistic.h"
-#include <alloca.h>
+#include "Support/Alloca.h"
 
 namespace {
   Statistic<>
index 034c141f794f732db4e248620a12cabd38a28942..c88a516e9f38ce3053ffb49799122e188cf2d086 100644 (file)
@@ -10,7 +10,7 @@
 #include <fstream>
 #include <iostream>
 #include <cstdlib>
-#include <alloca.h>
+#include "Support/Alloca.h"
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>
index 034c141f794f732db4e248620a12cabd38a28942..c88a516e9f38ce3053ffb49799122e188cf2d086 100644 (file)
@@ -10,7 +10,7 @@
 #include <fstream>
 #include <iostream>
 #include <cstdlib>
-#include <alloca.h>
+#include "Support/Alloca.h"
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>