This is an archive of the discontinued LLVM Phabricator instance.

Change TargetLoweringObjectFile ownership
ClosedPublic

Authored by aditya_nandakumar on Oct 17 2014, 4:54 PM.

Details

Reviewers
echristo
Summary

This patch changes the ownership of TLOF from TargetLoweringBase to TargetMachine so that different subtargets could share the TLOF effectively.
I have made the change to X86 only currently and it passes make check. I could update the other targets after feedback.

Please review.

Thanks
Aditya

Diff Detail

Event Timeline

aditya_nandakumar retitled this revision from to Change TargetLoweringObjectFile ownership.
aditya_nandakumar updated this object.
aditya_nandakumar edited the test plan for this revision. (Show Details)
aditya_nandakumar added a subscriber: Unknown Object (MLST).

Hi Aditya!

I think this will work. You should return a unique_ptr out of the construction routine and use make_unique instead of new. Trying to come up with a way that doesn't require a unique_ptr here, but I'm not coming up with one.

Thanks!

-eric

Hi Eric

Apologies - I missed your review.
I have updated the Construction to return unique_ptr and uses make_unique as you suggested. I too am not sure how to eliminate the unique_ptr here.

Aditya

echristo edited edge metadata.Nov 3 2014, 6:56 PM

LGTM. Thanks!

Getting to all of the other targets shortly?

-eric

Thank you. I’ll update the remaining targets shortly.

echristo accepted this revision.Nov 5 2014, 1:46 PM
echristo edited edge metadata.
This revision is now accepted and ready to land.Nov 5 2014, 1:46 PM

Hi Eric,

Would it be preferable to add a virtual method - getTargetLoweringObjectFile() to TargetMachine ? All targets to could override this.

Thanks
Aditya

Agreed, have it just query the Subtarget for now to get it on targets that
haven't replaced.

That said, it'll make it easier if you just call it getObjFileLowering like
the current name (which I think is best).

Thanks!

-eric

aditya_nandakumar edited edge metadata.

Updated all target machines to own the TargetLoweringObjectFile.
Changed the method name to getObjFileLowering()

Make check passes . Please let me know if this is good to submit.

Aditya

You have extra whitespace cleanups in a couple of files, please remove those before committing. Are you going to fix the TargetLoweringBase constructor to no longer need both arguments since the TM can get everything in a follow up commit or would you like to do that as part of this?

Thanks Eric.
I’ll remove those whitespace cleanups (default in my editor) and commit soon.

I’d like to fix the TargetLoweringBase constructor in a followup commit.

Thanks
Aditya

Sounds good to me. Should just be a quick change. :)

-eric