This is an archive of the discontinued LLVM Phabricator instance.

[lld][MachO][NFC] Nest the CallGraphSort inside the PriorityBuilder class
AbandonedPublic

Authored by Roger on Mar 21 2022, 10:13 AM.

Details

Reviewers
None
Group Reviewers
Restricted Project
Summary

The CallGraphSort class is used to inform the priorities constructed by the PriorityBuilder class. I have encapsulated config->callGraphProfile inside the CallGraphSort class. I've also nested the CallGraphSort class inside PriorityBuilder as it needs read-only access to its private fields.

I went with nesting the CallGraphSort class inside the PriorityBuilder class rather than adding to PriorityBuilder's public interface since it is only CallGraphSort that needs access to its private members and this way limits visibility to only those who need it.

Diff Detail

Event Timeline

Roger created this revision.Mar 21 2022, 10:13 AM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptMar 21 2022, 10:13 AM
Herald added a reviewer: Restricted Project. · View Herald Transcript
Roger requested review of this revision.Mar 21 2022, 10:13 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 21 2022, 10:13 AM
Roger retitled this revision from Encapsulate CallGraphSort state. to [lld][MachO][NFC] Nest the CallGraphSort inside the PriorityBuilder class.Mar 21 2022, 10:35 AM
Roger edited the summary of this revision. (Show Details)
Roger planned changes to this revision.Mar 21 2022, 10:44 AM
thakis added a subscriber: thakis.Mar 21 2022, 11:05 AM

What problem does this solve?

int3 added a subscriber: int3.EditedMar 21 2022, 11:34 AM

+1, I'm not convinced this makes the code clearer. I would prefer not to couple the declarations of CallGraphSort and PriorityBuilder. Plus I don't think visibility of members is a big concern given that CallGraphSort is already declared in an anon namespace.

Roger abandoned this revision.Mar 21 2022, 12:38 PM

Never mind. I found this is unnecessary.