This is an archive of the discontinued LLVM Phabricator instance.

[globalisel][tablegen] Move <Target>InstructionSelector declarations to anonymous namespaces
ClosedPublic

Authored by dsanders on Mar 15 2017, 1:45 PM.

Details

Summary

This resolves the issue of tablegen-erated includes in the headers for non-GlobalISel builds in a simpler way than before.

Diff Detail

Repository
rL LLVM

Event Timeline

dsanders created this revision.Mar 15 2017, 1:45 PM
ab added a subscriber: ab.Mar 24 2017, 7:03 PM

What do you think of moving the class declaration to the .cpp file ? I don't think we need to export anything more than a "createAArch64InstructionSelector" function in AArch64.h; it was a mistake for me to put the class in the header in the first place.

That would get rid of the ifdef problem.

That sounds good to me. Can we tack it onto the end of the main patch series though? Some of those patches change <Target>InstructionSelector and I'd like to avoid resolving the conflicts if I don't need to.

qcolombet edited edge metadata.Mar 28 2017, 9:51 AM

That sounds good to me. Can we tack it onto the end of the main patch series though? Some of those patches change <Target>InstructionSelector and I'd like to avoid resolving the conflicts if I don't need to.

Sounds sensible to me.

@ab , what do you think?

ab added a comment.Mar 28 2017, 10:22 AM

Merge pain is temporary, but commit history is forever (I spend a lot of time resolving conflicts, but I spend way more git-blaming ancient commits). So, I'd favor doing the right thing in the first place if it's not too painful (maybe try it and abandon if it takes more than a few minutes to resolve? I suspect you'll have few problems as the header isn't affected by most changes)

dsanders updated this revision to Diff 93476.Mar 30 2017, 7:06 AM

Rewrote to move the class declaration into the .cpp.

The merge conflicts weren't too bad in the end. Git didn't attempt the merge at all but only a couple patches mattered.

ab accepted this revision.Mar 30 2017, 10:57 AM

Nice! LGTM with the header changes.

lib/Target/AArch64/AArch64TargetMachine.h
76–78 ↗(On Diff #93476)

Please put this in AArch64.h with its brethren

lib/Target/X86/X86TargetMachine.h
54 ↗(On Diff #93476)

Same, this should be in X86.h.

This revision is now accepted and ready to land.Mar 30 2017, 10:57 AM
ab added inline comments.Mar 30 2017, 10:58 AM
lib/Target/AArch64/AArch64InstructionSelector.cpp
41 ↗(On Diff #93476)

These don't need to be in the llvm namespace anymore, btw.

dsanders retitled this revision from [globalisel][tablegen] Handle LLVM_BUILD_GLOBAL_ISEL=OFF by emitting an empty tablegen-erated file. to [globalisel][tablegen] Move <Target>InstructionSelector declarations to anonymous namespaces.Apr 6 2017, 3:00 AM
dsanders edited the summary of this revision. (Show Details)
This revision was automatically updated to reflect the committed changes.
llvm/trunk/lib/Target/X86/X86.h