+/**
+ * Calculate the value of a Mux: can be evaluated, if the
+ * sel and the right input are known.
+ */
+static tarval *computed_value_Mux(const ir_node *n) {
+ ir_node *sel = get_Mux_sel(n);
+ tarval *ts = value_of(sel);
+
+ if (ts == get_tarval_b_true()) {
+ ir_node *v = get_Mux_true(n);
+ return value_of(v);
+ }
+ else if (ts == get_tarval_b_false()) {
+ ir_node *v = get_Mux_false(n);
+ return value_of(v);
+ }
+ return tarval_bad;
+} /* computed_value_Mux */
+
+/**
+ * Calculate the value of a Confirm: can be evaluated,
+ * if it has the form Confirm(x, '=', Const).
+ */
+static tarval *computed_value_Confirm(const ir_node *n) {
+ /*
+ * Beware: we might produce Phi(Confirm(x == true), Confirm(x == false)).
+ * Do NOT optimize them away (CondEval wants them), so wait until
+ * remove_confirm is activated.
+ */
+ if (get_opt_remove_confirm()) {
+ if (get_Confirm_cmp(n) == pn_Cmp_Eq) {
+ tarval *tv = value_of(get_Confirm_bound(n));
+ if (tv != tarval_bad)
+ return tv;
+ }
+ }
+ return value_of(get_Confirm_value(n));
+} /* computed_value_Confirm */
+