Add is_Conv().
[libfirm] / ir / ir / irnode_t.h
index 36637da..a027d56 100644 (file)
@@ -1,24 +1,30 @@
 /*
- * Project:     libFIRM
- * File name:   ir/ir/irnode_t.h
- * Purpose:     Representation of an intermediate operation -- private header.
- * Author:      Martin Trapp, Christian Schaefer
- * Modified by: Goetz Lindenmaier, Michael Beck
- * Created:
- * CVS-ID:      $Id$
- * Copyright:   (c) 1998-2003 Universität Karlsruhe
- * Licence:     This file protected by GPL -  GNU GENERAL PUBLIC LICENSE.
+ * Copyright (C) 1995-2007 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 irnode_t.h
- *
- * Declarations of an ir node.
- *
- * @author Martin Trapp, Christian Schaefer
+ * @file
+ * @brief   Representation of an intermediate operation -- private header.
+ * @author  Martin Trapp, Christian Schaefer, Goetz Lindenmaier, Michael Beck
+ * @version $Id$
  */
-#ifndef _IRNODE_T_H_
-#define _IRNODE_T_H_
+#ifndef FIRM_IR_IRNODE_T_H
+#define FIRM_IR_IRNODE_T_H
 
 #include "firm_config.h"
 #include "irnode.h"
@@ -52,12 +58,12 @@ typedef struct {
        unsigned dead:1;            /**< If set, the block is dead (and could be replace by a Bad. */
        ir_node **graph_arr;        /**< An array to store all parameters. */
        /* Attributes holding analyses information */
-       dom_info dom;               /**< Datastructure that holds information about dominators.
+       ir_dom_info dom;            /**< Datastructure that holds information about dominators.
                                         @@@ @todo
                                         Eventually overlay with graph_arr as only valid
                                         in different phases.  Eventually inline the whole
                                         datastructure. */
-       dom_info pdom;              /**< Datastructure that holds information about post-dominators. */
+       ir_dom_info pdom;           /**< Datastructure that holds information about post-dominators. */
        ir_node ** in_cg;           /**< array with predecessors in
                                     * interprocedural_view, if they differ
                                     * from intraprocedural predecessors */
@@ -66,6 +72,7 @@ typedef struct {
        int *cg_backedge;           /**< Field n set to true if pred n is interprocedural backedge.
                                         @@@ @todo Ev. replace by bit field! */
        ir_extblk *extblk;          /**< The extended basic block this block belongs to. */
+       ir_region *region;          /**< The immediate structural region this block belongs to. */
 
        struct list_head succ_head; /**< A list head for all successor edges of a block. */
 } block_attr;
@@ -426,8 +433,12 @@ _get_irn_intra_n(const ir_node *node, int n) {
        assert(-1 <= n && n < _get_irn_intra_arity(node));
 
        nn = node->in[n + 1];
-       assert(nn != NULL);
-       if (!nn || (nn->op != op_Id)) return nn;
+       if (nn == NULL) {
+               /* only block inputs are allowed to be NULL */
+               assert(n == -1 && "NULL input of a node");
+               return NULL;
+       }
+       if (nn->op != op_Id) return nn;
 
        return (node->in[n + 1] = skip_Id(nn));
 }
@@ -660,6 +671,18 @@ _is_Quot(const ir_node *node) {
        return (_get_irn_op(node) == op_Quot);
 }
 
+static INLINE int
+_is_Add(const ir_node *node) {
+       assert(node);
+       return (_get_irn_op(node) == op_Add);
+}
+
+static INLINE int
+_is_Sub(const ir_node *node) {
+       assert(node);
+       return (_get_irn_op(node) == op_Sub);
+}
+
 static INLINE int
 _is_Start(const ir_node *node) {
        assert(node);
@@ -678,6 +701,12 @@ _is_Const(const ir_node *node) {
        return (_get_irn_op(node) == op_Const);
 }
 
+static INLINE int
+_is_Conv(const ir_node *node) {
+       assert(node);
+       return (_get_irn_op(node) == op_Conv);
+}
+
 static INLINE int
 _is_CopyB(const ir_node *node) {
        assert(node);
@@ -985,6 +1014,7 @@ static INLINE unsigned _get_irn_idx(const ir_node *node) {
 #define is_unop(node)                         _is_unop(node)
 #define is_binop(node)                        _is_binop(node)
 #define is_Const(node)                        _is_Const(node)
+#define is_Conv(node)                         _is_Conv(node)
 #define is_Unknown(node)                      _is_Unknown(node)
 #define is_Return(node)                       _is_Return(node)
 #define is_Call(node)                         _is_Call(node)
@@ -1009,6 +1039,8 @@ static INLINE unsigned _get_irn_idx(const ir_node *node) {
 #define is_Div(node)                          _is_Div(node)
 #define is_DivMod(node)                       _is_DivMod(node)
 #define is_Quot(node)                         _is_Quot(node)
+#define is_Add(node)                          _is_Add(node)
+#define is_Sub(node)                          _is_Sub(node)
 #define is_no_Block(node)                     _is_no_Block(node)
 #define is_Block(node)                        _is_Block(node)
 #define get_Block_n_cfgpreds(node)            _get_Block_n_cfgpreds(node)
@@ -1046,4 +1078,4 @@ static INLINE unsigned _get_irn_idx(const ir_node *node) {
 #define get_irn_ins_or_deps(node)             _get_irn_ins_or_deps(node)
 #define get_irn_in_or_dep(node, pos)          _get_irn_in_or_dep(node, pos)
 
-#endif /* _IRNODE_T_H_ */
+#endif