+/**
+ * Returns the result proj of the call, or NULL if the result is not used
+ */
+static ir_node *get_call_result_proj(ir_node *call)
+{
+ const ir_edge_t *edge;
+ ir_node *resproj = NULL;
+
+ /* search the result proj */
+ foreach_out_edge(call, edge) {
+ ir_node *proj = get_edge_src_irn(edge);
+ long pn = get_Proj_proj(proj);
+
+ if(pn == pn_be_Call_first_res) {
+ resproj = proj;
+ break;
+ }
+ }
+ if(resproj == NULL) {
+ return NULL;
+ }
+
+ /* the result proj is connected to a Keep and maybe other nodes */
+ foreach_out_edge(resproj, edge) {
+ ir_node *pred = get_edge_src_irn(edge);
+ if(!be_is_Keep(pred)) {
+ return resproj;
+ }
+ }
+
+ /* only be_Keep found, so result is not used */
+ return NULL;
+}
+