Skip to content

feat: support IEC hardware addresses in struct members#1614

Open
volsa wants to merge 2 commits intomasterfrom
vosa/struct-iec-address
Open

feat: support IEC hardware addresses in struct members#1614
volsa wants to merge 2 commits intomasterfrom
vosa/struct-iec-address

Conversation

@volsa
Copy link
Member

@volsa volsa commented Feb 27, 2026

Add support for AT %IX... hardware address declarations on struct member variables. The pre-processor now creates backing global variables (_PI, _M, _G*) for struct members with hardware addresses and sets their initializers, mirroring the existing behavior for global variables. The lowering phase generates REF= assignments in the struct's constructor to wire up the pointer.

Also introduces a shared FxHashSet to track generated hardware globals across pre-processor passes, preventing duplicate variable errors when the pipeline re-indexes during lowering.

Add support for AT %IX... hardware address declarations on struct
member variables. The pre-processor now creates backing global
variables (__PI_*, __M_*, __G_*) for struct members with hardware
addresses and sets their initializers, mirroring the existing
behavior for global variables. The lowering phase generates REF=
assignments in the struct's constructor to wire up the pointer.

Also introduces a shared FxHashSet to track generated hardware
globals across pre-processor passes, preventing duplicate variable
errors when the pipeline re-indexes during lowering.
}

fn update_generated_globals(unit: &mut CompilationUnit, mangled_globals: Vec<Variable>) {
if mangled_globals.is_empty() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will adding this .is_empty() check here have any unintended side effects? I see this method is also called from the existing methods as well.

Copy link
Contributor

@Angus-Bethke-Bachmann Angus-Bethke-Bachmann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants