32    int expressionPrecedence;  
 
   36    bool noIncludes = 
false;   
 
   43        VecPrint(
const char *sep, 
const char *term) : separator(sep), terminator(term) {}
 
   50        ListPrint(
const char *start, 
const char *end) : start(start), end(end) {}
 
   54    std::vector<VecPrint> vectorSeparator;
 
   55    size_t vectorSeparator_init_apply_size = 0;
 
   56    std::vector<ListPrint> listTerminators;
 
   57    size_t listTerminators_init_apply_size = 0;
 
   59    void setVecSep(
const char *sep, 
const char *term = 
nullptr) {
 
   60        vectorSeparator.push_back(VecPrint(sep, term));
 
   63        BUG_CHECK(!vectorSeparator.empty(), 
"Empty vectorSeparator");
 
   64        vectorSeparator.pop_back();
 
   67        BUG_CHECK(!vectorSeparator.empty(), 
"Empty vectorSeparator");
 
   68        return vectorSeparator.back();
 
   72        BUG_CHECK(!listTerminators.empty(), 
"Empty listTerminators");
 
   73        listTerminators.pop_back();
 
   75    bool isSystemFile(
cstring file);
 
   78    void dump(
unsigned depth, 
const IR::Node *node = 
nullptr, 
unsigned adjDepth = 0);
 
   79    unsigned curDepth() 
const;
 
   88    std::ostream *outStream;
 
   95        : expressionPrecedence(DBPrint::Prec_Low),
 
   98          withinArgument(false),
 
  102        visitDagOnce = 
false;
 
  106        : expressionPrecedence(DBPrint::Prec_Low),
 
  109          withinArgument(false),
 
  110          builder(*new Util::SourceCodeBuilder()),
 
  111          outStream(outStream),
 
  113        visitDagOnce = 
false;
 
  118          expressionPrecedence(DBPrint::Prec_Low),
 
  121          withinArgument(false),
 
  122          builder(*new Util::SourceCodeBuilder()),
 
  123          outStream(&
std::cout),
 
  125        visitDagOnce = 
false;
 
  129    using Inspector::preorder;
 
  131    void setnoIncludesArg(
bool condition) { noIncludes = condition; }
 
  133    void setListTerm(
const char *start, 
const char *end) {
 
  134        listTerminators.push_back(ListPrint(start, end));
 
  137    void end_apply(
const IR::Node *node) 
override;
 
  139    bool process(
const IR::Type_StructLike *t, 
const char *name);
 
  141    bool preorder(
const IR::Type_Boolean *t) 
override;
 
  142    bool preorder(
const IR::Type_Varbits *t) 
override;
 
  143    bool preorder(
const IR::Type_Bits *t) 
override;
 
  144    bool preorder(
const IR::Type_InfInt *t) 
override;
 
  145    bool preorder(
const IR::Type_String *t) 
override;
 
  146    bool preorder(
const IR::Type_Var *t) 
override;
 
  147    bool preorder(
const IR::Type_Dontcare *t) 
override;
 
  148    bool preorder(
const IR::Type_Void *t) 
override;
 
  149    bool preorder(
const IR::Type_Error *t) 
override;
 
  150    bool preorder(
const IR::Type_Struct *t)
 override { 
return process(t, 
"struct"); }
 
  151    bool preorder(
const IR::Type_Header *t)
 override { 
return process(t, 
"header"); }
 
  152    bool preorder(
const IR::Type_HeaderUnion *t)
 override { 
return process(t, 
"header_union"); }
 
  153    bool preorder(
const IR::Type_Package *t) 
override;
 
  154    bool preorder(
const IR::Type_Parser *t) 
override;
 
  155    bool preorder(
const IR::Type_Control *t) 
override;
 
  156    bool preorder(
const IR::Type_Name *t) 
override;
 
  157    bool preorder(
const IR::Type_Stack *t) 
override;
 
  158    bool preorder(
const IR::Type_Specialized *t) 
override;
 
  159    bool preorder(
const IR::Type_Enum *t) 
override;
 
  160    bool preorder(
const IR::Type_SerEnum *t) 
override;
 
  161    bool preorder(
const IR::Type_Typedef *t) 
override;
 
  162    bool preorder(
const IR::Type_Newtype *t) 
override;
 
  163    bool preorder(
const IR::Type_Extern *t) 
override;
 
  164    bool preorder(
const IR::Type_Unknown *t) 
override;
 
  165    bool preorder(
const IR::Type_BaseList *t) 
override;
 
  166    bool preorder(
const IR::Type *t)
 override {
 
  167        builder.append(t->toString());
 
  170    bool preorder(
const IR::Type_SpecializedCanonical *t)
 override {
 
  171        BUG(
"%1%: specialized canonical type in IR tree", t);
 
  176    bool preorder(
const IR::Declaration_Constant *cst) 
override;
 
  177    bool preorder(
const IR::Declaration_Variable *v) 
override;
 
  178    bool preorder(
const IR::Declaration_Instance *t) 
override;
 
  179    bool preorder(
const IR::Declaration_MatchKind *d) 
override;
 
  182    bool preorder(
const IR::Dots *e) 
override;
 
  183    bool preorder(
const IR::NamedDots *e) 
override;
 
  184    bool preorder(
const IR::Constant *c) 
override;
 
  185    bool preorder(
const IR::Slice *slice) 
override;
 
  186    bool preorder(
const IR::BoolLiteral *b) 
override;
 
  187    bool preorder(
const IR::StringLiteral *s) 
override;
 
  188    bool preorder(
const IR::PathExpression *p) 
override;
 
  189    bool preorder(
const IR::Cast *c) 
override;
 
  190    bool preorder(
const IR::Operation_Binary *b) 
override;
 
  191    bool preorder(
const IR::Operation_Unary *u) 
override;
 
  192    bool preorder(
const IR::ArrayIndex *a) 
override;
 
  193    bool preorder(
const IR::TypeNameExpression *e) 
override;
 
  194    bool preorder(
const IR::Mux *a) 
override;
 
  195    bool preorder(
const IR::ConstructorCallExpression *e) 
override;
 
  196    bool preorder(
const IR::Member *e) 
override;
 
  197    bool preorder(
const IR::SelectCase *e) 
override;
 
  198    bool preorder(
const IR::SelectExpression *e) 
override;
 
  199    bool preorder(
const IR::ListExpression *e) 
override;
 
  200    bool preorder(
const IR::P4ListExpression *e) 
override;
 
  201    bool preorder(
const IR::StructExpression *e) 
override;
 
  202    bool preorder(
const IR::Invalid *e) 
override;
 
  203    bool preorder(
const IR::InvalidHeader *e) 
override;
 
  204    bool preorder(
const IR::InvalidHeaderUnion *e) 
override;
 
  205    bool preorder(
const IR::HeaderStackExpression *e) 
override;
 
  206    bool preorder(
const IR::MethodCallExpression *e) 
override;
 
  207    bool preorder(
const IR::DefaultExpression *e) 
override;
 
  208    bool preorder(
const IR::This *e) 
override;
 
  229    bool preorder(
const IR::AssignmentStatement *s) 
override;
 
  230    bool preorder(
const IR::BlockStatement *s) 
override;
 
  231    bool preorder(
const IR::MethodCallStatement *s) 
override;
 
  232    bool preorder(
const IR::EmptyStatement *s) 
override;
 
  233    bool preorder(
const IR::ReturnStatement *s) 
override;
 
  234    bool preorder(
const IR::BreakStatement *s) 
override;
 
  235    bool preorder(
const IR::ContinueStatement *s) 
override;
 
  236    bool preorder(
const IR::ExitStatement *s) 
override;
 
  237    bool preorder(
const IR::SwitchCase *s) 
override;
 
  238    bool preorder(
const IR::SwitchStatement *s) 
override;
 
  239    bool preorder(
const IR::IfStatement *s) 
override;
 
  240    bool preorder(
const IR::ForStatement *s) 
override;
 
  241    bool preorder(
const IR::ForInStatement *s) 
override;
 
  244    bool preorder(
const IR::NamedExpression *ne) 
override;
 
  245    bool preorder(
const IR::Argument *arg) 
override;
 
  246    bool preorder(
const IR::Path *p) 
override;
 
  247    bool preorder(
const IR::Parameter *p) 
override;
 
  248    bool preorder(
const IR::Annotations *a) 
override;
 
  249    bool preorder(
const IR::Annotation *a) 
override;
 
  250    bool preorder(
const IR::P4Program *program) 
override;
 
  251    bool preorder(
const IR::P4Control *c) 
override;
 
  252    bool preorder(
const IR::P4Action *c) 
override;
 
  253    bool preorder(
const IR::ParserState *s) 
override;
 
  254    bool preorder(
const IR::P4Parser *c) 
override;
 
  255    bool preorder(
const IR::TypeParameters *p) 
override;
 
  256    bool preorder(
const IR::ParameterList *p) 
override;
 
  257    bool preorder(
const IR::Method *p) 
override;
 
  258    bool preorder(
const IR::Function *function) 
override;
 
  260    bool preorder(
const IR::ExpressionValue *v) 
override;
 
  261    bool preorder(
const IR::ActionListElement *ale) 
override;
 
  262    bool preorder(
const IR::ActionList *v) 
override;
 
  263    bool preorder(
const IR::Key *v) 
override;
 
  264    bool preorder(
const IR::Property *p) 
override;
 
  265    bool preorder(
const IR::TableProperties *t) 
override;
 
  266    bool preorder(
const IR::EntriesList *l) 
override;
 
  267    bool preorder(
const IR::Entry *e) 
override;
 
  268    bool preorder(
const IR::P4Table *c) 
override;
 
  269    bool preorder(
const IR::P4ValueSet *c) 
override;
 
  272    bool preorder(
const IR::V1Program *)
 override { 
return false; }
 
 
Visitor mixin for looking up names in enclosing scopes from the Visitor::Context.
Definition resolveReferences.h:32