Commit 06cb80c5 authored by Matthias Braun's avatar Matthias Braun

Reorganize include directives

parent d29ca3a0
......@@ -122,17 +122,7 @@ Summary:
/** @cond PRIVATE */
/* We need the type of a pointer subtraction. If __PTRDIFF_TYPE__ is
defined, as with GNU C, use that; that way we don't pollute the
namespace with <stddef.h>'s symbols. Otherwise, include <stddef.h>
and use ptrdiff_t. */
#ifdef __PTRDIFF_TYPE__
# define PTR_INT_TYPE __PTRDIFF_TYPE__
#else
# include <stddef.h>
# define PTR_INT_TYPE ptrdiff_t
#endif
#include <stddef.h>
/* If B is the base of an object addressed by P, return the result of
aligning P to the next multiple of A + 1. B and P must be of type
......@@ -142,13 +132,13 @@ Summary:
/* Similiar to _BPTR_ALIGN (B, P, A), except optimize the common case
where pointers can be converted to integers, aligned as integers,
and converted back again. If PTR_INT_TYPE is narrower than a
and converted back again. If ptrdiff_t is narrower than a
pointer (e.g., the AS/400), play it safe and compute the alignment
relative to B. Otherwise, use the faster strategy of computing the
alignment relative to 0. */
#define __PTR_ALIGN(B, P, A) \
__BPTR_ALIGN (sizeof (PTR_INT_TYPE) < sizeof (void *) ? (B) : (char *) 0, \
__BPTR_ALIGN (sizeof (ptrdiff_t) < sizeof (void *) ? (B) : (char *) 0, \
P, A)
#include <string.h>
......@@ -165,21 +155,21 @@ struct _obstack_chunk /* Lives at front of each chunk. */
struct obstack /* control current object in current chunk */
{
PTR_INT_TYPE chunk_size; /* preferred size to allocate chunks in */
ptrdiff_t chunk_size; /* preferred size to allocate chunks in */
struct _obstack_chunk *chunk; /* address of current struct obstack_chunk */
char *object_base; /* address of object we are building */
char *next_free; /* where to add next char to current object */
char *chunk_limit; /* address of char after current chunk */
union
{
PTR_INT_TYPE tempint;
ptrdiff_t tempint;
void *tempptr;
} temp; /* Temporary for some macros. */
int alignment_mask; /* Mask of alignment for each object. */
/* These prototypes vary based on `use_extra_arg', and we use
casts to the prototypeless function type in all assignments,
but having prototypes here quiets -Wstrict-prototypes. */
struct _obstack_chunk *(*chunkfun) (void *, PTR_INT_TYPE);
struct _obstack_chunk *(*chunkfun) (void *, ptrdiff_t);
void (*freefun) (void *, struct _obstack_chunk *);
void *extra_arg; /* first arg for chunk alloc/dealloc funcs */
unsigned use_extra_arg:1; /* chunk alloc/dealloc funcs take extra arg */
......@@ -194,13 +184,13 @@ struct obstack /* control current object in current chunk */
/* Declare the external functions we use; they are in obstack.c. */
FIRM_API void _obstack_newchunk (struct obstack *, PTR_INT_TYPE);
FIRM_API void _obstack_newchunk (struct obstack *, ptrdiff_t);
FIRM_API int _obstack_begin (struct obstack *, int, int,
void *(*) (PTR_INT_TYPE), void (*) (void *));
void *(*) (ptrdiff_t), void (*) (void *));
FIRM_API int _obstack_begin_1 (struct obstack *, int, int,
void *(*) (void *, PTR_INT_TYPE),
void *(*) (void *, ptrdiff_t),
void (*) (void *, void *), void *);
FIRM_API PTR_INT_TYPE _obstack_memory_used (struct obstack *);
FIRM_API ptrdiff_t _obstack_memory_used (struct obstack *);
FIRM_API void obstack_free (struct obstack *obstack, void *block);
......@@ -234,26 +224,26 @@ FIRM_API int obstack_exit_failure;
/* To prevent prototype warnings provide complete argument list. */
#define obstack_init(h) \
_obstack_begin ((h), 0, 0, \
(void *(*) (PTR_INT_TYPE)) obstack_chunk_alloc, \
(void *(*) (ptrdiff_t)) obstack_chunk_alloc, \
(void (*) (void *)) obstack_chunk_free)
#define obstack_begin(h, size) \
_obstack_begin ((h), (size), 0, \
(void *(*) (PTR_INT_TYPE)) obstack_chunk_alloc, \
(void *(*) (ptrdiff_t)) obstack_chunk_alloc, \
(void (*) (void *)) obstack_chunk_free)
#define obstack_specify_allocation(h, size, alignment, chunkfun, freefun) \
_obstack_begin ((h), (size), (alignment), \
(void *(*) (PTR_INT_TYPE)) (chunkfun), \
(void *(*) (ptrdiff_t)) (chunkfun), \
(void (*) (void *)) (freefun))
#define obstack_specify_allocation_with_arg(h, size, alignment, chunkfun, freefun, arg) \
_obstack_begin_1 ((h), (size), (alignment), \
(void *(*) (void *, PTR_INT_TYPE)) (chunkfun), \
(void *(*) (void *, ptrdiff_t)) (chunkfun), \
(void (*) (void *, void *)) (freefun), (arg))
#define obstack_chunkfun(h, newchunkfun) \
((h) -> chunkfun = (struct _obstack_chunk *(*)(void *, PTR_INT_TYPE)) (newchunkfun))
((h) -> chunkfun = (struct _obstack_chunk *(*)(void *, ptrdiff_t)) (newchunkfun))
#define obstack_freefun(h, newfreefun) \
((h) -> freefun = (void (*)(void *, struct _obstack_chunk *)) (newfreefun))
......@@ -290,7 +280,7 @@ FIRM_API int obstack_exit_failure;
# define obstack_make_room(OBSTACK,length) \
__extension__ \
({ struct obstack *__o = (OBSTACK); \
PTR_INT_TYPE __len = (length); \
ptrdiff_t __len = (length); \
if (__o->chunk_limit - __o->next_free < __len) \
_obstack_newchunk (__o, __len); \
(void) 0; })
......@@ -306,7 +296,7 @@ __extension__ \
# define obstack_grow(OBSTACK,where,length) \
__extension__ \
({ struct obstack *__o = (OBSTACK); \
PTR_INT_TYPE __len = (length); \
ptrdiff_t __len = (length); \
if (__o->next_free + __len > __o->chunk_limit) \
_obstack_newchunk (__o, __len); \
memcpy (__o->next_free, where, __len); \
......@@ -316,7 +306,7 @@ __extension__ \
# define obstack_grow0(OBSTACK,where,length) \
__extension__ \
({ struct obstack *__o = (OBSTACK); \
PTR_INT_TYPE __len = (length); \
ptrdiff_t __len = (length); \
if (__o->next_free + __len + 1 > __o->chunk_limit) \
_obstack_newchunk (__o, __len + 1); \
memcpy (__o->next_free, where, __len); \
......@@ -367,7 +357,7 @@ __extension__ \
# define obstack_blank(OBSTACK,length) \
__extension__ \
({ struct obstack *__o = (OBSTACK); \
PTR_INT_TYPE __len = (length); \
ptrdiff_t __len = (length); \
if (__o->chunk_limit - __o->next_free < __len) \
_obstack_newchunk (__o, __len); \
obstack_blank_fast (__o, __len); \
......@@ -510,7 +500,7 @@ __extension__ \
( (h)->temp.tempint = (char *) (obj) - (char *) (h)->chunk, \
((((h)->temp.tempint > 0 \
&& (h)->temp.tempint < (h)->chunk_limit - (char *) (h)->chunk)) \
? (PTR_INT_TYPE) ((h)->next_free = (h)->object_base \
? (ptrdiff_t) ((h)->next_free = (h)->object_base \
= (h)->temp.tempint + (char *) (h)->chunk) \
: (((obstack_free) ((h), (h)->temp.tempint + (char *) (h)->chunk), 0), 0)))
......
......@@ -13,6 +13,7 @@
#ifndef FIRM_ANA_CALLGRAPH_H
#define FIRM_ANA_CALLGRAPH_H
#include <stddef.h>
#include "firm_types.h"
#include "begin.h"
......
......@@ -11,6 +11,8 @@
#ifndef FIRM_STATEVENT_H
#define FIRM_STATEVENT_H
#include "begin.h"
/**
* @defgroup statev Statistic Events
*
......@@ -72,4 +74,6 @@ FIRM_API int stat_ev_enabled;
/** @} */
#include "end.h"
#endif
......@@ -8,12 +8,12 @@
* @brief Array --- dynamic & flexible arrays.
* @author Markus Armbruster
*/
#include <stdlib.h>
#include "array.h"
#include "fourcc.h"
#include "util.h"
#include "xmalloc.h"
#include "fourcc.h"
#include <stdlib.h>
#define ARR_D_MAGIC FOURCC('A','R','R','D')
#define ARR_F_MAGIC FOURCC('A','R','R','F')
......
......@@ -8,12 +8,12 @@
* @brief Specialized implementation for perfect bipartite matching.
* @author Sebastian Hack
*/
#include <stdio.h>
#include <assert.h>
#include "bipartite.h"
#include "bitset.h"
#include "bipartite.h"
#include "xmalloc.h"
#include <assert.h>
#include <stdio.h>
struct bipartite_t {
unsigned n_left;
......
......@@ -2,8 +2,8 @@
* This file is part of libFirm.
* Copyright (C) 2015 University of Karlsruhe.
*/
#include "bitset.h"
#include "irprintf.h"
void bitset_fprint(FILE *const file, bitset_t const *const bs)
......
......@@ -27,9 +27,9 @@
/*------------------------------------------------------*/
#include "gaussjordan.h"
#include "xmalloc.h"
#include <math.h>
#include <stdlib.h>
#include "xmalloc.h"
#define SMALL 0.00001
......
#include "gaussseidel.h"
#include "util.h"
#include "xmalloc.h"
#include <assert.h>
#include <math.h>
#include <string.h>
#include "xmalloc.h"
#include "util.h"
typedef struct {
double v;
......
......@@ -30,16 +30,15 @@
*/
#include "hungarian.h"
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include "util.h"
#include "xmalloc.h"
#include "debug.h"
#include "panic.h"
#include "raw_bitset.h"
#include "util.h"
#include "xmalloc.h"
#include <assert.h>
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
DEBUG_ONLY(static firm_dbg_module_t *dbg;)
......
......@@ -11,8 +11,8 @@
*/
#include "pmap.h"
#include "set.h"
#include "hashptr.h"
#include "set.h"
#define INITIAL_SLOTS 64
......
......@@ -42,9 +42,9 @@
#endif
#ifdef PSET
# include "pset.h"
#include "pset.h"
#else
# include "set.h"
#include "set.h"
#endif
#include <assert.h>
......
......@@ -8,12 +8,12 @@
* @brief implementation of xmalloc & friends
* @author Markus Armbruster
*/
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include "xmalloc.h"
#include "funcattr.h"
#include "xmalloc.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
static FIRM_NORETURN xnomem(void)
{
......
......@@ -8,17 +8,17 @@
* @brief read/write analyze of graph argument, which have mode reference.
* @author Beyhan Veliev
*/
#include <stdlib.h>
#include "analyze_irg_args.h"
#include "irouts_t.h"
#include "irnode_t.h"
#include "irmode_t.h"
#include "array.h"
#include "cgana.h"
#include "irprog.h"
#include "entity_t.h"
#include "analyze_irg_args.h"
#include "irmode_t.h"
#include "irnode_t.h"
#include "irouts_t.h"
#include "irprog.h"
#include "util.h"
#include <stdlib.h>
/**
* Walk recursive the successors of a graph argument
......
......@@ -9,25 +9,21 @@
* @author Goetz Lindenmaier
* @date 21.7.2004
*/
#include <stdlib.h>
#include "util.h"
#include "callgraph.h"
#include "irloop_t.h"
#include "irprog_t.h"
#include "array.h"
#include "cgana.h"
#include "hashptr.h"
#include "irgraph_t.h"
#include "irgwalk.h"
#include "irloop_t.h"
#include "irnode_t.h"
#include "cgana.h"
#include "array.h"
#include "irprog_t.h"
#include "panic.h"
#include "pmap.h"
#include "hashptr.h"
#include "raw_bitset.h"
#include "panic.h"
#include "irgwalk.h"
#include "util.h"
#include <stdlib.h>
static ir_visited_t master_cg_visited = 0;
......
......@@ -8,18 +8,19 @@
* @brief Implementation of cdep
* @author Christoph Mallon
*/
#include <assert.h>
#include <stdlib.h>
#include "cdep_t.h"
#include "irdom_t.h"
#include "irdump.h"
#include "irgraph_t.h"
#include "irgwalk.h"
#include "irnode_t.h"
#include "pmap.h"
#include "irprintf.h"
#include "obst.h"
#include "pmap.h"
#include "xmalloc.h"
#include "cdep_t.h"
#include "irprintf.h"
#include "irdump.h"
#include <assert.h>
#include <stdlib.h>
typedef struct cdep_info {
pmap *cdep_map; /**< A map to find the list of all control dependence nodes for a block. */
......
......@@ -17,25 +17,23 @@
* the program directly, or they are visible external.
*/
#include "cgana.h"
#include "xmalloc.h"
#include "irnode_t.h"
#include "irmode_t.h"
#include "irprog_t.h"
#include "irgwalk.h"
#include "array.h"
#include "dbginfo_t.h"
#include "ircons.h"
#include "irdump.h"
#include "irflag_t.h"
#include "irgmod.h"
#include "irgwalk.h"
#include "irmode_t.h"
#include "irnode_t.h"
#include "iropt.h"
#include "irtools.h"
#include "irflag_t.h"
#include "dbginfo_t.h"
#include "iropt_dbg.h"
#include "pmap.h"
#include "array.h"
#include "irprog_t.h"
#include "irtools.h"
#include "panic.h"
#include "irdump.h"
#include "pmap.h"
#include "xmalloc.h"
/* unambiguous address used as a mark. */
static void *MARK = &MARK;
......
......@@ -10,14 +10,13 @@
*/
#include "constbits.h"
#include <assert.h>
#include "debug.h"
#include "iredges_t.h"
#include "irgwalk.h"
#include "irnode_t.h"
#include "irnodemap.h"
#include "iropt.h"
#include <assert.h>
#ifndef VERIFY_CONSTBITS
# ifdef DEBUG_libfirm
......
......@@ -16,13 +16,14 @@
* for an improved Conv optimization. It also allows finding
* additional constants (vrp->z ^ vrp->o & dc == 0).
*/
#include "dca.h"
#include "constbits.h"
#include "debug.h"
#include "irgwalk.h"
#include "irnode_t.h"
#include "tv.h"
#include "pdeq.h"
#include "irgwalk.h"
#include "dca.h"
#include "tv.h"
DEBUG_ONLY(static firm_dbg_module_t *dbg;)
......
#ifndef DCA_H
#define DCA_H
#ifndef IR_ANA_DCA_H
#define IR_ANA_DCA_H
#include "firm_types.h"
/**
* Compute don't care bits.
......
......@@ -11,19 +11,19 @@
*
* Simple depth first search on CFGs.
*/
#include <stdlib.h>
#include "dfs_t.h"
#define DISABLE_STATEV
#include <assert.h>
#include "irdom_t.h"
#include "iredges_t.h"
#include "irgraph_t.h"
#include "irprintf.h"
#include "irdom_t.h"
#include "set.h"
#include "statev_t.h"
#include "dfs_t.h"
#include "util.h"
#include <assert.h>
#include <stdlib.h>
static int cmp_edge(const void *a, const void *b, size_t sz)
{
......
......@@ -15,6 +15,7 @@
#define FIRM_ANA_DFS_H
#include "firm_types.h"
#include <stdio.h>
typedef struct dfs_t dfs_t;
typedef struct dfs_node_t dfs_node_t;
......
......@@ -14,9 +14,11 @@
#ifndef FIRM_ANA_DFS_T_H
#define FIRM_ANA_DFS_T_H
#include <stdbool.h>
#include "hashptr.h"
#include "dfs.h"
#include "hashptr.h"
#include "set.h"
#include <stdbool.h>
#include <string.h>
#define dfs_get_n_nodes(dfs) ((dfs)->pre_num)
#define dfs_get_pre_num(dfs, node) (_dfs_get_node((dfs), (node))->pre_num)
......
......@@ -9,11 +9,11 @@
* @author Sebastian Hack, Daniel Grund
* @date 04.05.2005
*/
#include "obst.h"
#include "pmap.h"
#include "irdom.h"
#include "array.h"
#include "irdom.h"
#include "iredges_t.h"
#include "obst.h"
#include "pmap.h"
/**
* A wrapper for get_Block_idom.
......
......@@ -25,30 +25,27 @@
* execution frequencies). We alleviate that by adding artificial edges from
* kept blocks with a path to end.
*/
#include <stdio.h>
#include <string.h>
#include <math.h>
#include "execfreq_t.h"
#include "dfs_t.h"
#include "gaussjordan.h"
#include "set.h"
#include "hashptr.h"
#include "dfs_t.h"
#include "panic.h"
#include "xmalloc.h"
#include "irprog_t.h"
#include "iredges_t.h"
#include "irgraph_t.h"
#include "irnode_t.h"
#include "irloop.h"
#include "irgwalk.h"
#include "iredges_t.h"
#include "irouts.h"
#include "util.h"
#include "irhooks.h"
#include "irloop.h"
#include "irnode_t.h"
#include "irnodehashmap.h"
#include "execfreq_t.h"
#include "irouts.h"
#include "irprog_t.h"
#include "panic.h"
#include "set.h"
#include "util.h"
#include "xmalloc.h"
#include <math.h>