diff options
| author | Brian Gaeke <gaeke@uiuc.edu> | 2003-06-16 21:54:01 +0000 |
|---|---|---|
| committer | Brian Gaeke <gaeke@uiuc.edu> | 2003-06-16 21:54:01 +0000 |
| commit | 7a719ed20c27a658be627166e11be0511509f7da (patch) | |
| tree | e8a2e527436a3d81c2dbdc900515c7e922f2d41f /llvm | |
| parent | 3350651851d9a817b5d3332edd2363ab41523bc4 (diff) | |
| download | bcm5719-llvm-7a719ed20c27a658be627166e11be0511509f7da.tar.gz bcm5719-llvm-7a719ed20c27a658be627166e11be0511509f7da.zip | |
Isolate machine-dependent use of <alloca.h> in "Support/Alloca.h",
so that we can easily change its use to be conditional on the result of
an autoconf test later.
llvm-svn: 6723
Diffstat (limited to 'llvm')
| -rw-r--r-- | llvm/include/Support/Alloca.h | 30 | ||||
| -rw-r--r-- | llvm/lib/CodeGen/InstrSelection/InstrForest.cpp | 2 | ||||
| -rw-r--r-- | llvm/lib/Support/SystemUtils.cpp | 2 | ||||
| -rw-r--r-- | llvm/lib/Target/X86/X86CodeEmitter.cpp | 2 | ||||
| -rw-r--r-- | llvm/support/lib/Support/SystemUtils.cpp | 2 | ||||
| -rw-r--r-- | llvm/tools/bugpoint/SystemUtils.cpp | 2 |
6 files changed, 35 insertions, 5 deletions
diff --git a/llvm/include/Support/Alloca.h b/llvm/include/Support/Alloca.h new file mode 100644 index 00000000000..3c163ed0d66 --- /dev/null +++ b/llvm/include/Support/Alloca.h @@ -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 */ diff --git a/llvm/lib/CodeGen/InstrSelection/InstrForest.cpp b/llvm/lib/CodeGen/InstrSelection/InstrForest.cpp index c33faec9a04..5afa1daccd8 100644 --- a/llvm/lib/CodeGen/InstrSelection/InstrForest.cpp +++ b/llvm/lib/CodeGen/InstrSelection/InstrForest.cpp @@ -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; diff --git a/llvm/lib/Support/SystemUtils.cpp b/llvm/lib/Support/SystemUtils.cpp index 034c141f794..c88a516e9f3 100644 --- a/llvm/lib/Support/SystemUtils.cpp +++ b/llvm/lib/Support/SystemUtils.cpp @@ -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> diff --git a/llvm/lib/Target/X86/X86CodeEmitter.cpp b/llvm/lib/Target/X86/X86CodeEmitter.cpp index 45d0b8c547e..bfb4aaa9514 100644 --- a/llvm/lib/Target/X86/X86CodeEmitter.cpp +++ b/llvm/lib/Target/X86/X86CodeEmitter.cpp @@ -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<> diff --git a/llvm/support/lib/Support/SystemUtils.cpp b/llvm/support/lib/Support/SystemUtils.cpp index 034c141f794..c88a516e9f3 100644 --- a/llvm/support/lib/Support/SystemUtils.cpp +++ b/llvm/support/lib/Support/SystemUtils.cpp @@ -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> diff --git a/llvm/tools/bugpoint/SystemUtils.cpp b/llvm/tools/bugpoint/SystemUtils.cpp index 034c141f794..c88a516e9f3 100644 --- a/llvm/tools/bugpoint/SystemUtils.cpp +++ b/llvm/tools/bugpoint/SystemUtils.cpp @@ -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> |

