P4C
The P4 Compiler
Loading...
Searching...
No Matches
solver::ActionMoveSolver Class Reference

#include <action_constraint_solver.h>

Inheritance diagram for solver::ActionMoveSolver:
[legend]

Public Member Functions

Result solve () override
 return solve result.
 
- Public Member Functions inherited from solver::ActionSolverBase
virtual void add_assign (const Operand &dst, Operand src)
 add an assignment from the action.
 
virtual void add_src_unallocated_assign (const ContainerID &c, const le_bitrange &range)
 
virtual void clear ()
 clear all states and will reset enable_bitmasked_set to true.
 
void enable_bitmasked_set (bool enable)
 set true to enable bitmasked_set set, otherwise disable. default: enable.
 
virtual void set_container_spec (ContainerID id, int size, bitvec live)
 set_container_spec will update the container spec.
 

Additional Inherited Members

- Protected Member Functions inherited from solver::ActionSolverBase
std::optional< Errorcheck_whole_container_set_with_none_source_allocated () const
 
Result try_container_set (const ContainerID dest, const RotateClassifiedAssigns &offset_assigns) const
 
std::optional< Errorvalidate_input () const
 
- Protected Attributes inherited from solver::ActionSolverBase
ordered_map< ContainerID, RotateClassifiedAssignsdest_assigns_i
 destination-clustered assignments.
 
bool enable_bitmasked_set_i = true
 
ordered_map< ContainerID, ContainerSpecspecs_i
 
ordered_map< ContainerID, bitvecsrc_unallocated_bits
 bits that will be written in this action but their sources have not been allcoated.
 

Detailed Description

ActionMoveSolver check move-based instruction constraints for one action, i.e., one solver per action. Internally, a symbolic_bitvec solver is applied on every destination container to verify the possibility of instruction synthesis. This class is designed to be isolated from any concrete backend types, i.e. it's a pure math model that can be easily tested. premise:

  1. All the input of container slice must have been split to the extent that all instructions are sourcing or assigning to a container slice.
  2. Any instruction operand is a container slice.
  3. Container-group constraint has been taken care of by caller.
  4. Destination can only be a normal container. Supported move instructions:
  • deposit-field: dest = ((src1 << shift) & mask) | (src2 & ~mask)
  • bitmasked-set: dest = (src1 & mask) | (src2 & ~mask)
  • byte-rotate-merge: dest = ((src1 << src1_shift) & mask) | ((src2 << src2_shift) & ~mask)

Member Function Documentation

◆ solve()

Result solver::ActionMoveSolver::solve ( )
overridevirtual

return solve result.

Implements solver::ActionSolverBase.