summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJonas Haag <jonas@lophus.org>2016-02-03 00:56:23 +0100
committerPhilipp Serrer <philipp@serrer.de>2018-01-18 17:53:15 +0100
commit604aa61deca7d6691decbfccfe952dc08bb08b3a (patch)
tree2194bfd40eae73ef8934dff7bd8d9bbc50c07b47
parent7e449d39a340098673ecd2bf1da2657e05a5cef4 (diff)
Add is_Block_end_block helper
-rw-r--r--include/libfirm/irnode.h3
-rw-r--r--ir/ir/irnode.c6
2 files changed, 9 insertions, 0 deletions
diff --git a/include/libfirm/irnode.h b/include/libfirm/irnode.h
index c4733a4..615df9c 100644
--- a/include/libfirm/irnode.h
+++ b/include/libfirm/irnode.h
@@ -172,6 +172,9 @@ FIRM_API void set_nodes_block(ir_node *node, ir_node *block);
*/
FIRM_API ir_node *get_Block_cfgpred_block(const ir_node *node, int pos);
+/** Return true if block is its contain irg's end block. */
+FIRM_API int is_Block_end_block(const ir_node *block);
+
/** Returns the matured flag of a block */
FIRM_API int get_Block_matured(const ir_node *block);
/** set the matured flag of a block. */
diff --git a/ir/ir/irnode.c b/ir/ir/irnode.c
index 37b0a4d..5d38ca4 100644
--- a/ir/ir/irnode.c
+++ b/ir/ir/irnode.c
@@ -357,6 +357,12 @@ ir_node *(get_Block_cfgpred_block)(const ir_node *node, int pos)
return get_Block_cfgpred_block_(node, pos);
}
+int is_Block_end_block(const ir_node *const block)
+{
+ assert(is_Block(block));
+ return get_irg_end_block(get_irn_irg(block)) == block;
+}
+
int get_Block_matured(const ir_node *node)
{
assert(is_Block(node));