p8n_types/
guard.rs

1// Panopticon - A libre program analysis library for machine code
2// Copyright (C) 2014-2018  The Panopticon Developers
3//
4// This library is free software; you can redistribute it and/or
5// modify it under the terms of the GNU Lesser General Public
6// License as published by the Free Software Foundation; either
7// version 2.1 of the License, or (at your option) any later version.
8//
9// This library is distributed in the hope that it will be useful,
10// but WITHOUT ANY WARRANTY; without even the implied warranty of
11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12// Lesser General Public License for more details.
13//
14// You should have received a copy of the GNU Lesser General Public
15// License along with this library; if not, write to the Free Software
16// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
17
18use Variable;
19
20/// Branch condition
21#[derive(Clone,PartialEq,Eq,Debug)]
22pub enum Guard {
23    /// Guard is constant true
24    True,
25    /// Guard is constant false
26    False,
27    /// Guard depends on a one bit RREIL value.
28    Predicate {
29        /// Flag value. Must be `0` or `1`.
30        flag: Variable,
31        /// Expected value of `flag`. If `flag` is `1` and `expected` is true or if
32        /// `flag` is `1` and `expected` is true the guard is true. Otherwise its false.
33        expected: bool,
34    },
35}