Skip to content

Commit

Permalink
add type declaration check
Browse files Browse the repository at this point in the history
  • Loading branch information
grg committed Mar 2, 2024
1 parent 6d025e6 commit 11ea3b2
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions midend/def_use.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -224,15 +224,18 @@ bool ComputeDefUse::preorder(const IR::P4Control *c) {
BUG_CHECK(state == SKIPPING, "Nested %s not supported in ComputeDefUse", c);
IndentCtl::TempIndent indent;
LOG5("ComputeDefUse(P4Control " << c->name << ")" << indent);
bool is_type_declaration = !c->getTypeParameters()->empty();
for (auto *p : c->getApplyParameters()->parameters)
if (p->direction == IR::Direction::In || p->direction == IR::Direction::InOut) {
def_info[p].defs.insert(getLoc(p));
// Assume that all components of input parameters are live: we don't currently
// propagate liveness innformation across parser/control block boundaries.
if (auto *tn = p->type->to<IR::Type_Name>()) {
auto *d = resolveUnique(tn->path->name, P4::ResolutionType::Any);
if (auto *type = d->to<IR::Type>()) {
set_live_from_type(def_info[p], type);
if (!is_type_declaration) {
if (auto *tn = p->type->to<IR::Type_Name>()) {
auto *d = resolveUnique(tn->path->name, P4::ResolutionType::Any);
if (auto *type = d->to<IR::Type>()) {
set_live_from_type(def_info[p], type);
}
}
}
}
Expand Down

0 comments on commit 11ea3b2

Please sign in to comment.