P4C
The P4 Compiler
|
ActionSolverBase contains basic methods and states for all solvers. More...
#include <action_constraint_solver.h>
Public Member Functions | |
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. | |
virtual Result | solve ()=0 |
return solve result. | |
Protected Member Functions | |
std::optional< Error > | check_whole_container_set_with_none_source_allocated () const |
Result | try_container_set (const ContainerID dest, const RotateClassifiedAssigns &offset_assigns) const |
std::optional< Error > | validate_input () const |
Protected Attributes | |
ordered_map< ContainerID, RotateClassifiedAssigns > | dest_assigns_i |
destination-clustered assignments. | |
bool | enable_bitmasked_set_i = true |
ordered_map< ContainerID, ContainerSpec > | specs_i |
ordered_map< ContainerID, bitvec > | src_unallocated_bits |
bits that will be written in this action but their sources have not been allcoated. | |
ActionSolverBase contains basic methods and states for all solvers.
|
virtual |
setrange on c
of src_unallocated_bits by range
. contract: DO NOT add unallocated assignment if the source can be perfectly overlaid with the destination! Example: f2<3> = f1<3>, f2 is allocated to W[0:2], and f1 is unallocated. If their liveranges are: f1: [0w, 3r], f2: [3w, 4r]. if we allocate (overlay) f2 to W[0:2], this assignment can be eliminated.
|
protected |
For all destination container c in src_unallocated_bits, that if dest_assigns_i do not have records of c, i.e., none of the sources have been allocated, check if whole container set will corrupt other live bits.
|
pure virtual |
return solve result.
Implemented in solver::ActionDarkSolver, solver::ActionMochaSolver, and solver::ActionMoveSolver.
|
protected |
try to use container set to synthesize all assignments to dest
, either (1) sources are all constants: can be merge into one constant or action data, or (2) sources are of one container: all aligned, or (3) sources are all action data. Also, We need to ensure that other allocated bits in the container will not be corrupted, i.e., all other bits of dest that are not set in this action need to be not live.
|
protected |
validate_input run misc basic checks on input, see comments in function body for details.