From: Brian Norris Date: Sun, 29 Apr 2012 19:57:05 +0000 (-0700) Subject: model: add is_acquire() and is_release() helper functions X-Git-Tag: pldi2013~483 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=34a8b735d1de5aafa72277a40ee3280efc32cd4a;p=model-checker.git model: add is_acquire() and is_release() helper functions --- diff --git a/model.cc b/model.cc index f070910..84b296e 100644 --- a/model.cc +++ b/model.cc @@ -261,6 +261,30 @@ bool ModelAction::is_write() return type == ATOMIC_WRITE; } +bool ModelAction::is_acquire() +{ + switch (order) { + case memory_order_acquire: + case memory_order_acq_rel: + case memory_order_seq_cst: + return true; + default: + return false; + } +} + +bool ModelAction::is_release() +{ + switch (order) { + case memory_order_release: + case memory_order_acq_rel: + case memory_order_seq_cst: + return true; + default: + return false; + } +} + bool ModelAction::same_var(ModelAction *act) { return location == act->location; diff --git a/model.h b/model.h index 4472c5b..d04fa62 100644 --- a/model.h +++ b/model.h @@ -39,6 +39,8 @@ public: bool is_read(); bool is_write(); + bool is_acquire(); + bool is_release(); bool same_var(ModelAction *act); bool same_thread(ModelAction *act); bool is_dependent(ModelAction *act);