Skip to content

[Semantics] Determine design to map effective semantic to each parameter field #358

@Keenuts

Description

@Keenuts

Current semantic implementation does not support struct reuse across inputs if nested.
Reason is we have a 1:1 mapping for each semantic attribute to a declaration, ignoring the actual parents of this declaration:

struct S0 {
    int s0_f0 : SEMANTIC_0;
}

struct S1 {
    int s1_f0 : SEMANTIC_1;
    S0  s1_f1: SEMANTIC_2;
}

void main(S0 main0, S1 main1) { }

In this case, the main function will have several semantic attributes:

Semantic0Attr -> s0_f0 decl.
Semantic1Attr -> s1_f0 decl.
Semantic2Attr -> s0_f0 decl.

This causes an issue as there is no clear way to differentiate which attribute applies to main1.s1_f1.s0_f0 or main0.s0.f0.

Multiple solutions are available, but needs to be explored so we can move forward:

  • consider a 1:1 flat mapping which maps the unwrapped struct hierarchy. Here the order would carry semantic, meaning Semantic2Attr would only belong to the 3rd unwrapped field, so main1.s1_f1.s0_f0.
  • consider storing the entier path in the attribute: instead of storing the last level decl, store each decl leading to this, so here main1 -> s1_f1 -> s0_f0. This would allow disambiguation while ignoring the attribute ordering on the function decl.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Status

No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions