19#ifndef BACKENDS_TOFINO_BF_P4C_PHV_ANALYSIS_LIVE_RANGE_SHRINKING_H_
20#define BACKENDS_TOFINO_BF_P4C_PHV_ANALYSIS_LIVE_RANGE_SHRINKING_H_
22#include "backends/tofino/bf-p4c/common/field_defuse.h"
23#include "backends/tofino/bf-p4c/common/map_tables_to_actions.h"
24#include "backends/tofino/bf-p4c/mau/table_dependency_graph.h"
25#include "backends/tofino/bf-p4c/mau/table_flow_graph.h"
26#include "backends/tofino/bf-p4c/mau/table_mutex.h"
27#include "backends/tofino/bf-p4c/phv/action_phv_constraints.h"
28#include "backends/tofino/bf-p4c/phv/analysis/dominator_tree.h"
29#include "backends/tofino/bf-p4c/phv/analysis/meta_live_range.h"
30#include "backends/tofino/bf-p4c/phv/mau_backtracker.h"
31#include "backends/tofino/bf-p4c/phv/phv_fields.h"
32#include "backends/tofino/bf-p4c/phv/pragma/pa_no_init.h"
33#include "backends/tofino/bf-p4c/phv/transforms/auto_alias.h"
34#include "backends/tofino/bf-p4c/phv/utils/utils.h"
64 bool preorder(
const IR::MAU::Table *tbl)
override;
65 bool preorder(
const IR::MAU::Action *act)
override;
69 bool ignoreDeparserUseForPacketField(
const PHV::Field *f,
76 bool summarizeUseDefs(
82 bool canInitTableReachGUnits(
const IR::MAU::Table *table,
const PHV::UnitSet &g_units)
const;
85 bool canFUsesReachInitTable(
const IR::MAU::Table *initTable,
const PHV::UnitSet &f_units)
const;
91 std::optional<const PHV::ActionSet> getInitializationCandidates(
107 bool mayViolatePackConflict(
const IR::MAU::Table *initTable,
const PHV::Field *initField,
112 std::optional<const PHV::ActionSet> getInitPointsForTable(
116 bool ignoreMutex =
false)
const;
122 bool increasesDependenceCriticalPath(
const IR::MAU::Table *use,
123 const IR::MAU::Table *init)
const;
128 bool defs =
true)
const;
138 bool filterOutMutexFields(std::vector<const PHV::Field *> &fields,
139 const ordered_map<
int, std::pair<int, int>> &livemap)
const;
142 bool cannotInitInAction(
const PHV::Container &c,
const IR::MAU::Action *action,
173 actionConstraints(a),
176 noInitPacketFields(c),
193 std::optional<PHV::Allocation::LiveRangeShrinkingMap> findInitializationNodes(
197 for (
auto &sl : alloced) {
201 BUG_CHECK(c == sl.container(),
202 "Containers for metadata overlay candidates are different");
206 "Container candidate for metadata overlay cannot be NULL.");
210 std::optional<PHV::Allocation::LiveRangeShrinkingMap> findInitializationNodes(
215 candidates.insert(alloced.begin(), alloced.end());
216 candidates.insert(slice);
217 return findInitializationNodes(candidates, alloc, container_state);
Definition action_phv_constraints.h:107
Definition dominator_tree.h:32
Definition auto_alias.h:27
Definition live_range_shrinking.h:38
std::optional< PHV::Allocation::LiveRangeShrinkingMap > findInitializationNodes(const PHV::Container c, const ordered_set< PHV::AllocSlice > &alloced, const PHV::Transaction &alloc, const PHV::Allocation::MutuallyLiveSlices &container_state) const
Definition live_range_shrinking.cpp:611
cstring printLiveRangeShrinkingMap(const PHV::Allocation::LiveRangeShrinkingMap &m, cstring indent) const
Definition live_range_shrinking.cpp:1079
Definition live_range_shrinking.h:183
cstring printLiveRangeShrinkingMap(const PHV::Allocation::LiveRangeShrinkingMap &m, cstring indent) const
Definition live_range_shrinking.h:222
Definition map_tables_to_actions.h:29
Definition mau_backtracker.h:29
Definition ir/pass_manager.h:40
Definition ordered_map.h:32
Definition ordered_set.h:32
Definition slice_alloc.h:136
Definition phv_fields.h:154
Definition phv/utils/utils.h:561
Definition phv_fields.h:1095
Definition mau/table_mutex.h:110
Adds the no_init pragma to the specified fields with the specified gress.
Definition pa_no_init.h:35
Definition field_defuse.h:77
Definition table_dependency_graph.h:52