Removed old and unused debug.[ch] support
authorMichael Beck <beck@ipd.info.uni-karlsruhe.de>
Thu, 8 Jul 2004 14:30:43 +0000 (14:30 +0000)
committerMichael Beck <beck@ipd.info.uni-karlsruhe.de>
Thu, 8 Jul 2004 14:30:43 +0000 (14:30 +0000)
[r3368]

ir/adt/Makefile.in
ir/adt/debug.c [deleted file]
ir/adt/debug.h [deleted file]
ir/adt/pdeq.c

index 1ba5c69..070a8c7 100644 (file)
@@ -18,9 +18,8 @@ disable_libiberty := @disable_libiberty@
 
 
 SOURCES = Makefile.in                                                  \
-       array.c array.h cookies.h debug.c debug.h host.h obst.h         \
-       pdeq.c pdeq.h pset.h set.c set.h pmap.h pmap.c eset.h eset.c    \
-       xmalloc.h
+       array.c array.h cookies.h host.h obst.h pdeq.c pdeq.h pset.h    \
+       set.c set.h pmap.h pmap.c eset.h eset.c xmalloc.h
 
 ifeq ($(disable_libiberty),no)
 SOURCES += xmalloc.c
diff --git a/ir/adt/debug.c b/ir/adt/debug.c
deleted file mode 100644 (file)
index 33ae05d..0000000
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * Project:     libFIRM
- * File name:   ir/adt/debug.c
- * Purpose:     Debug --- run time debug level management
- * Author:      Christian von Roques
- * Modified by:
- * Created:     1999 by getting from fiasco
- * CVS-ID:      $Id$
- * Copyright:   (c) 1995, 1996 Christian von Roques
- * Licence:     This file protected by GPL -  GNU GENERAL PUBLIC LICENSE.
- */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include <stdlib.h>
-#include <string.h>
-#include "debug.h"
-#include "xmalloc.h"
-
-
-int
-(d_) (int flag, unsigned level)
-{
-  return d_ (flag, level);
-}
-
-
-int
-(d_level) (int flag)
-{
-  return d_level (flag);
-}
-
-
-int
-(d_set_level) (int flag, unsigned level)
-{
-  return d_set_level (flag, level);
-}
-
-
-#ifdef DEBUG
-int nflags;
-unsigned char *d_vec;
-#endif
-
-
-/*
- * Set debug flags according to the following syntax:
- * number ["-" number] ["." number]
- * 1st number is number of first flag to set.
- * 2nd number is number of last flag to set. [defaults to 1st number]
- * 3rd number is level to set the flags to. [defaults to 1]
- */
-void
-(d_parse) (const char *s)
-{
-#ifdef DEBUG
-  long first, last, level;
-  char *end;
-
-  first = strtol(s, &end, 10);
-  last = (s != end) ? first : nflags-1;
-
-  s = end;
-  if (*s == '-') {
-    ++s;
-    last = strtol(s, &end, 10);
-    if (end == s) last = nflags-1; /* 3-  ==> 3..nflags-1 */
-  }
-
-  s = end;
-  if (*s == '.') {
-    ++s;
-    level = strtol(s, &end, 10);
-    /* . with no number gives level 0 */
-  } else {
-    level = 1;
-  }
-
-  if (first<0) first=0;
-  if (last>=nflags) last = nflags-1;
-
-  while (first<=last) d_vec[first++] = level;
-#endif /* DEBUG */
-}
-
-
-void
-(d_init) (int n)
-{
-#ifdef DEBUG
-  nflags = n;
-  d_vec = xmalloc (sizeof (unsigned char) * n);
-  memset(d_vec, 0, sizeof (unsigned char) * n);
-#endif
-}
diff --git a/ir/adt/debug.h b/ir/adt/debug.h
deleted file mode 100644 (file)
index 618d3fd..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Project:     libFIRM
- * File name:   ir/adt/debug.h
- * Purpose:     Declarations for debug
- * Author:      Christian von Roques
- * Modified by:
- * Created:     1999 by getting from fiasco
- * CVS-ID:      $Id$
- * Copyright:   (c) 1995, 1996 Christian von Roques
- * Licence:     This file protected by GPL -  GNU GENERAL PUBLIC LICENSE.
- */
-
-
-#ifndef _DEBUG_H_
-#define _DEBUG_H_
-
-void d_init (int nflags);
-int  d_ (int flag, unsigned level);
-int  d_level (int flag);
-int  d_set_level (int flag, unsigned level);
-void d_parse (const char *s);
-
-#ifdef DEBUG
-
-#include "deflag.h"
-
-extern unsigned char *d_vec;
-
-# define d_init(n) (d_init) ((n))
-# define d_(flag, level) (d_vec[(flag)] >= (level))
-# define d_level(flag) (d_vec[(flag)])
-# define d_set_level(flag, level) (d_vec[(flag)] = (level))
-# define d_parse(s) (d_parse) ((s))
-
-#else  /* !DEBUG */
-
-# define d_init(n) ((void)0)
-# define d_(flag, level) 0
-# define d_level(flag) 0
-# define d_set_level(flag, level) (level)
-# define d_parse(s) ((void)0)
-
-#endif /* !DEBUG */
-
-#endif
index 493e2e6..9ea9747 100644 (file)
@@ -23,7 +23,6 @@
 # endif
 
 #include "cookies.h"
