| 1 |
/* Everything defined here is used for representing conditions for bits |
| 2 |
and their status. |
| 3 |
Copyright (C) 2022-2025 Free Software Foundation, Inc. |
| 4 |
Contributed by Matevos Mehrabyan <[email protected]> |
| 5 |
|
| 6 |
This file is part of GCC. |
| 7 |
|
| 8 |
GCC is free software; you can redistribute it and/or modify it under |
| 9 |
the terms of the GNU General Public License as published by the Free |
| 10 |
Software Foundation; either version 3, or (at your option) any later |
| 11 |
version. |
| 12 |
|
| 13 |
GCC is distributed in the hope that it will be useful, but WITHOUT ANY |
| 14 |
WARRANTY; without even the implied warranty of MERCHANTABILITY or |
| 15 |
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
| 16 |
for more details. |
| 17 |
|
| 18 |
You should have received a copy of the GNU General Public License |
| 19 |
along with GCC; see the file COPYING3. If not see |
| 20 |
<http://www.gnu.org/licenses/>. */ |
| 21 |
|
| 22 |
#include "sym-exec-condition.h" |
| 23 |
|
| 24 |
/* Constructor where the first argument is the bit left to the condition sign, |
| 25 |
the second argument is the bit right to the condition sign and the third |
| 26 |
argument is the code of the condition. */ |
| 27 |
|
| 28 |
bit_condition::bit_condition (value_bit *left, value_bit *right, tree_code code) |
| 29 |
{ |
| 30 |
this->m_left = left; |
| 31 |
this->m_right = right; |
| 32 |
this->m_code = code; |
| 33 |
m_type = BIT_CONDITION; |
| 34 |
} |
| 35 |
|
| 36 |
|
| 37 |
/* Copy constructor. */ |
| 38 |
|
| 39 |
bit_condition::bit_condition (const bit_condition &expr) |
| 40 |
{ |
| 41 |
bit_expression::copy (&expr); |
| 42 |
m_code = expr.get_code (); |
| 43 |
} |
| 44 |
|
| 45 |
|
| 46 |
/* Returns the condition's code. */ |
| 47 |
|
| 48 |
tree_code |
| 49 |
bit_condition::get_code () const |
| 50 |
{ |
| 51 |
return m_code; |
| 52 |
} |
| 53 |
|
| 54 |
|
| 55 |
/* Returns a copy of the condition. */ |
| 56 |
|
| 57 |
value_bit * |
| 58 |
bit_condition::copy () const |
| 59 |
{ |
| 60 |
return new bit_condition (*this); |
| 61 |
} |
| 62 |
|
| 63 |
|
| 64 |
/* Prints the condition's sign. */ |
| 65 |
|
| 66 |
void |
| 67 |
bit_condition::print_expr_sign () |
| 68 |
{ |
| 69 |
switch (m_code) |
| 70 |
{ |
| 71 |
case GT_EXPR: |
| 72 |
fprintf (dump_file, " > "); |
| 73 |
break; |
| 74 |
case LT_EXPR: |
| 75 |
fprintf (dump_file, " < "); |
| 76 |
break; |
| 77 |
case EQ_EXPR: |
| 78 |
fprintf (dump_file, " == "); |
| 79 |
break; |
| 80 |
case NE_EXPR: |
| 81 |
fprintf (dump_file, " != "); |
| 82 |
break; |
| 83 |
default: |
| 84 |
fprintf (dump_file, " ? "); |
| 85 |
} |
| 86 |
} |