add *_Block_mark() api to mark easily Blocks in the graph
authorMichael Beck <beck@ipd.info.uni-karlsruhe.de>
Mon, 26 May 2008 13:37:27 +0000 (13:37 +0000)
committerMichael Beck <beck@ipd.info.uni-karlsruhe.de>
Mon, 26 May 2008 13:37:27 +0000 (13:37 +0000)
[r19773]

include/libfirm/irgraph.h
ir/ir/irgraph.c
ir/ir/irnode_t.h
ir/ir/irtypes.h

index 9dcb996..6187d51 100644 (file)
@@ -521,16 +521,22 @@ int  using_irn_visited(const ir_graph *irg);
 void set_using_irn_link(ir_graph *irg);
 void clear_using_irn_link(ir_graph *irg);
 int  using_irn_link(const ir_graph *irg);
+void set_using_block_mark(ir_graph *irg);
+void clear_using_block_mark(ir_graph *irg);
+int  using_block_mark(const ir_graph *irg);
 #else
-static INLINE void set_using_block_visited(ir_graph *irg) { (void) irg; }
-static INLINE void clear_using_block_visited(ir_graph *irg) { (void) irg; }
-static INLINE int using_block_visited(const ir_graph *irg) { (void) irg; return 0; }
-static INLINE void set_using_irn_visited(ir_graph *irg) { (void) irg; }
-static INLINE void clear_using_irn_visited(ir_graph *irg) { (void) irg; }
-static INLINE int using_irn_visited(const ir_graph *irg) { (void) irg; return 0; }
-static INLINE void set_using_irn_link(ir_graph *irg) { (void) irg; }
-static INLINE void clear_using_irn_link(ir_graph *irg) { (void) irg; }
-static INLINE int using_irn_link(const ir_graph *irg) { (void) irg; return 0; }
+#define set_using_block_visited(irg)
+#define clear_using_block_visited(irg)
+#define using_block_visited(irg)        0
+#define set_using_irn_visited(irg)
+#define clear_using_irn_visited(irg)
+#define using_irn_visited(irg)          0
+#define set_using_irn_link(irg)
+#define clear_using_irn_link(irg)
+#define using_irn_link(irg)             0
+#define set_using_block_mark(irg)
+#define clear_using_block_mark(irg)
+#define using_block_mark(irg)           0
 #endif
 
 /** Normalization: Move Proj nodes into the same block as its predecessors */
index b645db8..9f93e14 100644 (file)
@@ -1084,7 +1084,21 @@ void clear_using_irn_link(ir_graph *irg) {
 int using_irn_link(const ir_graph *irg) {
        return irg->using_irn_link;
 }
-#endif
+
+void set_using_block_mark(ir_graph *irg) {
+       assert(irg->using_block_mark == 0);
+       irg->using_block_mark = 1;
+}
+
+void clear_using_block_mark(ir_graph *irg) {
+       assert(irg->using_block_mark == 1);
+       irg->using_block_mark = 0;
+}
+
+int using_block_mark(const ir_graph *irg) {
+       return irg->using_block_mark;
+}
+#endif /* NDEBUG */
 
 /* Returns a estimated node count of the irg. */
 unsigned (get_irg_estimated_node_cnt)(const ir_graph *irg) {
index c85f09d..64c2193 100644 (file)
@@ -959,6 +959,19 @@ _add_Block_phi(ir_node *block, ir_node *phi) {
        _set_Block_phis(block, phi);
 }
 
+/** Get the Block mark (single bit). */
+static INLINE unsigned
+_get_Block_mark(const ir_node *block) {
+       assert(_is_Block(block));
+       return block->attr.block.marked;
+}
+
+/** Set the Block mark (single bit). */
+static INLINE void
+_set_Block_mark(ir_node *block, unsigned mark) {
+       assert(_is_Block(block));
+       block->attr.block.marked = mark;
+}
 
 /* this section MUST contain all inline functions */
 #define is_ir_node(thing)                     _is_ir_node(thing)
@@ -1080,7 +1093,9 @@ _add_Block_phi(ir_node *block, ir_node *phi) {
 
 #define set_Block_phis(block, phi)            _set_Block_phis(block, phi)
 #define get_Block_phis(block)                 _get_Block_phis(block)
-#define add_Block_phi(block, phi)             _add_block_phi(block, phi)
+#define add_Block_phi(block, phi)             _add_Block_phi(block, phi)
+#define get_Block_mark(block)                 _get_Block_mark(block)
+#define set_Block_mark(block, mark)           _set_Block_mark(block, mark)
 
 #define set_Phi_next(node, phi)               _set_Phi_next(node, phi)
 #define get_Phi_next(node)                    _get_Phi_next(node)
index 52dd2a2..11c5471 100644 (file)
@@ -126,6 +126,7 @@ typedef struct {
        unsigned is_dead:1;         /**< If set, the block is dead (and could be replace by a Bad. */
        unsigned is_mb_head:1;      /**< Set if this block is a macroblock head. */
        unsigned has_label:1;       /**< Set if this block has a label assigned. */
+       unsigned marked:1;          /**< Can be set/unset to temporary mark a block. */
        ir_node **graph_arr;        /**< An array to store all parameters. */
        /* Attributes holding analyses information */
        ir_dom_info dom;            /**< Datastructure that holds information about dominators.
@@ -502,6 +503,7 @@ struct ir_graph {
        unsigned using_irn_visited   : 1;  /**< set to 1 if we are currently using the visited flag */
        unsigned using_block_visited : 1;  /**< set to 1 if we are currently using the block_visited flag */
        unsigned using_irn_link      : 1;  /**< set to 1 if we are currently using the irn_link fields */
+       unsigned using_block_mark    : 1;  /**< set to 1 if we are currently using the block mark flags */
 #endif
 };