+static INLINE int
+_get_Block_n_cfgpreds (ir_node *node) {
+ assert(_is_Block(node));
+ return _get_irn_arity(node);
+}
+
+static INLINE ir_node *
+_get_Block_cfgpred (ir_node *node, int pos) {
+ assert(0 <= pos && pos < get_irn_arity(node));
+ assert(_is_Block(node));
+ return _get_irn_n(node, pos);
+}
+
+/* Get the predecessor block.
+ *
+ * Returns the block corresponding to the predecessor pos.
+ *
+ * There are several ambiguities we resolve with this function:
+ * - The direct predecessor can be a Proj, which is not pinned.
+ * We walk from the predecessor to the next pinned node
+ * (skip_Proj) and return the block that node is in.
+ * - If we encounter the Bad node, this function does not return
+ * Start, but the Bad node.
+ */
+static INLINE ir_node *
+_get_Block_cfgpred_block(ir_node *node, int pos) {
+ ir_node *res = skip_Proj(get_Block_cfgpred(node, pos));
+ if (!is_Bad(res))
+ res = get_nodes_block(res);
+ return res;
+}
+