demotool/c-opopt.hh

37 lines
1.1 KiB
C++

#pragma once
#include "c-opast.hh"
#include <ebcl/Algorithms.hh>
struct T_SyncCurves;
namespace opopt {
// Attempts to fold constant expressions into single constants. Returns true if
// transformations were made, false if not.
//
// Parameters:
// root the root node
// fixedSize the size of the output, if it is fixed
// curves the curves that will be bound to the inputs
// extVisitor a node visitor instance to be used instead of creating
// one
//
bool FoldConstants( opast::T_RootNode& root ,
T_Optional< std::pair< uint32_t , uint32_t > > fixedSize = { } ,
T_SyncCurves const* curves = nullptr ,
ebcl::T_Visitor< opast::A_Node >* extVisitor = nullptr ) noexcept;
// Attempt to remove blocks of code that will not be executed because of
// constant conditions. Returns true if transformations were made, false if not.
//
// Parameters:
// root the root node
// extVisitor a node visitor instance to be used instead of creating
// one
//
bool RemoveDeadCode( opast::T_RootNode& root ,
ebcl::T_Visitor< opast::A_Node >* extVisitor = nullptr ) noexcept;
} // namespace opopt