#include <stddef.h>
#include <obstack.h>
-#ifdef HAVE_ALLOCA_H
-#include <alloca.h>
-#endif
-#ifdef HAVE_MALLOC_H
-#include <malloc.h>
-#endif
-
#include "fourcc.h"
#include "align.h"
+#include "xmalloc.h"
#define ARR_D_MAGIC FOURCC('A','R','R','D')
#define ARR_A_MAGIC FOURCC('A','R','R','A')
#include <assert.h>
#include <string.h>
-#ifdef _WIN32
-#include <malloc.h>
-#else
-#include <alloca.h>
-#endif
-
#include "xmalloc.h"
#include "bitfiddle.h"
# include "config.h"
#endif
-#ifdef HAVE_ALLOCA_H
-# include <alloca.h>
-#endif
-#ifdef HAVE_MALLOC_H
-# include <malloc.h>
-#endif
#ifdef HAVE_STRING_H
# include <string.h>
#endif
#define xfree(ptr) free(ptr)
+
+/* Includes for alloca() */
+#if defined(__FreeBSD__)
+#include <stdlib.h>
+#elif defined(_WIN32)
+#include <malloc.h>
+#else
+#include <alloca.h>
+#endif
+
#endif /* _XMALLOC_H_ */
#include "config.h"
#endif
-#ifdef HAVE_MALLOC_H
-# include <malloc.h>
-#endif
-#ifdef HAVE_ALLOCA_H
-# include <alloca.h>
-#endif
#ifdef HAVE_STDLIB_H
# include <stdlib.h>
#endif
#include "array.h"
#include "irprog.h"
#include "entity_t.h"
+#include "xmalloc.h"
#include "analyze_irg_args.h"
#include "config.h"
#endif
-#ifdef HAVE_MALLOC_H
-#include <malloc.h>
-#endif
-#ifdef HAVE_ALLOCA_H
-#include <alloca.h>
-#endif
#ifdef HAVE_STRING_H
#include <string.h>
#endif
# include "config.h"
#endif
-/* get prototype for alloca somehow */
-#ifdef HAVE_ALLOCA_H
-# include <alloca.h>
-#endif
#ifdef HAVE_STDLIB_H
# include <stdlib.h>
#endif
#include <stddef.h>
#include <stdlib.h>
-#ifdef HAVE_ALLOCA_H
-#include <alloca.h>
-#endif
-#ifdef HAVE_MALLOC_H
-#include <malloc.h>
-#endif
-
#ifdef FIRM_ENABLE_WCHAR
#include <wchar.h>
#endif
#include "ident_t.h"
#include "set.h"
+#include "xmalloc.h"
/* for debugging only, not the real implementation */
struct _ident {
# include "config.h"
#endif
-#ifdef HAVE_ALLOCA_H
-# include <alloca.h>
-#endif
-#ifdef HAVE_MALLOC_H
-# include <malloc.h>
-#endif
-#ifdef HAVE_STRING_H
-# include <string.h>
-#endif
-
#include "irprog_t.h"
#include "irgraph_t.h"
#include "irnode_t.h"
#include "irflag_t.h"
#include "iredges_t.h"
#include "irflag_t.h"
+#include "xmalloc.h"
#if USE_EXPLICIT_PHI_IN_STACK
/* A stack needed for the automatic Phi node construction in constructor
#include "config.h"
#endif
-#ifdef HAVE_ALLOCA_H
-#include <alloca.h>
-#endif
-#ifdef HAVE_MALLOC_H
-#include <malloc.h>
-#endif
-
#include "irnode_t.h"
#include "iropt_t.h"
#include "iredgekinds.h"
#include "debug.h"
#include "set.h"
#include "bitset.h"
+#include "xmalloc.h"
/**
* A function that allows for setting an edge.
# include "config.h"
#endif
-#ifdef HAVE_ALLOCA_H
-#include <alloca.h>
-#endif
-#ifdef HAVE_MALLOC_H
-#include <malloc.h>
-#endif
#ifdef HAVE_STRING_H
#include <string.h>
#endif
#include "opt_polymorphy.h"
#include "opt_confirms.h"
#include "irtools.h"
+#include "xmalloc.h"
/* Make types visible to allow most efficient access */
#include "entity_t.h"
#include "config.h"
#endif
-#ifdef HAVE_ALLOCA_H
-#include <alloca.h>
-#endif
-#ifdef HAVE_MALLOC_H
-#include <malloc.h>
-#endif
-
#include "irprog_t.h"
#include "irnode_t.h"
#include "type_t.h"
#include "irtools.h"
#include "array.h"
#include "pmap.h"
+#include "xmalloc.h"
/** A type map for def_find_pointer_type. */
static pmap *type_map;
# include "config.h"
#endif
-#ifdef HAVE_MALLOC_H
-# include <malloc.h>
-#endif
-#ifdef HAVE_ALLOCA_H
-# include <alloca.h>
-#endif
#ifdef HAVE_STRING_H
# include <string.h>
#endif
#include "pmap.h"
#include "pdeq.h"
#include "irdump.h"
+#include "xmalloc.h"
/** A map from mode to a primitive type. */
static pmap *prim_types;
#include "config.h"
#endif
-#ifdef HAVE_ALLOCA_H
-#include <alloca.h>
-#endif
-#ifdef HAVE_MALLOC_H
-#include <malloc.h>
-#endif
-
#include "irop_t.h"
#include "irprog_t.h"
#include "irnode_t.h"
#include "trouts.h"
#include "lower_intrinsics.h"
#include "pmap.h"
+#include "xmalloc.h"
/** Walker environment */
typedef struct _walker_env {
# include "config.h"
#endif
-#ifdef HAVE_MALLOC_H
-# include <malloc.h>
-#endif
-#ifdef HAVE_ALLOCA_H
-# include <alloca.h>
-#endif
-
#include <assert.h>
#include "plist.h"
#include "config.h"
#endif
-#ifdef HAVE_ALLOCA_H
-#include <alloca.h>
-#endif
-
-#ifdef HAVE_MALLOC_H
-#include <malloc.h>
-#endif
-
#ifdef HAVE_STRING_H
#include <string.h>
#endif
#include "irprintf.h"
#include "compute_loop_info.h"
#include "irgopt.h"
+#include "xmalloc.h"
#define SET_ENT_VNUM(ent, vnum) set_entity_link(ent, INT_TO_PTR(vnum))
#define GET_ENT_VNUM(ent) (unsigned)PTR_TO_INT(get_entity_link(ent))
# include "config.h"
#endif
-#ifdef HAVE_MALLOC_H
-# include <malloc.h>
-#endif
-#ifdef HAVE_ALLOCA_H
-# include <alloca.h>
-#endif
-
#include <assert.h>
#include "irgraph_t.h"
#include "irgmod.h"
#include "debug.h"
#include "gvn_pre.h"
+#include "xmalloc.h"
/** The debug module handle. */
DEBUG_ONLY(static firm_dbg_module_t *dbg;)
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
-#ifdef HAVE_MALLOC_H
-#include <malloc.h>
-#endif
-#ifdef HAVE_ALLOCA_H
-#include <alloca.h>
-#endif
#include <assert.h>
#include "irtools.h"
#include "return.h"
#include "array.h"
+#include "xmalloc.h"
// debug
#include "irdump.h"
# include "config.h"
#endif
-#ifdef HAVE_ALLOCA_H
-#include <alloca.h>
-#endif
-#ifdef HAVE_MALLOC_H
-#include <malloc.h>
-#endif
#ifdef HAVE_STRING_H
# include <string.h>
#endif
#include "irtools.h"
#include "opt_polymorphy.h"
#include "irmemory.h"
+#include "xmalloc.h"
#ifdef DO_CACHEOPT
#include "cacheopt/cachesim.h"
#ifdef HAVE_STRING_H
#include <string.h>
#endif
-#ifdef HAVE_MALLOC_H
-#include <malloc.h>
-#endif
-#ifdef HAVE_ALLOCA_H
-#include <alloca.h>
-#endif
#include "loop_unrolling.h"
#include "compute_loop_info.h"
#include "irdump.h"
#include "irtools.h"
+#include "xmalloc.h"
/* We will unroll maximal 4-times. */
#define MAX_UNROLL 4
#include "config.h"
#endif
-#ifdef HAVE_MALLOC_H
-#include <malloc.h>
-#endif
-#ifdef HAVE_ALLOCA_H
-#include <alloca.h>
-#endif
-
#include "opt_osr.h"
#include "irgraph.h"
#include "ircons.h"
#include "irloop_t.h"
#include "array.h"
#include "firmstat.h"
+#include "xmalloc.h"
/** The debug handle. */
DEBUG_ONLY(static firm_dbg_module_t *dbg;)
#include "config.h"
#endif
-#ifdef HAVE_MALLOC_H
-#include <malloc.h>
-#endif
-#ifdef HAVE_ALLOCA_H
-#include <alloca.h>
-#endif
#ifdef HAVE_STRING_H
#include <string.h>
#endif
#include "irtools.h"
#include "irgmod.h"
#include "array.h"
+#include "xmalloc.h"
/* A macro to iterate sets.*/
#define ITERATE_SET(set_entries, entry) for(entry = set_first(set_entries); entry; entry = set_next(set_entries))
#include "config.h"
#endif
-#ifdef HAVE_ALLOCA_H
-# include <alloca.h>
-#endif
-#ifdef HAVE_MALLOC_H
-# include <malloc.h>
-#endif
-
#include "irgraph_t.h"
#include "ircons_t.h"
#include "irnode_t.h"
#include "irgmod.h"
+#include "xmalloc.h"
#define set_bit(n) (returns[(n) >> 3] |= 1 << ((n) & 7))
#define get_bit(n) (returns[(n) >> 3] & (1 << ((n) & 7)))
#include "config.h"
#endif
-#ifdef HAVE_ALLOCA_H
-#include <alloca.h>
-#endif
-
-#ifdef HAVE_MALLOC_H
-#include <malloc.h>
-#endif
-
#ifdef HAVE_STRING_H
#include <string.h>
#endif
#include "irgmod.h"
#include "irnode_t.h"
#include "irtools.h"
+#include "xmalloc.h"
#define SET_VNUM(node, vnum) set_irn_link(node, INT_TO_PTR(vnum))
#define GET_VNUM(node) (unsigned)PTR_TO_INT(get_irn_link(node))
# include "config.h"
#endif
-#ifdef HAVE_ALLOCA_H
-#include <alloca.h>
-#endif
-#ifdef HAVE_MALLOC_H
-#include <malloc.h>
-#endif
#ifdef HAVE_STRING_H
#include <string.h>
#endif
#include "scalar_replace.h"
#include "irouts.h"
#include "irhooks.h"
+#include "xmalloc.h"
/**
* the environment for collecting data
#include <assert.h>
-#ifdef HAVE_ALLOCA_H
-#include <alloca.h>
-#endif
-#ifdef HAVE_MALLOC_H
-#include <malloc.h>
-#endif
-
#include "tropt.h"
#include "irprog.h"
#include "ircons.h"
#include "irgmod.h"
#include "irflag_t.h"
+#include "xmalloc.h"
/* - statistics ---------------------------------------------- */
#ifdef HAVE_STDLIB_H
# include <stdlib.h>
#endif
-#ifdef HAVE_ALLOCA_H
-# include <alloca.h>
-#endif
-#ifdef HAVE_MALLOC_H
-# include <malloc.h>
-#endif
#include <stdio.h>
#include <assert.h>
#ifdef HAVE_STDLIB_H
# include <stdlib.h>
#endif
-#ifdef HAVE_ALLOCA_H
-# include <alloca.h>
-#endif
-#ifdef HAVE_MALLOC_H
-# include <malloc.h>
-#endif
#ifdef HAVE_STRING_H
# include <string.h> /* memset/memcmp */
#endif
#ifdef HAVE_STDLIB_H
# include <stdlib.h>
#endif
-#ifdef HAVE_ALLOCA_H
-# include <alloca.h>
-#endif
-#ifdef HAVE_MALLOC_H
-# include <malloc.h>
-#endif
#include "tv_t.h"
#include "set.h" /* to store tarvals in */