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 auto annot = table->getAnnotations();
37 if (annot->getSingle(
"phase0"_cs)) {
52 bool isSimple(
const IR::Expression *expr,
const Visitor::Context *)
override {
53 auto slice = expr->to<IR::Slice>();
54 if (!slice)
return false;
56 while (e->is<IR::Member>()) e = e->to<IR::Member>()->expr;
57 return e->to<IR::PathExpression>() !=
nullptr;
66 void postorder(
const IR::Slice *)
override {}
67 void postorder(
const IR::Constant *)
override {
69 if (!getParent<IR::Slice>()) simple =
false;
75 bool isSimple(
const IR::Expression *expr,
const Visitor::Context *ctxt)
override {
76 return P4::IsMask::isSimple(expr, ctxt);
Definition simplify_key_policy.h:26
Definition simplify_key_policy.h:48
Definition simplify_key_policy.h:65
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