This is an archive of the discontinued LLVM Phabricator instance.

[GlobalISel][RISCV][TableGen] Teach GlobalISelEmitter about HwMode.
ClosedPublic

Authored by craig.topper on Aug 23 2023, 12:05 PM.

Details

Summary

Similar to SelectionDAG, this patch treats HwMode as an additional
predicate that needs to be satisfied for GIM_CheckFeatures.

The existing predicate passes around Record * that point to predicate
objects. While HwMode expansion creates a string that needs to be
checked.

Each HwMode predicate string is uniqued by a new map that assigns
it an index. Each Rule stores the index, or -1 if HwMode doesn't
apply.

The HwMode indices each create a new Predicate feature bit and the
check string from the HwMode is used to set the feature bit.
GIM_CheckFeatures is emitted when the rule has Predicates or the HwModeIdx
is not -1.

Diff Detail

Event Timeline

craig.topper created this revision.Aug 23 2023, 12:05 PM
craig.topper requested review of this revision.Aug 23 2023, 12:05 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 23 2023, 12:05 PM
Herald added subscribers: wangpc, eopXD, wdng. · View Herald Transcript
arsenm accepted this revision.Aug 23 2023, 5:08 PM
arsenm added inline comments.
llvm/utils/TableGen/GlobalISelMatchTableExecutorEmitter.h
227

StringMap?

This revision is now accepted and ready to land.Aug 23 2023, 5:08 PM
craig.topper added inline comments.Aug 23 2023, 6:22 PM
llvm/utils/TableGen/GlobalISelMatchTableExecutorEmitter.h
227

Would that cause non-determinism on the output of the loops in emitSubtargetFeatureBitEnumeration and emitComputeAvailableFeatures?

arsenm added inline comments.Aug 23 2023, 6:29 PM
llvm/utils/TableGen/GlobalISelMatchTableExecutorEmitter.h
227

Yes I think so