[llvm] [NFC][DecoderEmitter] Predicate generation code cleanup (PR #158140)
Sergei Barannikov via llvm-commits
llvm-commits at lists.llvm.org
Sun Sep 14 17:32:56 PDT 2025
================
@@ -1266,15 +1238,15 @@ unsigned DecoderTableBuilder::getPredicateIndex(StringRef Predicate) const {
}
void DecoderTableBuilder::emitPredicateTableEntry(unsigned EncodingID) const {
- if (!doesOpcodeNeedPredicate(EncodingID))
- return;
-
// Build up the predicate string.
SmallString<256> Predicate;
- // FIXME: emitPredicateMatch() functions can take a buffer directly rather
- // than a stream.
raw_svector_ostream PS(Predicate);
emitPredicateMatch(PS, EncodingID);
+ // Predicate being empty indicates that there are no predicates.
+ // Predicate being "false" indicate that there are predicates but with no
+ // AssemblerMatcherPredicate.
+ if (Predicate.empty() || Predicate == "false")
----------------
s-barannikov wrote:
It is unfortunate we have to check for "false" here. Maybe make emitPredicateMatch return true if it found any AssemblerPredicates? I think it could be useful in other places where this method is called.
https://github.com/llvm/llvm-project/pull/158140
More information about the llvm-commits
mailing list