+/* This program is free software; you can redistribute it and/or modify it
+ * under the terms of the license (GNU LGPL) which comes with this package. */
+
+#include "mc_private.h"
+
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_request, mc,
+ "Logging specific to MC (request)");
+
+static char* pointer_to_string(void* pointer);
+static char* buff_size_to_string(size_t size);
+
+int MC_request_depend(smx_simcall_t r1, smx_simcall_t r2) {
+ if(mc_reduce_kind == e_mc_reduce_none)
+ return TRUE;
+
+ if (r1->issuer == r2->issuer)
+ return FALSE;
+
+ if(r1->call == SIMCALL_COMM_ISEND && r2->call == SIMCALL_COMM_IRECV)
+ return FALSE;
+
+ if(r1->call == SIMCALL_COMM_IRECV && r2->call == SIMCALL_COMM_ISEND)
+ return FALSE;
+
+ /*if( (r1->call == SIMCALL_COMM_ISEND || r1->call == SIMCALL_COMM_IRECV)
+ && r2->call == SIMCALL_COMM_WAIT){
+
+ if(simcall_comm_wait__get__comm(r2)->comm.rdv == NULL)
+ return FALSE;
+
+ smx_rdv_t rdv = r1->call == SIMCALL_COMM_ISEND ? simcall_comm_isend__get__rdv(r1) : simcall_comm_irecv__get__rdv(r1);
+
+ if(simcall_comm_wait__get__comm(r2)->comm.rdv != rdv)
+ return FALSE;
+
+ if(simcall_comm_wait__get__comm(r2)->comm.type == SIMIX_COMM_SEND && r1->call == SIMCALL_COMM_ISEND)
+ return FALSE;
+
+ if(simcall_comm_wait__get__comm(r2)->comm.type == SIMIX_COMM_RECEIVE && r1->call == SIMCALL_COMM_IRECV)
+ return FALSE;
+ }
+
+ if( (r2->call == SIMCALL_COMM_ISEND || r2->call == SIMCALL_COMM_IRECV)
+ && r1->call == SIMCALL_COMM_WAIT){
+
+ if(simcall_comm_wait__get__comm(r1)->comm.rdv != NULL)
+ return FALSE;
+
+ smx_rdv_t rdv = r2->call == SIMCALL_COMM_ISEND ? simcall_comm_isend__get__rdv(r2) : simcall_comm_irecv__get__rdv(r2);
+
+ if(simcall_comm_wait__get__comm(r1)->comm.rdv != rdv)
+ return FALSE;
+
+ if(simcall_comm_wait__get__comm(r1)->comm.type == SIMIX_COMM_SEND && r2->call == SIMCALL_COMM_ISEND)
+ return FALSE;
+
+ if(simcall_comm_wait__get__comm(r1)->comm.type == SIMIX_COMM_RECEIVE && r2->call == SIMCALL_COMM_IRECV)
+ return FALSE;
+ }*/
+
+ /* FIXME: the following rule assumes that the result of the
+ * isend/irecv call is not stored in a buffer used in the
+ * test call. */
+ /*if( (r1->call == SIMCALL_COMM_ISEND || r1->call == SIMCALL_COMM_IRECV)
+ && r2->call == SIMCALL_COMM_TEST)
+ return FALSE;*/
+
+ /* FIXME: the following rule assumes that the result of the
+ * isend/irecv call is not stored in a buffer used in the
+ * test call.*/
+ /*if( (r2->call == SIMCALL_COMM_ISEND || r2->call == SIMCALL_COMM_IRECV)
+ && r1->call == SIMCALL_COMM_TEST)
+ return FALSE;*/
+
+ if(r1->call == SIMCALL_COMM_ISEND && r2->call == SIMCALL_COMM_ISEND
+ && simcall_comm_isend__get__rdv(r1) != simcall_comm_isend__get__rdv(r2))
+ return FALSE;
+
+ if(r1->call == SIMCALL_COMM_IRECV && r2->call == SIMCALL_COMM_IRECV
+ && simcall_comm_irecv__get__rdv(r1) != simcall_comm_irecv__get__rdv(r2))
+ return FALSE;
+
+ if(r1->call == SIMCALL_COMM_WAIT && (r2->call == SIMCALL_COMM_WAIT || r2->call == SIMCALL_COMM_TEST)
+ && (simcall_comm_wait__get__comm(r1)->comm.src_proc == NULL
+ || simcall_comm_wait__get__comm(r1)->comm.dst_proc == NULL))
+ return FALSE;
+
+ if(r2->call == SIMCALL_COMM_WAIT && (r1->call == SIMCALL_COMM_WAIT || r1->call == SIMCALL_COMM_TEST)
+ && (simcall_comm_wait__get__comm(r2)->comm.src_proc == NULL
+ || simcall_comm_wait__get__comm(r2)->comm.dst_proc == NULL))
+ return FALSE;
+
+ if(r1->call == SIMCALL_COMM_WAIT && r2->call == SIMCALL_COMM_WAIT
+ && simcall_comm_wait__get__comm(r1)->comm.src_buff == simcall_comm_wait__get__comm(r2)->comm.src_buff
+ && simcall_comm_wait__get__comm(r1)->comm.dst_buff == simcall_comm_wait__get__comm(r2)->comm.dst_buff)