|
|
| DoConstantFolding (const ReferenceMap *refMap, const TypeMap *typeMap, bool warnings=true, ConstantFoldingPolicy *policy=nullptr) |
| |
|
const IR::Node * | postorder (IR::Add *e) override |
| |
|
const IR::Node * | postorder (IR::AddSat *e) override |
| |
|
const IR::Node * | postorder (IR::BAnd *e) override |
| |
|
const IR::Node * | postorder (IR::BOr *e) override |
| |
|
const IR::Node * | postorder (IR::BXor *e) override |
| |
|
const IR::Node * | postorder (IR::Cast *e) override |
| |
|
const IR::Node * | postorder (IR::Cmpl *e) override |
| |
|
const IR::Node * | postorder (IR::Concat *e) override |
| |
|
const IR::Node * | postorder (IR::Declaration_Constant *d) override |
| |
|
const IR::Node * | postorder (IR::Div *e) override |
| |
|
const IR::Node * | postorder (IR::Equ *e) override |
| |
|
const IR::Node * | postorder (IR::Geq *e) override |
| |
|
const IR::Node * | postorder (IR::Grt *e) override |
| |
|
const IR::Node * | postorder (IR::IfStatement *statement) override |
| |
|
const IR::Node * | postorder (IR::LAnd *e) override |
| |
|
const IR::Node * | postorder (IR::Leq *e) override |
| |
|
const IR::Node * | postorder (IR::LNot *e) override |
| |
|
const IR::Node * | postorder (IR::LOr *e) override |
| |
|
const IR::Node * | postorder (IR::Lss *e) override |
| |
|
const IR::Node * | postorder (IR::Member *e) override |
| |
|
const IR::Node * | postorder (IR::Mod *e) override |
| |
|
const IR::Node * | postorder (IR::Mul *e) override |
| |
|
const IR::Node * | postorder (IR::Mux *e) override |
| |
|
const IR::Node * | postorder (IR::Neg *e) override |
| |
|
const IR::Node * | postorder (IR::Neq *e) override |
| |
|
const IR::Node * | postorder (IR::PathExpression *e) override |
| |
|
const IR::Node * | postorder (IR::SelectExpression *e) override |
| |
|
const IR::Node * | postorder (IR::Shl *e) override |
| |
|
const IR::Node * | postorder (IR::Shr *e) override |
| |
|
const IR::Node * | postorder (IR::Slice *e) override |
| |
|
const IR::Node * | postorder (IR::Sub *e) override |
| |
|
const IR::Node * | postorder (IR::SubSat *e) override |
| |
|
const IR::Node * | postorder (IR::Type_Bits *type) override |
| |
|
const IR::Node * | postorder (IR::Type_Varbits *type) override |
| |
|
const IR::Node * | postorder (IR::UPlus *e) override |
| |
|
const IR::Node * | preorder (IR::ArrayIndex *e) override |
| |
|
const IR::Node * | preorder (IR::AssignmentStatement *statement) override |
| |
|
const IR::BlockStatement * | preorder (IR::BlockStatement *bs) override |
| |
|
|
const IR::Node * | binary (const IR::Operation_Binary *op, std::function< big_int(big_int, big_int)> func, bool saturating=false) |
| | Statically evaluate binary operation e implemented by func.
|
| |
|
const IR::Constant * | cast (const IR::Constant *node, unsigned base, const IR::Type_Bits *type) const |
| | Statically cast constant node to type represented in the specified base.
|
| |
| const IR::Node * | compare (const IR::Operation_Binary *op) |
| |
| const IR::Expression * | getConstant (const IR::Expression *expr) const |
| |
| Result | setContains (const IR::Expression *keySet, const IR::Expression *constant) const |
| |
|
const IR::Node * | shift (const IR::Operation_Binary *op) |
| | Statically evaluate shift operation e.
|
| |
statically evaluates many constant expressions.
This pass can be invoked either with or without the refMap and typeMap. When type information is not available, constant folding is not performed for many IR nodes.
- Precondition
- :
typeMap is up-to-date if not nullptr and similarly for refMap
- Postcondition
- : Ensures
- most expressions that can be statically shown to evaluate to a constant are replaced with the constant value.
- operations that involve constant InfInt operands are evaluated to an InfInt value
- if
typeMap and refMap are not nullptr then IR::Declaration_Constant nodes are initialized with compile-time known constants.