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

#include <frontend.h>

Inheritance diagram for P4::FrontEndPolicy:
[legend]

Public Member Functions

virtual bool enableSubConstToAddTransform () const
 
virtual ConstantFoldingPolicygetConstantFoldingPolicy () const
 
virtual std::vector< DebugHookgetDebugHooks () const
 
virtual ParseAnnotationsgetParseAnnotations () const
 
virtual bool optimize (const CompilerOptions &options) const
 
virtual bool skipSideEffectOrdering () const
 
- Public Member Functions inherited from P4::RemoveUnusedPolicy
virtual RemoveUnusedDeclarationsgetRemoveUnusedDeclarationsPass (const UsedDeclSet &used, bool warn=false) const
 

Detailed Description

A customization point for frontend. The each tool can provide their own implementation of the policy that customizes its behaviour, or use instance of this class directly to provide the defaults.

Member Function Documentation

◆ enableSubConstToAddTransform()

virtual bool P4::FrontEndPolicy::enableSubConstToAddTransform ( ) const
inlinevirtual

Indicates whether to enable the a - constant to a + (-constant) in StrengthReduction.

Returns
Defaults to true.

◆ getConstantFoldingPolicy()

virtual ConstantFoldingPolicy * P4::FrontEndPolicy::getConstantFoldingPolicy ( ) const
inlinevirtual

Get policy for the constant folding pass.

See also
ConstantFoldingPolicy
Returns
Defaults to nullptr, which causes constant folding to use the default policy, which does not modify the pass defaults in any way.

◆ getDebugHooks()

virtual std::vector< DebugHook > P4::FrontEndPolicy::getDebugHooks ( ) const
inlinevirtual

Get a vector of debug hooks that will be added to frontend and all the pass managers it uses internally.

Returns
Defaults to no hooks.

◆ getParseAnnotations()

virtual ParseAnnotations * P4::FrontEndPolicy::getParseAnnotations ( ) const
inlinevirtual

A specialized instance of annotations parser for the target, or nullptr to use the default configuration.

Returns
Defaults to nullptr.

Reimplemented in BFN::FrontEndPolicy.

◆ optimize()

virtual bool P4::FrontEndPolicy::optimize ( const CompilerOptions & options) const
inlinevirtual

Indicates whether the frontend should run some optimizations (inlining, action localization, etc.).

Returns
default to enabled optimizations unless -O0 was given in the options (i.e. enabled unless options.optimizationLevel == 0).

◆ skipSideEffectOrdering()

virtual bool P4::FrontEndPolicy::skipSideEffectOrdering ( ) const
inlinevirtual

Indicates whether the side-effect-ordering pass should be skipped.

Returns
Defaults to false.

Reimplemented in BFN::FrontEndPolicy.