P4C
The P4 Compiler
Loading...
Searching...
No Matches
PHV::ConcreteAllocation Class Reference
Inheritance diagram for PHV::ConcreteAllocation:
[legend]

Public Member Functions

 ConcreteAllocation (const PhvInfo &, const PhvUse &, bool trivial=false)
 
const_iterator begin () const override
 Iterate through container-->allocation slices.
 
bool contains (PHV::Container c) const override
 
void deallocate (const ordered_set< PHV::AllocSlice > &slices)
 
const_iterator end () const override
 
void foreach_slice (const PHV::Field *f, std::function< void(const AllocSlice &)> cb) const override
 
const ContainerStatusgetStatus (const PHV::Container &c) const override
 
FieldStatus getStatus (const PHV::Field *f) const override
 
size_t size () const override
 
- Public Member Functions inherited from PHV::Allocation
void addARAedge (gress_t grs, const IR::MAU::Table *src, const IR::MAU::Table *dst) const
 Add a pair of tables in the ara_edges for a new ARA table.
 
bool addDarkAllocation (const AllocSlice &slice)
 
virtual void addMetadataInitialization (AllocSlice slice, LiveRangeShrinkingMap initNodes)
 
virtual ContainerAllocStatus alloc_status (PHV::Container c) const
 
virtual void allocate (const AllocSlice slice, LiveRangeShrinkingMap *initNodes=nullptr, bool singleGressParserGroup=false)
 
std::set< AvailableSpotavailable_spots () const
 Return a set of available spots of this allocation.
 
virtual MutuallyLiveSlices byteSlicesByLiveness (const PHV::Container c, const AllocSlice &sl, const PragmaNoInit &noInit) const
 
Transactionclone (const Allocation &parent) const
 Extract the child from the parent transaction and return a cloned version of the difference.
 
cstring commit (Transaction &view)
 
virtual GressAssignment deparserGroupGress (PHV::Container c) const
 
int empty_containers (PHV::Size size) const
 
void foreach_slice (const PHV::Field *f, le_bitrange range, int stage, PHV::FieldUse access, std::function< void(const AllocSlice &)> cb) const
 
void foreach_slice (const PHV::Field *f, le_bitrange range, std::function< void(const AllocSlice &)> cb) const
 
void foreach_slice (PHV::Container c, int stage, PHV::FieldUse access, std::function< void(const AllocSlice &)> cb) const
 
void foreach_slice (PHV::Container c, le_bitrange range, int stage, PHV::FieldUse access, std::function< void(const AllocSlice &)> cb) const
 
void foreach_slice (PHV::Container c, le_bitrange range, std::function< void(const AllocSlice &)> cb) const
 
void foreach_slice (PHV::Container c, std::function< void(const AllocSlice &)> cb) const
 
const ordered_map< gress_t, ordered_map< const IR::MAU::Table *, std::set< const IR::MAU::Table * > > > & getARAedges () const
 
virtual std::optional< ActionSetgetInitPoints (const AllocSlice &slice) const
 
virtual ActionSet getInitPointsForField (const PHV::Field *f) const
 
virtual const ordered_set< const PHV::Field * > getMetadataInits (const IR::MAU::Action *act) const
 
const ordered_map< const IR::BFN::ParserState *, std::set< PHV::Container > > & getParserStateToContainers (const PhvInfo &phv, const MapFieldToParserStates &field_to_parser_states) const
 
const ordered_set< unsigned > getTagalongCollectionsUsed () const
 
virtual GressAssignment gress (const PHV::Container &c) const
 
virtual bool isDarkReadAvailable (PHV::Container c, unsigned minStage, unsigned maxStage) const
 
virtual bool isDarkWriteAvailable (PHV::Container c, unsigned minStage, unsigned maxStage) const
 
virtual MutuallyLiveSlices liverange_overlapped_slices (const PHV::Container c, const std::vector< AllocSlice > &slices) const
 
virtual Transaction makeTransaction () const
 Create a Transaction based on this Allocation.
 
virtual ExtractSource parserExtractGroupSource (PHV::Container c) const
 
virtual GressAssignment parserGroupGress (PHV::Container c) const
 
std::string printARAedges () const
 
virtual void removeAllocatedSlice (const ordered_set< PHV::AllocSlice > &slices)
 
ordered_set< PHV::AllocSliceslices (const PHV::Field *f) const
 
ordered_set< PHV::AllocSliceslices (const PHV::Field *f, int stage, PHV::FieldUse access) const
 
ordered_set< PHV::AllocSliceslices (const PHV::Field *f, le_bitrange range) const
 
ordered_set< PHV::AllocSliceslices (const PHV::Field *f, le_bitrange range, int stage, PHV::FieldUse access) const
 
ordered_set< AllocSliceslices (PHV::Container c) const
 
ordered_set< AllocSliceslices (PHV::Container c, int stage, PHV::FieldUse access) const
 
ordered_set< AllocSliceslices (PHV::Container c, le_bitrange range) const
 
