This is an archive of the discontinued LLVM Phabricator instance.

[nfc] Factoring out utility that can be used for other object-level tools
ClosedPublic

Authored by JestrTulip on Jun 13 2023, 4:47 PM.

Diff Detail

Event Timeline

JestrTulip created this revision.Jun 13 2023, 4:47 PM
Herald added a reviewer: MaskRay. · View Herald Transcript
Herald added a project: Restricted Project. · View Herald Transcript
JestrTulip requested review of this revision.Jun 13 2023, 4:47 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 13 2023, 4:47 PM
mtrofin accepted this revision.Jun 13 2023, 5:12 PM

lgtm (some comments)

llvm/include/llvm/Object/ObjectFile.h
49

Since this moves now in the llvm namespace, perhaps renaming it to something less generic, like SectionFilterPredicate? By the looks of it, it's only used in the header anyway.

Or move it as a member of SectionFilterIterator

This revision is now accepted and ready to land.Jun 13 2023, 5:12 PM
MaskRay requested changes to this revision.Jun 13 2023, 7:15 PM

Can you state the motivation and link to the follow-up patch?

This revision now requires changes to proceed.Jun 13 2023, 7:15 PM
JestrTulip marked an inline comment as done.Jun 14 2023, 10:38 AM

Can you state the motivation and link to the follow-up patch?

The main motivation behind this (and upcoming) changes is to move towards developing a tool that can intake object files and use them as part of a greater cost model evaluation tool (RFC is a WIP for this tool) . As for this current patch, this works on making the file intake and processing step easier overall. Since it's a refactoring and doesn't affect any current implementations, I saw it as not tied to the upcoming, broader changes that will be outlined in the RFC.

JestrTulip retitled this revision from [nfc] moved SectionFilterIterator for improved reusability to [nfc] Factoring out utility that can be used for other object-level tools.Jun 14 2023, 11:00 AM
kazu accepted this revision.Jun 14 2023, 11:13 AM

As there is currently only one usage, I don't think a moving of the code benefits anything (you wouldn't do the refactoring if you weren't looking to use it elsewhere, for example). I'm not opposed to the patch being part of a patch series that includes the proposed RFC, but it shouldn't land unless the RFC is accepted and the corresponding patch is still using it once the final version is accepted.

As there is currently only one usage, I don't think a moving of the code benefits anything (you wouldn't do the refactoring if you weren't looking to use it elsewhere, for example). I'm not opposed to the patch being part of a patch series that includes the proposed RFC, but it shouldn't land unless the RFC is accepted and the corresponding patch is still using it once the final version is accepted.

Added the child revision. The RFC is pending review, as it is my initial post. Will update message with link shortly.

JestrTulip edited the summary of this revision. (Show Details)Jun 20 2023, 3:39 PM
mtrofin edited the summary of this revision. (Show Details)Jun 20 2023, 3:39 PM
JestrTulip edited the summary of this revision. (Show Details)Jun 20 2023, 3:43 PM

Can you state the motivation and link to the follow-up patch?

Added the rfc and intro patch, is there anything else I should do to for this to get accepted?

Can you state the motivation and link to the follow-up patch?

Added the rfc and intro patch, is there anything else I should do to for this to get accepted?

Yes. I feel the same with @jhenderson .

it shouldn't land unless the RFC is accepted and the corresponding patch is still using it once the final version is accepted.

I am happy to be more lenient to "once the final version is accepted". I am happy once "the patch will clearly land (approved or will eventually be) and the final version or the agreed direction will use the shared code when it lands."
So, sorry, I don't think the patch can land now.

Thanks @JestrTulip, this gets a soft LGTM from me, but as noted, the other patch needs accepting before this lands.

llvm/include/llvm/Object/ObjectFile.h
409

Since you're moving this code into the llvm::object namespace, I believe all these llvm::object:: prefixes can disappear. Please do that.

It's also a good chance to tidy up some of the style issues. In particular, LLVM code prefers "west const" (i.e. the const before the type name).

These points apply thoughour the moved code.

JestrTulip edited the summary of this revision. (Show Details)

removing llvm::object prefixes

jhenderson added inline comments.Jun 21 2023, 11:33 PM
llvm/include/llvm/Object/ObjectFile.h
409

It's also a good chance to tidy up some of the style issues. In particular, LLVM code prefers "west const" (i.e. the const before the type name).

Please do this too (e.g. const section_iterator & rather than the current section_iterator const &). Also applies in a couple of places in this code.

feedback: west const for non-const functions

feedback: const changes in objdump.h

@JestrTulip, it looks like your latest diff isn't the full patch, but rather one of your fixup commits? Please make sure to upload the full diff instead.

resolved patch problem

Hi All, the accompanying patch to this nfc has been accepted. Could we also proceed with accepting this one?

jhenderson accepted this revision.Jun 29 2023, 12:22 AM

LGTM, but please wait for @MaskRay (NB, I've put a swathe of comments on your other patch).

MaskRay accepted this revision.Jul 10 2023, 11:08 AM
This revision is now accepted and ready to land.Jul 10 2023, 11:08 AM
This revision was landed with ongoing or failed builds.Jul 10 2023, 12:51 PM
This revision was automatically updated to reflect the committed changes.