31 const IR::Expression *preorder(IR::Expression *exp)
override {
32 if (exp->type == IR::Type::Unknown::get())
33 if (
auto type = typeMap->getType(getOriginal())) exp->type = type;
37 const IR::Type *preorder(IR::Type_Name *type)
override {
39 if (
auto tdecl = decl->getNode()->to<IR::Type_Declaration>())
40 return transform_child(tdecl)->to<IR::Type>();
42 BUG(
"Type_Name %1% maps to %2% rather than a type decl", type, decl);
44 BUG(
"Type_Name %1% doesn't map to a declaration", type, decl);
48 const IR::StructExpression *preorder(IR::StructExpression *si)
override {
50 preorder(
static_cast<IR::Expression *
>(si));
51 visit(si->components,
"components");
56 const IR::TypeNameExpression *preorder(IR::TypeNameExpression *tn)
override {
58 preorder(
static_cast<IR::Expression *
>(tn));
63 const IR::Type_Specialized *preorder(IR::Type_Specialized *ts)
override {
65 Transform::preorder(
static_cast<IR::Type *
>(ts));
66 visit(ts->arguments,
"arguments");
71 const IR::ConstructorCallExpression *preorder(IR::ConstructorCallExpression *ts)
override {
73 preorder(
static_cast<IR::Expression *
>(ts));
74 visit(ts->arguments,
"arguments");
81 : refMap(refMap), typeMap(typeMap) {
82 dontForwardChildrenBeforePreorder =
true;