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

#include <constantFolding.h>

Public Member Functions

virtual const IR::Nodehook (Visitor &, IR::PathExpression *)
 The default hook does not modify anything.
 

Detailed Description

A policy for constant folding that allows customization of the folding. Currently we only have hook for customizing IR::PathExpression, but more can be added. Each hook takes a visitor and a node and is called from the visitor's preorder function on that node. If the hook returns a non-null value, so will the preorder. Otherwise the preorder continues with its normal processing. The hooks can be stateful, they are non-const member functions.