- implemented ia32_ClimbFrame() pseudo-instruction
[libfirm] / ir / common / irtools.h
index 32b9293..ae9ba11 100644 (file)
@@ -1,30 +1,47 @@
 /*
- * Project:     libFIRM
- * File name:   ir/ir/irtools.h
- * Purpose:     Some often needed tool-functions
- * Author:      Michael Beck
- * Modified by:
- * Created:
- * CVS-ID:      $Id$
- * Copyright:   (c) 1999-2006 Universität Karlsruhe
- * Licence:     This file protected by GPL -  GNU GENERAL PUBLIC LICENSE.
+ * Copyright (C) 1995-2008 University of Karlsruhe.  All right reserved.
+ *
+ * This file is part of libFirm.
+ *
+ * This file may be distributed and/or modified under the terms of the
+ * GNU General Public License version 2 as published by the Free Software
+ * Foundation and appearing in the file LICENSE.GPL included in the
+ * packaging of this file.
+ *
+ * Licensees holding valid libFirm Professional Edition licenses may use
+ * this file in accordance with the libFirm Commercial License.
+ * Agreement provided with the Software.
+ *
+ * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+ * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE.
+ */
+
+/**
+ * @file
+ * @brief     Some often needed tool-functions
+ * @author    Michael Beck
+ * @version   $Id$
  */
-#ifndef _FIRM_COMMON_IRTOOLS_H_
-#define _FIRM_COMMON_IRTOOLS_H_
+#ifndef FIRM_COMMON_IRTOOLS_H
+#define FIRM_COMMON_IRTOOLS_H
 
-#include "firm_config.h"
 #include "firm_types.h"
 
-#ifdef WITH_LIBCORE
-#include <libcore/lc_opts.h>
+#include "lc_opts.h"
 lc_opt_entry_t *firm_opt_get_root(void);
-#endif
+
+#include "pset.h"
 
 #undef MIN
 #undef MAX
 #define MAX(x, y) ((x) > (y) ? (x) : (y))
 #define MIN(x, y) ((x) < (y) ? (x) : (y))
 
+/* calculate the address of the one past last element of an array whose size is
+ * known statically */
+#define ENDOF(x) ((x) + sizeof(x) / sizeof(*(x)))
+
 /**
  * Three valued compare as demanded by e.g. qsort(3)
  * @param c A number.
@@ -44,12 +61,26 @@ lc_opt_entry_t *firm_opt_get_root(void);
  */
 #define PTR_TO_INT(v)   ((int)((char *)(v) - (char *)0))
 
+/**
+ * Dump a pset containing Firm objects.
+ */
+void firm_pset_dump(pset *set);
+
 /**
  * The famous clear_link() walker-function.
- * Do not implement it by yourself, use this one
+ * Sets all links fields of visited nodes to NULL.
+ * Do not implement it by yourself, use this one.
  */
 void firm_clear_link(ir_node *n, void *env);
 
+/**
+ * The famous clear_link_and_block_lists() walker-function.
+ * Sets all links fields of visited nodes to NULL.
+ * Additionally, clear all Phi-lists of visited blocks.
+ * Do not implement it by yourself, use this one
+ */
+void firm_clear_node_and_phi_links(ir_node *n, void *env);
+
 /**
  * Copies a node to a new irg. The Ins of the new node point to
  * the predecessors on the old irg.  n->link points to the new node.
@@ -72,6 +103,6 @@ void copy_irn_to_irg(ir_node *n, ir_graph *irg);
  * @note If the copy is not changed, the next CSE operation will
  *       replace it by the original, so beware.
  */
-ir_node *exact_copy(ir_node *n);
+ir_node *exact_copy(const ir_node *n);
 
-#endif /* _FIRM_COMMON_IRTOOLS_H_ */
+#endif