This is an archive of the discontinued LLVM Phabricator instance.

[TableGen] Emit separate computeRequiredFeatures() function
ClosedPublic

Authored by kpdev42 on Apr 17 2023, 5:42 AM.

Details

Summary

A function is already emitted in *GenInstrInfo.inc that takes Opcode
number and a set of supported Features and reports fatal error if some
of the required features are missing.

The information about features required by the particular opcode can be
reused by llvm-exegesis, so move its computation info a separate
computeRequiredFeatures() function. Then verifyInstructionPredicates()
can just compare the sets of available and required features computed by
the other functions.

This commit moves the definition of FeatureBitsets[] as well as CEFBS_*
enumerator values (that are indices into FeatureBitsets[] array) inside
the computeRequiredFeatures() function because these are implementation
details of that function. The inclusion of potentially huge
computeRequiredFeatures() function is now controlled by a dedicated
macro that is set for simplicity by TableGen-erated code itself if
defined(ENABLE_INSTR_PREDICATE_VERIFIER) && !defined(NDEBUG).

~~

Huawei RRI, OS Lab

Diff Detail

Event Timeline

kpdev42 created this revision.Apr 17 2023, 5:42 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 17 2023, 5:42 AM
Herald added a subscriber: mstojanovic. · View Herald Transcript
kpdev42 requested review of this revision.Apr 17 2023, 5:42 AM
courbet added inline comments.Apr 18 2023, 7:38 AM
llvm/utils/TableGen/InstrInfoEmitter.cpp
748

Won't this force emitting a copy in each compilation unit that includes the generated file ? Using inline instead would allow deduping the symbol.

kpdev42 updated this revision to Diff 516505.Apr 24 2023, 12:43 PM

Address review comment

kpdev42 marked an inline comment as done.Apr 24 2023, 12:44 PM
kpdev42 added inline comments.
llvm/utils/TableGen/InstrInfoEmitter.cpp
748

Changed (here and in computeRequiredFeatures)

courbet accepted this revision.May 10 2023, 1:02 AM
This revision is now accepted and ready to land.May 10 2023, 1:02 AM
This revision was landed with ongoing or failed builds.Jun 7 2023, 8:24 AM
This revision was automatically updated to reflect the committed changes.
kpdev42 marked an inline comment as done.