amacc icon indicating copy to clipboard operation
amacc copied to clipboard

id->class is not consistently defined

Open HPCguy opened this issue 4 years ago • 3 comments

id->class is 0 for passed parameters vs. class 'Par' or 'Loc'. There may be other inconsistencies for other storage types.

HPCguy avatar Oct 06 '21 09:10 HPCguy

id->class is 0 for passed parameters vs. class 'Par' or 'Loc'. There may be other inconsistencies for other storage types.

Can you make a list of proposed changes to improve the consistency?

jserv avatar Oct 06 '21 11:10 jserv

Yes. I may pick up this ticket in the next few weeks. There is a lot of detail work to make everything consistent. It probably won't be a lot of code changes (15-30 lines?), but I (or whoever takes this on) will have to check every corner of the code to make sure they have it right. After it is done though, it will greatly increase the power of working with class-types, and maybe types in general.

HPCguy avatar Oct 07 '21 00:10 HPCguy

The issue is that id->class needs to be (1) set to non-zero when an identifier is defined/instantiated and (2) zero valued when an identifier is referenced but not yet instantiated/defined. This knowledge is especially useful in a one pass compiler like AMACC when generating IR. For instance, Labels can be used by goto statements before the Label appears in the source code stream.

HPCguy avatar Oct 07 '21 07:10 HPCguy