+ workset_insert(ws, val, spilled[i]);
+ }
+}
+
+enum {
+ AVAILABLE_EVERYWHERE,
+ AVAILABLE_NOWHERE,
+ AVAILABLE_PARTLY,
+ AVAILABLE_UNKNOWN
+};
+
+static unsigned available_in_all_preds(workset_t* const* pred_worksets,
+ size_t n_pred_worksets,
+ const ir_node *value, bool is_local_phi)
+{
+ size_t i;
+ bool avail_everywhere = true;
+ bool avail_nowhere = true;
+
+ assert(n_pred_worksets > 0);
+
+ /* value available in all preds? */
+ for (i = 0; i < n_pred_worksets; ++i) {
+ bool found = false;
+ const workset_t *p_workset = pred_worksets[i];
+ int p_len = workset_get_length(p_workset);
+ int p_i;
+ const ir_node *l_value;
+
+ if (is_local_phi) {
+ assert(is_Phi(value));
+ l_value = get_irn_n(value, i);
+ } else {
+ l_value = value;
+ }
+
+ for (p_i = 0; p_i < p_len; ++p_i) {
+ const loc_t *p_l = &p_workset->vals[p_i];
+ if (p_l->node != l_value)
+ continue;
+
+ found = true;
+ break;
+ }
+
+ if (found) {
+ avail_nowhere = false;
+ } else {
+ avail_everywhere = false;
+ }
+ }
+
+ if (avail_everywhere) {
+ assert(!avail_nowhere);
+ return AVAILABLE_EVERYWHERE;
+ } else if (avail_nowhere) {
+ return AVAILABLE_NOWHERE;
+ } else {
+ return AVAILABLE_PARTLY;