Added exception region attribute to blocks and confirm nodes.
authorMichael Beck <beck@ipd.info.uni-karlsruhe.de>
Sun, 3 Jun 2007 14:04:05 +0000 (14:04 +0000)
committerMichael Beck <beck@ipd.info.uni-karlsruhe.de>
Sun, 3 Jun 2007 14:04:05 +0000 (14:04 +0000)
Added is_Tuple().

[r14291]

ir/ir/irnode.c
ir/ir/irnode_t.h

index 75a7166..ad0139a 100644 (file)
@@ -846,11 +846,24 @@ void set_Block_extbb(ir_node *block, ir_extblk *extblk) {
        block->attr.block.extblk = extblk;
 }
 
+/* returns the macro block header of a block. */
 ir_node *get_Block_MacroBlock(const ir_node *block) {
        assert(is_Block(block));
        return get_irn_n(block, -1);
 }
 
+/* returns the exception region number of a Block .*/
+unsigned long get_Block_exc_region(const ir_node *block) {
+       assert(is_Block(block));
+       return block->attr.block.exc_region;
+}
+
+/* returns the graph of a Block. */
+ir_graph *get_Block_irg(const ir_node *block) {
+       assert(is_Block(block));
+       return block->attr.block.irg;
+}
+
 int
 get_End_n_keepalives(ir_node *end) {
        assert(end->op == op_End);
@@ -1915,16 +1928,6 @@ set_Proj_pred(ir_node *node, ir_node *pred) {
        set_irn_n(node, 0, pred);
 }
 
-long get_VProj_proj(const ir_node *node)
-{
-       return node->attr.proj;
-}
-
-void set_VProj_proj(ir_node *node, long value)
-{
-       node->attr.proj = value;
-}
-
 long
 get_Proj_proj(const ir_node *node) {
        assert(is_Proj(node));
@@ -1942,6 +1945,14 @@ set_Proj_proj(ir_node *node, long proj) {
        node->attr.proj = proj;
 }
 
+long get_VProj_proj(const ir_node *node) {
+       return node->attr.proj;
+}
+
+void set_VProj_proj(ir_node *node, long value) {
+       node->attr.proj = value;
+}
+
 ir_node **
 get_Tuple_preds_arr(ir_node *node) {
        assert(node->op == op_Tuple);
@@ -2005,16 +2016,25 @@ void set_Confirm_bound(ir_node *node, ir_node *bound) {
        set_irn_n(node, 0, bound);
 }
 
-pn_Cmp get_Confirm_cmp(ir_node *node) {
+pn_Cmp get_Confirm_cmp(const ir_node *node) {
        assert(node->op == op_Confirm);
-       return node->attr.confirm_cmp;
+       return node->attr.confirm.cmp;
 }
 
 void set_Confirm_cmp(ir_node *node, pn_Cmp cmp) {
        assert(node->op == op_Confirm);
-       node->attr.confirm_cmp = cmp;
+       node->attr.confirm.cmp = cmp;
+}
+
+unsigned long get_Confirm_region(const ir_node *node) {
+       assert(node->op == op_Confirm);
+       return node->attr.confirm.exc_region;
 }
 
+void set_Confirm_region(ir_node *node, unsigned long region) {
+       assert(node->op == op_Confirm);
+       node->attr.confirm.exc_region = region;
+}
 
 ir_node *
 get_Filter_pred(ir_node *node) {
@@ -2574,6 +2594,11 @@ int
        return _is_Sub(node);
 }
 
+int
+(is_Tuple)(const ir_node *node) {
+       return _is_Tuple(node);
+}
+
 int
 (is_Start)(const ir_node *node) {
   return _is_Start(node);
index ceafa6f..9929744 100644 (file)
@@ -75,6 +75,7 @@ typedef struct {
        ir_extblk *extblk;          /**< The extended basic block this block belongs to. */
        ir_region *region;          /**< The immediate structural region this block belongs to. */
        unsigned mb_depth;          /**< The macroblock depth: A distance from the macroblock header */
+       unsigned long exc_region;   /**< The exception region number for this block. */
 
        struct list_head succ_head; /**< A list head for all successor edges of a block. */
 } block_attr;
@@ -181,7 +182,11 @@ typedef struct {
 } phi0_attr;
 
 
-typedef pn_Cmp confirm_attr;    /**< Attribute to hold compare operation */
+/**< Confirm attribute. */
+typedef struct {
+       pn_Cmp cmp;                  /**< The compare operation. */
+       unsigned long exc_region;    /**< If non-null: the region for which this confirm is restricted to. */
+} confirm_attr;
 
 /** CopyB attribute. */
 typedef struct {
@@ -235,7 +240,7 @@ typedef union {
                                           Field n set to true if pred n is backedge.
                                           @todo Ev. replace by bitfield! */
        long           proj;          /**< For Proj: contains the result position to project */
-       confirm_attr   confirm_cmp;   /**< For Confirm: compare operation */
+       confirm_attr   confirm;       /**< For Confirm: compare operation and region. */
        filter_attr    filter;        /**< For Filter */
        except_attr    except;        /**< For Phi node construction in case of exceptions */
        copyb_attr     copyb;         /**< For CopyB operation */
@@ -707,6 +712,12 @@ _is_Sub(const ir_node *node) {
        return (_get_irn_op(node) == op_Sub);
 }
 
+static INLINE int
+_is_Tuple(const ir_node *node) {
+       assert(node);
+       return (_get_irn_op(node) == op_Tuple);
+}
+
 static INLINE int
 _is_Start(const ir_node *node) {
        assert(node);
@@ -1088,6 +1099,7 @@ static INLINE unsigned _get_irn_idx(const ir_node *node) {
 #define is_Quot(node)                         _is_Quot(node)
 #define is_Add(node)                          _is_Add(node)
 #define is_Sub(node)                          _is_Sub(node)
+#define is_Tuple(node)                        _is_Tuple(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)