From ad95d9ef50cbd789025dbff8a1e018650cbcdc7f Mon Sep 17 00:00:00 2001 From: Brian Gaeke Date: Mon, 16 Jun 2003 21:54:01 +0000 Subject: Isolate machine-dependent use of in "Support/Alloca.h", 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 | 30 +++++++++++++++++++++++ lib/CodeGen/InstrSelection/InstrForest.cpp | 2 +- lib/Support/SystemUtils.cpp | 2 +- lib/Target/SparcV9/InstrSelection/InstrForest.cpp | 2 +- lib/Target/X86/X86CodeEmitter.cpp | 2 +- support/lib/Support/SystemUtils.cpp | 2 +- tools/bugpoint/SystemUtils.cpp | 2 +- 7 files changed, 36 insertions(+), 6 deletions(-) create mode 100644 include/Support/Alloca.h diff --git a/include/Support/Alloca.h b/include/Support/Alloca.h new file mode 100644 index 0000000000..3c163ed0d6 --- /dev/null +++ b/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 and it will include 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 +#endif + +#endif /* LLVM_SUPPORT_ALLOCA_H */ diff --git a/lib/CodeGen/InstrSelection/InstrForest.cpp b/lib/CodeGen/InstrSelection/InstrForest.cpp index c33faec9a0..5afa1daccd 100644 --- a/lib/CodeGen/InstrSelection/InstrForest.cpp +++ b/lib/CodeGen/InstrSelection/InstrForest.cpp @@ -21,7 +21,7 @@ #include "llvm/Type.h" #include "llvm/CodeGen/MachineInstr.h" #include "Support/STLExtras.h" -#include +#include "Support/Alloca.h" using std::cerr; using std::vector; diff --git a/lib/Support/SystemUtils.cpp b/lib/Support/SystemUtils.cpp index 034c141f79..c88a516e9f 100644 --- a/lib/Support/SystemUtils.cpp +++ b/lib/Support/SystemUtils.cpp @@ -10,7 +10,7 @@ #include #include #include -#include +#include "Support/Alloca.h" #include #include #include diff --git a/lib/Target/SparcV9/InstrSelection/InstrForest.cpp b/lib/Target/SparcV9/InstrSelection/InstrForest.cpp index c33faec9a0..5afa1daccd 100644 --- a/lib/Target/SparcV9/InstrSelection/InstrForest.cpp +++ b/lib/Target/SparcV9/InstrSelection/InstrForest.cpp @@ -21,7 +21,7 @@ #include "llvm/Type.h" #include "llvm/CodeGen/MachineInstr.h" #include "Support/STLExtras.h" -#include +#include "Support/Alloca.h" using std::cerr; using std::vector; diff --git a/lib/Target/X86/X86CodeEmitter.cpp b/lib/Target/X86/X86CodeEmitter.cpp index 45d0b8c547..bfb4aaa951 100644 --- a/lib/Target/X86/X86CodeEmitter.cpp +++ b/lib/Target/X86/X86CodeEmitter.cpp @@ -13,7 +13,7 @@ #include "llvm/CodeGen/MachineInstr.h" #include "llvm/Value.h" #include "Support/Statistic.h" -#include +#include "Support/Alloca.h" namespace { Statistic<> diff --git a/support/lib/Support/SystemUtils.cpp b/support/lib/Support/SystemUtils.cpp index 034c141f79..c88a516e9f 100644 --- a/support/lib/Support/SystemUtils.cpp +++ b/support/lib/Support/SystemUtils.cpp @@ -10,7 +10,7 @@ #include #include #include -#include +#include "Support/Alloca.h" #include #include #include diff --git a/tools/bugpoint/SystemUtils.cpp b/tools/bugpoint/SystemUtils.cpp index 034c141f79..c88a516e9f 100644 --- a/tools/bugpoint/SystemUtils.cpp +++ b/tools/bugpoint/SystemUtils.cpp @@ -10,7 +10,7 @@ #include #include #include -#include +#include "Support/Alloca.h" #include #include #include -- cgit v1.2.3-18-g5258