Commit f8dfdaaf authored by Matthias Braun's avatar Matthias Braun
Browse files

consolidate utility macros in util.h

parent 11c8428b
......@@ -35,7 +35,7 @@
#include <stdlib.h>
#include <assert.h>
#include "irtools.h"
#include "util.h"
#include "xmalloc.h"
#include "debug.h"
#include "bitset.h"
......
......@@ -21,7 +21,7 @@
* @file
* @date 31.05.2005
* @author Sebastian Hack
* @brief Some utility macros.
* @brief Miscelaneous utility macros.
*/
#ifndef FIRM_ADT_UTIL_H
#define FIRM_ADT_UTIL_H
......@@ -46,4 +46,27 @@
*/
#define ARRAY_SIZE(a) (sizeof(a)/sizeof((a)[0]))
#undef MIN
#undef MAX
#define MAX(x, y) ((x) > (y) ? (x) : (y))
#define MIN(x, y) ((x) < (y) ? (x) : (y))
/**
* Three valued compare as demanded by e.g. qsort(3)
* @param c A number.
* @param d Another number.
* @return 0 if c == d, -1 if c < d, 1 if c > d.
*/
#define QSORT_CMP(c, d) (((c) > (d)) - ((c) < (d)))
/**
* convert an integer into pointer
*/
#define INT_TO_PTR(v) ((void *)((char *)0 + (v)))
/**
* convert a pointer into an integer
*/
#define PTR_TO_INT(v) (((char *)(v) - (char *)0))
#endif
......@@ -33,12 +33,12 @@
#define DISABLE_STATEV
#include <assert.h>
#include "irtools.h"
#include "irprintf.h"
#include "irdom.h"
#include "set.h"
#include "statev.h"
#include "dfs_t.h"
#include "util.h"
static int cmp_edge(const void *a, const void *b, size_t sz)
{
......
......@@ -48,7 +48,7 @@
#include "iredges.h"
#include "irouts.h"
#include "irprintf.h"
#include "irtools.h"
#include "util.h"
#include "irhooks.h"
#include "execfreq.h"
......
......@@ -32,12 +32,12 @@
#include <stdio.h>
#include <stdbool.h>
#include "list.h"
#include "irdump.h"
#include "irgwalk.h"
#include "irtools.h"
#include "irnodemap.h"
#include "iredges_t.h"
#include "list.h"
#include "util.h"
struct ir_heights_t {
ir_nodemap data;
......
......@@ -34,7 +34,7 @@
#include "irgraph_t.h"
#include "irprog_t.h"
#include "irgwalk.h"
#include "irtools.h"
#include "util.h"
#include "irprintf.h"
#include "error.h"
......
......@@ -39,9 +39,10 @@
#include "irgopt.h"
#include "irbitset.h"
#include "iropt_t.h"
#include "irtools.h"
#include "heights.h"
#include "pdeq.h"
#include "irtools.h"
#include "util.h"
#include "raw_bitset.h"
#include "error.h"
#include "pset_new.h"
......
......@@ -52,6 +52,7 @@
#include "execfreq.h"
#include "irdump_t.h"
#include "irtools.h"
#include "util.h"
#include "debug.h"
#include "beirgmod.h"
#include "bemodule.h"
......
......@@ -34,7 +34,7 @@
#include "irgwalk.h"
#include "irprintf.h"
#include "iredges_t.h"
#include "irtools.h"
#include "util.h"
#include "belive_t.h"
#include "bechordal_t.h"
......
......@@ -43,6 +43,7 @@
#include "irgraph_t.h"
#include "irnode_t.h"
#include "irprintf.h"
#include "util.h"
#include "irtools.h"
#include "irnodemap.h"
......
......@@ -45,6 +45,7 @@
#include "pdeq.h"
#include "irprintf.h"
#include "irbitset.h"
#include "util.h"
#include "irtools.h"
#include "error.h"
#include "list.h"
......
......@@ -50,7 +50,7 @@
#include "raw_bitset.h"
#include "pdeq.h"
#include "irtools.h"
#include "util.h"
#include "irgwalk.h"
#include "becopyilp_t.h"
#include "beifg.h"
......
......@@ -45,6 +45,7 @@
#include "irbitset.h"
#include "irprintf_t.h"
#include "irtools.h"
#include "util.h"
#include "bemodule.h"
#include "bearch.h"
......
......@@ -29,7 +29,7 @@
#include "set.h"
#include "pset.h"
#include "irnode.h"
#include "irtools.h"
#include "util.h"
#include "irloop_t.h"
#include "error.h"
#include "debug.h"
......
......@@ -55,6 +55,7 @@
#include "irprintf.h"
#include "irdump.h"
#include "irtools.h"
#include "util.h"
#include "obst.h"
#include "raw_bitset.h"
#include "unionfind.h"
......
......@@ -31,10 +31,10 @@
#include "belive_t.h"
#include "beutil.h"
#include "heights.h"
#include "irtools.h"
#include "irgwalk.h"
#include "benode.h"
#include "bemodule.h"
#include "util.h"
#include "array_t.h"
// XXX there is no one time init for schedulers
......
......@@ -31,6 +31,7 @@
#include "iredges_t.h"
#include "irgwalk.h"
#include "irtools.h"
#include "util.h"
#include "besched.h"
#include "belistsched.h"
......
......@@ -40,6 +40,7 @@
#include "irprintf.h"
#include "irnodeset.h"
#include "irtools.h"
#include "util.h"
#include "beutil.h"
#include "bearch.h"
......
......@@ -37,7 +37,7 @@
#include "xmalloc.h"
#include "pmap.h"
#include "pdeq.h"
#include "irtools.h"
#include "util.h"
#include "obst.h"
#include "array_t.h"
#include "be_dbgout_t.h"
......
......@@ -40,7 +40,7 @@
#include "irgraph_t.h"
#include "iredges_t.h"
#include "irdom_t.h"
#include "irtools.h"
#include "util.h"
#include "be_t.h"
#include "beutil.h"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment