35 bool preorder(IR::BFN::Pipe *pipe)
override {
36 BUG_CHECK(pipe->headerStackInfo !=
nullptr,
37 "Running StackPushShims without running "
38 "CollectHeaderStackInfo first?");
39 stacks = pipe->headerStackInfo;
43 bool preorder(IR::BFN::Parser *p)
override {
44 BUG_CHECK(stacks !=
nullptr,
45 "No HeaderStackInfo; was StackPushShims "
46 "applied to a non-Pipe node?");
47 for (
auto &stack : *stacks) {
48 if (stack.maxpush == 0 || !stack.inThread[p->gress])
continue;
60 const unsigned pushValue = (1U << stack.maxpush) - 1;
61 const unsigned stkValidSize = stack.size + stack.maxpush + stack.maxpop;
62 const unsigned stkValidValue = pushValue << (stack.size + stack.maxpop);
65 new IR::Member(IR::Type::Bits::get(stkValidSize),
66 new IR::PathExpression(stack.name),
"$stkvalid"),
67 new IR::BFN::ConstantRVal(stkValidValue))};
68 p->start =
new IR::BFN::ParserState(stack.name +
"$shim", p->gress, initStkValid, {},
69 {new IR::BFN::Transition(match_t(), 0, p->start)});