This is an archive of the discontinued LLVM Phabricator instance.

[NFC][IR] Force accesses to Function attributes go through getters/setters
Needs ReviewPublic

Authored by vporpo on Feb 14 2023, 1:19 PM.

Details

Reviewers
aeubanks
nikic
Summary

This patch moves Function::AttributeList to a separate FnAttributeList class
where it is declared as private. The Function class inherits from
FnAttributeList but all accesses to the attributes have to go through
getter/setter functions.

Diff Detail

Event Timeline

vporpo created this revision.Feb 14 2023, 1:19 PM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 14 2023, 1:19 PM
Herald added a subscriber: hiraditya. · View Herald Transcript
vporpo requested review of this revision.Feb 14 2023, 1:19 PM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 14 2023, 1:19 PM
arsenm added a subscriber: arsenm.Feb 14 2023, 1:22 PM

What's the point of doing this? The attributes are already private

It funnels all changes to attributes through a single function, which makes it really easy to track all attribute changes from a single point.

nikic added a reviewer: nikic.Feb 14 2023, 1:38 PM
nikic added a subscriber: nikic.

It funnels all changes to attributes through a single function, which makes it really easy to track all attribute changes from a single point.

And what is this needed for / what will this be used for?

And what is this needed for / what will this be used for?

This is to make it easier to track changes to the attributes for Checkpointing, but regardless I think this is generally useful e.g., for debugging, as you can watch all changes from a single point.

nikic added a comment.Feb 15 2023, 3:26 AM

I see. In that case, I think this change makes sense as part of a patch stack to implement that RFC (if it is accepted), but I don't think we should do this otherwise.