| 1 |
// RTL SSA predicate classes -*- C++ -*- |
| 2 |
// Copyright (C) 2024-2025 Free Software Foundation, Inc. |
| 3 |
// |
| 4 |
// This file is part of GCC. |
| 5 |
// |
| 6 |
// GCC is free software; you can redistribute it and/or modify it under |
| 7 |
// the terms of the GNU General Public License as published by the Free |
| 8 |
// Software Foundation; either version 3, or (at your option) any later |
| 9 |
// version. |
| 10 |
// |
| 11 |
// GCC is distributed in the hope that it will be useful, but WITHOUT ANY |
| 12 |
// WARRANTY; without even the implied warranty of MERCHANTABILITY or |
| 13 |
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
| 14 |
// for more details. |
| 15 |
// |
| 16 |
// You should have received a copy of the GNU General Public License |
| 17 |
// along with GCC; see the file COPYING3. If not see |
| 18 |
// <http://www.gnu.org/licenses/>. |
| 19 |
|
| 20 |
namespace rtl_ssa { |
| 21 |
|
| 22 |
// Collects predicates that affect a scan over the IR, specifying what |
| 23 |
// (if anything) should be ignored. |
| 24 |
struct ignore_nothing |
| 25 |
{ |
| 26 |
// Return true if the scan should ignore the given definition |
| 27 |
// and all uses of the definition. |
| 28 |
bool should_ignore_def (const def_info *) { return false; } |
| 29 |
|
| 30 |
// Return true if the scan should ignore the given instruction. |
| 31 |
bool should_ignore_insn (const insn_info *) { return false; } |
| 32 |
}; |
| 33 |
|
| 34 |
// Predicates that ignore the instruction passed to the constructor |
| 35 |
// (and nothing else). |
| 36 |
class ignore_insn : public ignore_nothing |
| 37 |
{ |
| 38 |
public: |
| 39 |
ignore_insn (const insn_info *insn) : m_insn (insn) {} |
| 40 |
bool should_ignore_insn (const insn_info *insn) { return insn == m_insn; } |
| 41 |
|
| 42 |
private: |
| 43 |
const insn_info *m_insn; |
| 44 |
}; |
| 45 |
|
| 46 |
// Predicates that ignore all the instructions being changed by a set |
| 47 |
// of insn_changes. |
| 48 |
class ignore_changing_insns : public ignore_nothing |
| 49 |
{ |
| 50 |
public: |
| 51 |
ignore_changing_insns (array_slice<insn_change *const>); |
| 52 |
bool should_ignore_insn (const insn_info *); |
| 53 |
|
| 54 |
private: |
| 55 |
array_slice<insn_change *const> m_changes; |
| 56 |
}; |
| 57 |
|
| 58 |
} |