summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJonas Haag <jonas@lophus.org>2015-12-18 15:58:50 +0100
committerPhilipp Serrer <philipp@serrer.de>2018-01-18 17:55:54 +0100
commit4f989c0d097e1ea9997b0ca0e0c096c07126fe32 (patch)
tree18d0f440ade4afb85dd093e0ad42443598e21d81
parent5af5cf6fcde6bea4bce1cba091861bdc187ccf71 (diff)
Extend IR verifier by some X_except block checks
-rw-r--r--ir/ir/irverify.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/ir/ir/irverify.c b/ir/ir/irverify.c
index b32fdb5..e1cc17b 100644
--- a/ir/ir/irverify.c
+++ b/ir/ir/irverify.c
@@ -143,6 +143,20 @@ static bool invalid_proj(const ir_node *proj)
return false;
}
+static bool verify_fragile_node(const ir_node *n)
+{
+ int throws_exception = ir_throws_exception(n);
+ if (throws_exception && edges_activated(get_irn_irg(n))) {
+ const ir_node *const x_regular_proj = get_Proj_for_pn(n, n->op->pn_x_regular);
+ const ir_node *const x_except_proj = get_Proj_for_pn(n, n->op->pn_x_except);
+ if (x_regular_proj == NULL && x_except_proj == NULL) {
+ warn(n, "throws_exception set but no X_regular or X_except Proj found");
+ return false;
+ }
+ }
+ return true;
+}
+
static int verify_node_Proj_Start(const ir_node *p)
{
switch ((pn_Start)get_Proj_num(p)) {
@@ -605,7 +619,9 @@ static int mode_is_data_not_b(const ir_mode *mode)
static int verify_node_Call(const ir_node *n)
{
- bool fine = check_mode(n, mode_T);
+ bool fine = verify_fragile_node(n);
+
+ fine &= check_mode(n, mode_T);
fine &= check_input_mode(n, n_Call_mem, "mem", mode_M);
fine &= check_input_func(n, n_Call_ptr, "ptr", mode_is_reference, "reference");