-#include "debug.h"
 #include "pdeq.h"
 #include "xmalloc.h"
 
@@ -39,8 +38,7 @@
 #ifdef NDEBUG
 # define VRFY(dq) ((void)0)
 #else
-# define VRFY(dq) \
-    (d_(df_vrfy_level,1) ? _pdeq_vrfy ((dq)) : assert ((dq) && ((dq)->cookie == PDEQ_COOKIE1)))
+# define VRFY(dq) assert((dq) && ((dq)->cookie == PDEQ_COOKIE1))
 #endif
 
 /**
@@ -81,10 +79,8 @@ static INLINE void free_pdeq_block (pdeq *p)
   p->cookie = 0xbadf00d1;
 #endif
   if (pdeqs_cached < TUNE_NSAVED_PDEQS) {
-    if (d_ (df_pdeq, 2)) printf ("[%p ==> pdeq_block_cache] ", p);
     pdeq_block_cache[pdeqs_cached++] = p;
   } else {
-    if (d_ (df_pdeq, 2)) printf ("[%p ==> free] ", p);
     xfree (p);
   }
 }
@@ -99,10 +95,8 @@ static INLINE pdeq *alloc_pdeq_block (void)
   pdeq *p;
   if (TUNE_NSAVED_PDEQS && pdeqs_cached) {
     p = pdeq_block_cache[--pdeqs_cached];
-    if (d_ (df_pdeq, 2)) printf ("[pdeq_block_cache ==> %p] ", p);
   } else {
     p = xmalloc (PREF_MALLOC_SIZE);
-    if (d_ (df_pdeq, 2)) printf ("[malloc ==> %p] ", p);
   }
   return p;
 }
@@ -118,7 +112,6 @@ void _pdeq_vrfy(pdeq *dq)
 {
   pdeq *q;
 
-  if (d_ (df_pdeq, 5)) printf ("[pdeq_vrfy %p] ", dq);
 
   assert (   dq
          && (dq->cookie == PDEQ_COOKIE1)
@@ -152,7 +145,6 @@ pdeq *new_pdeq(void)
   dq->n = dq->p = 0;
 
   VRFY(dq);
-  if (d_(df_pdeq, 1)) printf("(new_pdeq ==> %p)\n", dq);
   return dq;
 }
 
@@ -181,14 +173,12 @@ void del_pdeq(pdeq *dq)
     free_pdeq_block(q);
   } while ((q = qq));
 
-  if (d_(df_pdeq, 1)) printf("(del_pdeq %p)\n", dq);
 }
 
 /* Checks if a list is empty. */
 int pdeq_empty(pdeq *dq)
 {
   VRFY(dq);
-  if (d_(df_pdeq, 4)) printf("(pdeq_empty %p ==> %d)\n", dq, dq->l_end->n == 0);
   return dq->l_end->n == 0;
 }
 
@@ -207,7 +197,6 @@ int pdeq_len(pdeq *dq)
     q = q->r;
   }  while (q);
 
-  if (d_(df_pdeq, 4)) printf("(pdeq_len %p ==> %d)\n", dq, n);
   return n;
 }
 
