aboutsummaryrefslogtreecommitdiff
path: root/gcc/gimple.h
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/gimple.h')
-rw-r--r--gcc/gimple.h34
1 files changed, 33 insertions, 1 deletions
diff --git a/gcc/gimple.h b/gcc/gimple.h
index 032365f..2688846 100644
--- a/gcc/gimple.h
+++ b/gcc/gimple.h
@@ -1667,7 +1667,8 @@ extern bool nonfreeing_call_p (gimple *);
extern bool nonbarrier_call_p (gimple *);
extern bool infer_nonnull_range (gimple *, tree);
extern bool infer_nonnull_range_by_dereference (gimple *, tree);
-extern bool infer_nonnull_range_by_attribute (gimple *, tree, tree * = NULL);
+extern bool infer_nonnull_range_by_attribute (gimple *, tree, tree * = NULL,
+ tree * = NULL);
extern void sort_case_labels (vec<tree> &);
extern void preprocess_case_label_vec_for_gimple (vec<tree> &, tree, tree *);
extern void gimple_seq_set_location (gimple_seq, location_t);
@@ -3716,6 +3717,7 @@ gimple_cond_code (const gimple *gs)
inline void
gimple_cond_set_code (gcond *gs, enum tree_code code)
{
+ gcc_gimple_checking_assert (TREE_CODE_CLASS (code) == tcc_comparison);
gs->subcode = code;
}
@@ -3875,6 +3877,21 @@ gimple_cond_true_p (const gcond *gs)
return false;
}
+/* Check if conditional statement GS is in the caonical form of 'if (1 != 0)'. */
+
+inline bool
+gimple_cond_true_canonical_p (const gcond *gs)
+{
+ tree lhs = gimple_cond_lhs (gs);
+ tree rhs = gimple_cond_rhs (gs);
+ tree_code code = gimple_cond_code (gs);
+ if (code == NE_EXPR
+ && lhs == boolean_true_node
+ && rhs == boolean_false_node)
+ return true;
+ return false;
+}
+
/* Check if conditional statement GS is of the form 'if (1 != 1)',
'if (0 != 0)', 'if (1 == 0)' or 'if (0 == 1)' */
@@ -3900,6 +3917,21 @@ gimple_cond_false_p (const gcond *gs)
return false;
}
+/* Check if conditional statement GS is in the caonical form of 'if (0 != 0)'. */
+
+inline bool
+gimple_cond_false_canonical_p (const gcond *gs)
+{
+ tree lhs = gimple_cond_lhs (gs);
+ tree rhs = gimple_cond_rhs (gs);
+ tree_code code = gimple_cond_code (gs);
+ if (code == NE_EXPR
+ && lhs == boolean_false_node
+ && rhs == boolean_false_node)
+ return true;
+ return false;
+}
+
/* Set the code, LHS and RHS of GIMPLE_COND STMT from CODE, LHS and RHS. */
inline void