P4C
The P4 Compiler
 
Loading...
Searching...
No Matches
P4::Predication Class Referencefinal
Inheritance diagram for P4::Predication:

Public Member Functions

 Predication (NameGenerator *gen)
 
const IR::Node * clone (const IR::AssignmentStatement *statement)
 
const IR::Expression * clone (const IR::Expression *expression)
 
const IR::Node * postorder (IR::ExitStatement *statement) override
 
const IR::Node * postorder (IR::MethodCallStatement *statement) override
 
const IR::Node * postorder (IR::P4Action *action) override
 
const IR::Node * postorder (IR::ReturnStatement *statement) override
 
const IR::Node * preorder (IR::ArrayIndex *arrInd) override
 
const IR::Node * preorder (IR::AssignmentStatement *statement) override
 expressionReplacer is applied here and the assignment is stored in liveAssigns vector
 
const IR::Node * preorder (IR::IfStatement *statement) override
 
const IR::Node * preorder (IR::Member *member) override
 
const IR::Node * preorder (IR::P4Action *action) override
 
const IR::Node * preorder (IR::PathExpression *pathExpr) override
 

Detailed Description

This pass operates on action bodies. It converts 'if' statements to '?:' expressions, if possible. Otherwise this pass will signal an error. This pass should be used only on architectures that do not support conditionals in actions. For this to work all statements must be assignments or other ifs. if (e) a = f(b); else c = f(d); becomes (actual implementatation is slightly optimized): { a = e ? f(b) : a; c = e ? c : f(d); }