This is an archive of the discontinued LLVM Phabricator instance.

[globalisel][tablegen] Fuse the generated tables together.
ClosedPublic

Authored by dsanders on Jul 20 2017, 6:14 AM.

Details

Summary

Now that we have control flow in place, fuse the per-rule tables into a
single table. This is a compile-time saving at this point. However, this will
also enable the optimization of a table so that similar instructions can be
tested together, reducing the time spent on the matching the code.

This is NFC in terms of externally visible behaviour but some internals have
changed slightly. State.MIs is no longer reset between each rule that is
attempted because it's not necessary to do so. As a consequence of this the
restriction on the order that instructions are added to State.MIs has been
relaxed to only affect recorded instructions that require new elements to be
added to the vector. GIM_RecordInsn can now write to any element from 1 to
State.MIs.size() instead of just State.MIs.size().

Event Timeline

dsanders created this revision.Jul 20 2017, 6:14 AM
dsanders added inline comments.Jul 20 2017, 6:18 AM
include/llvm/CodeGen/GlobalISel/InstructionSelectorImpl.h
220–221

I intend to commit this line separately. It fixes a bug that was uncovered by this patch.

rovka added inline comments.Jul 25 2017, 3:30 AM
include/llvm/CodeGen/GlobalISel/InstructionSelectorImpl.h
252

Shouldn't there be a break here?

utils/TableGen/GlobalISelEmitter.cpp
56

Does this need to be tracked externally? Can't the MatchTable manage it now?

2503

This isn't necessary anymore.

dsanders updated this revision to Diff 108057.Jul 25 2017, 5:33 AM
dsanders marked 2 inline comments as done.

Add missing break
Removed State.MIs.resize(1). The first GIM_RecordInsn will do it.
Moved CurrentLabelID inside MatchTable

dsanders marked 2 inline comments as done.Jul 25 2017, 5:34 AM
rovka accepted this revision.Jul 25 2017, 6:11 AM

Cool, LGTM, thanks.

This revision is now accepted and ready to land.Jul 25 2017, 6:11 AM
dsanders closed this revision.Jul 26 2017, 3:21 AM