16#ifndef MIDEND_CONVERTERRORS_H_
17#define MIDEND_CONVERTERRORS_H_
21#include "frontends/p4/typeChecking/typeChecker.h"
22#include "frontends/p4/typeMap.h"
25#include "ir/pass_manager.h"
26#include "ir/visitor.h"
27#include "lib/cstring.h"
29#include "lib/safe_vector.h"
30#include "midend/convertEnums.h"
44 virtual bool convert(
const IR::Type_Error *type)
const = 0;
55 unsigned width)
const;
61 std::map<cstring, P4::EnumRepresentation *> repr;
67 : policy(policy), typeMap(typeMap) {
70 setName(
"DoConvertErrors");
72 const IR::Node *preorder(IR::Type_Error *type)
override;
73 const IR::Node *postorder(IR::Type_Name *type)
override;
74 const IR::Node *postorder(IR::Member *member)
override;
81 using ErrorMapping =
decltype(DoConvertErrors::repr);
85 if (typeChecking ==
nullptr) {
88 passes.push_back(typeChecking);
89 passes.push_back(convertErrors);
91 setName(
"ConvertErrors");
94 ErrorMapping getErrorMapping()
const {
return convertErrors->repr; }
Definition convertErrors.h:39
virtual unsigned errorSize(unsigned errorCount) const =0
virtual IR::IndexedVector< IR::SerEnumMember > * assignValues(IR::Type_Error *type, unsigned width) const
Definition convertErrors.cpp:70
virtual bool convert(const IR::Type_Error *type) const =0
If true this type has to be converted.
Definition typeChecker.h:32
Definition convertErrors.h:77
Definition convertErrors.h:58
Definition ir/pass_manager.h:40
Definition typeChecker.h:55
TODO: this is not really specific to BMV2, it should reside somewhere else.
Definition applyOptionsPragmas.cpp:24
unsigned errorCount()
Definition lib/error.h:35