19#ifndef BF_P4C_MIDEND_SIMPLIFY_KEY_POLICY_H_
20#define BF_P4C_MIDEND_SIMPLIFY_KEY_POLICY_H_
22#include "midend/simplifyKey.h"
30 bool isSimple(
const IR::Expression *,
const Visitor::Context *ctxt)
override {
32 if (ctxt ==
nullptr)
return false;
34 if (n->is<IR::P4Program>())
return false;
35 if (
auto table = n->to<IR::P4Table>()) {
36 return table->hasAnnotation(
"phase0"_cs);
48 bool isSimple(
const IR::Expression *expr,
const Visitor::Context *)
override {
49 auto slice = expr->to<IR::Slice>();
50 if (!slice)
return false;
52 while (e->is<IR::Member>()) e = e->to<IR::Member>()->expr;
53 return e->to<IR::PathExpression>() !=
nullptr;
62 void postorder(
const IR::Slice *)
override {}
63 void postorder(
const IR::Constant *)
override {
65 if (!getParent<IR::Slice>()) simple =
false;
71 bool isSimple(
const IR::Expression *expr,
const Visitor::Context *ctxt)
override {
72 return P4::IsMask::isSimple(expr, ctxt);
Definition simplify_key_policy.h:26
Definition simplify_key_policy.h:44
Definition simplify_key_policy.h:61
Definition simplifyKey.h:81
Definition simplifyKey.h:69
Definition simplifyKey.h:31
Definition simplifyKey.h:98
The namespace encapsulating Barefoot/Intel-specific stuff.
Definition add_t2na_meta.cpp:21