ordered_set< AllocSliceslices (PHV::Container c, le_bitrange range, int stage, PHV::FieldUse access) const
 
virtual MutuallyLiveSlices slicesByLiveness (const PHV::Container c, const AllocSlice &sl) const
 
virtual MutuallyLiveSlices slicesByLiveness (const PHV::Container c, std::vector< AllocSlice > &slices) const
 
virtual std::vector< MutuallyLiveSlicesslicesByLiveness (PHV::Container c) const
 
virtual cstring toString () const
 

Additional Inherited Members

- Public Types inherited from PHV::Allocation
using ConditionalConstraint = ordered_map<PHV::FieldSlice, ConditionalConstraintData>
 
using ConditionalConstraints = ordered_map<int, ConditionalConstraint>
 
using const_iterator = ordered_map<PHV::Container, ContainerStatus>::const_iterator
 
enum class  ContainerAllocStatus { EMPTY , PARTIAL , FULL }
 
enum class  ExtractSource { NONE , PACKET , NON_PACKET }
 
using FieldStatus = ordered_set<AllocSlice>
 
using GressAssignment = std::optional<gress_t>
 
using LiveRangeShrinkingMap = ordered_map<const PHV::Field *, ActionSet>
 
using MutuallyLiveSlices = ordered_set<AllocSlice>
 
- Protected Member Functions inherited from PHV::Allocation
 Allocation (const PhvInfo &phv, const PhvUse &uses, bool isTrivial=false)
 
ordered_map< AllocSlice, ActionSet > & get_meta_init_points () const
 
- Protected Attributes inherited from PHV::Allocation
ordered_map< gress_t, ordered_map< const IR::MAU::Table *, std::set< const IR::MAU::Table * > > > ara_edges
 
ordered_map< PHV::Container, ContainerStatuscontainer_status_i
 
assoc::hash_map< PHV::Size, ordered_map< ContainerAllocStatus, int > > count_by_status_i
 
ordered_map< PHV::Container, bitvecdark_containers_read_allocated_i
 
ordered_map< PHV::Container, bitvecdark_containers_write_allocated_i
 
ordered_map< const PHV::Field *, FieldStatusfield_status_i
 
DarkInitMap init_map_i
 Initialization information about allocating to dark containers during certain stages.
 
ordered_map< const IR::MAU::Action *, ordered_set< const PHV::Field * > > init_writes_i
 
bool isTrivial
 
ordered_map< AllocSlice, ActionSetmeta_init_points_i
 
const PhvInfophv_i
 
ordered_map< const IR::BFN::ParserState *, std::set< PHV::Container > > state_to_containers_i
 parser state to containers
 
const PhvUseuses_i
 

Constructor & Destructor Documentation

◆ ConcreteAllocation()

PHV::ConcreteAllocation::ConcreteAllocation ( const PhvInfo & phv,
const PhvUse & uses,
bool trivial = false )
explicit
Returns
an allocation initialized with the containers present in Device::phvSpec, with the gress set for any hard-wired containers, but no slices allocated.

Member Function Documentation

◆ begin()

const_iterator PHV::ConcreteAllocation::begin ( ) const
inlineoverridevirtual

Iterate through container-->allocation slices.

Implements PHV::Allocation.

◆ contains()

bool PHV::ConcreteAllocation::contains ( PHV::Container c) const
overridevirtual
Returns
true if this allocation owns c.

Implements PHV::Allocation.

◆ deallocate()

void PHV::ConcreteAllocation::deallocate ( const ordered_set< PHV::AllocSlice > & slices)

This is the more correct implementation of removing allocated slices that will also reset container gress, including container, parser, deparser gress. It is only allowed in concrete allocation.

◆ end()

const_iterator PHV::ConcreteAllocation::end ( ) const
inlineoverridevirtual

Implements PHV::Allocation.

◆ foreach_slice()

void PHV::ConcreteAllocation::foreach_slice ( const PHV::Field * f,
std::function< void(const AllocSlice &)> cb ) const
overridevirtual

Implements PHV::Allocation.

◆ getStatus() [1/2]

const PHV::Allocation::ContainerStatus * PHV::ConcreteAllocation::getStatus ( const PHV::Container & c) const
overridevirtual

Uniform abstraction for accessing a container state.

Returns
the ContainerStatus of this allocation, if present. Failing that, check its ancestors. If has no status yet, return nullptr.

Implements PHV::Allocation.

◆ getStatus() [2/2]

PHV::Allocation::FieldStatus PHV::ConcreteAllocation::getStatus ( const PHV::Field * f) const
overridevirtual

Uniform abstraction for accessing field state.

Returns
the FieldStatus of this allocation, if present. Failing that, check its ancestors. If f has no status yet, return an empty FieldStatus.

Implements PHV::Allocation.

◆ size()

size_t PHV::ConcreteAllocation::size ( ) const
inlineoverridevirtual
Returns
number of containers owned by this allocation.

Implements PHV::Allocation.