@@ -216,7 +205,6 @@ pdeq * pdeq_putr(pdeq *dq, const void *x)
 {
   pdeq *rdq;
   int n;
-  int pr = 0;
 
   VRFY(dq);
 
@@ -228,7 +216,6 @@ pdeq * pdeq_putr(pdeq *dq, const void *x)
     if (dq->n) {               /* ... if trunk used */
       /* allocate and init new block */
       ndq = alloc_pdeq_block();
-      pr = d_(df_pdeq, 2);
 #ifndef NDEBUG
       ndq->cookie = PDEQ_COOKIE2;
 #endif
@@ -248,7 +235,6 @@ pdeq * pdeq_putr(pdeq *dq, const void *x)
   rdq->data[n] = x;
 
   VRFY(dq);
-  if (d_(df_pdeq, 3) || pr) printf("(pdeq_putr %p %p)\n", dq, x);
   return dq;
 }
 
@@ -257,7 +243,6 @@ pdeq *pdeq_putl(pdeq *dq, const void *x)
 {
   pdeq *ldq;
   int p;
-  int pr = 0;
 
   VRFY(dq);
 
@@ -269,7 +254,6 @@ pdeq *pdeq_putl(pdeq *dq, const void *x)
     if (dq->n) {               /* ... if trunk used */
       /* allocate and init new block */
       ndq = alloc_pdeq_block();
-      pr = d_(df_pdeq, 2);
 #ifndef NDEBUG
       ndq->cookie = PDEQ_COOKIE2;
 #endif
@@ -291,7 +275,6 @@ pdeq *pdeq_putl(pdeq *dq, const void *x)
   ldq->data[p] = x;
 
   VRFY(dq);
-  if (d_(df_pdeq, 3) || pr) printf("(pdeq_putl %p %p)\n", dq, x);
   return dq;
 }
 
@@ -301,7 +284,6 @@ void *pdeq_getr(pdeq *dq)
   pdeq *rdq;
   const void *x;
   int n;
-  int pr = 0;
 
   VRFY(dq);
   assert(dq->l_end->n);
@@ -321,12 +303,10 @@ void *pdeq_getr(pdeq *dq)
     }
     if (dq != rdq) {
       free_pdeq_block(rdq);
-      pr = d_(df_pdeq, 2);
     }
   }
 
   VRFY(dq);
-  if (d_(df_pdeq, 3) || pr) printf("(pdeq_getr %p ==> %p)\n", dq, x);
   return (void *)x;
 }
 
@@ -336,7 +316,6 @@ void *pdeq_getl(pdeq *dq)
   pdeq *ldq;
   const void *x;
   int p;
-  int pr = 0;
 
   VRFY(dq);
   assert(dq->l_end->n);
@@ -357,12 +336,10 @@ void *pdeq_getl(pdeq *dq)
     }
     if (dq != ldq) {
       free_pdeq_block(ldq);
-      pr = d_(df_pdeq, 2);
     }
   }
 
   VRFY(dq);
-  if (d_(df_pdeq, 3) || pr) printf("(pdeq_getl %p ==> %p)\n", dq, x);
   return (void *)x;
 }
 
@@ -383,22 +360,21 @@ int pdeq_contains(pdeq *dq, const void *x)
     p = q->p; ep = p + q->n;
 
     if (ep > NDATA) {
-      do if (q->data[p] == x) goto found; while (++p < NDATA);
+      do {
+       if (q->data[p] == x) return 1;
+      } while (++p < NDATA);
       p = 0;
       ep -= NDATA;
     }
 
-    while (p < ep) if (q->data[p++] == x) goto found;
+    while (p < ep) {
+      if (q->data[p++] == x) return 1;
+    }
 
     q = q->r;
   } while (q);
 
-  if (d_(df_pdeq, 3)) printf("(pdeq_contains %p %p ==> 0)\n", dq, x);
   return 0;
-
-found:  /* The two gotos can be optimized away, if !DEBUG */
-  if (d_(df_pdeq, 3)) printf("(pdeq_contains %p %p ==> 1)\n", dq, x);
-  return 1;
 }
 
 /*
@@ -421,23 +397,21 @@ void *pdeq_search(pdeq *dq, cmp_fun cmp, const void *key)
     p = q->p; ep = p + q->n;
 
     if (ep > NDATA) {
-      do if (!cmp (q->data[p], key)) goto found; while (++p < NDATA);
+      do {
+       if (!cmp (q->data[p], key)) return (void *)q->data[p-1];
+      } while (++p < NDATA);
       p = 0;
       ep -= NDATA;
     }
 
-    while (p < ep) if (!cmp (q->data[p++], key)) goto found;
+    while (p < ep) {
+      if (!cmp (q->data[p++], key)) return (void *)q->data[p-1];
+    }
 
     q = q->r;
   } while (q);
 
-  if (d_(df_pdeq, 3)) printf("(pdeq_search %p %p %p ==> 0)\n", dq, cmp, key);
   return NULL;
-
-found:  /* The two gotos can be optimized away, if !DEBUG */
-  if (d_(df_pdeq, 3)) printf("(pdeq_contains %p %p %p ==> %p)\n",
-                            dq, cmp, key, q->data[p]);
-  return (void *)q->data[p-1];
 }
 
 /*
@@ -468,7 +442,6 @@ void **pdeq_copyl(pdeq *dq, const void **dst)
     q = q->r;
   }
 
-  if (d_(df_pdeq, 3)) printf("(pdeq_copyl %p %p ==> %p)\n", dq, dst, d);
   return (void **)dst;
 }
 
@@ -499,6 +472,5 @@ void **pdeq_copyr(pdeq *dq, const void **dst)
     q = q->l;
   }
 
-  if (d_(df_pdeq, 3)) printf("(pdeq_copyr %p %p ==> %p)\n", dq, dst, d);
   return (void **)dst;
 }