From f5c592905e6e1ef4b78337d76c8215e543607b8d Mon Sep 17 00:00:00 2001 From: Richard-Qin-X Date: Mon, 17 Aug 2026 03:16:26 +0800 Subject: [RISCV][GlobalISel] Generate conditional branch selection --- backend/utils/TableGen/GlobalISelEmitter.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'backend/utils/TableGen/GlobalISelEmitter.cpp') diff --git a/backend/utils/TableGen/GlobalISelEmitter.cpp b/backend/utils/TableGen/GlobalISelEmitter.cpp index 98568b1..d73d691 100644 --- a/backend/utils/TableGen/GlobalISelEmitter.cpp +++ b/backend/utils/TableGen/GlobalISelEmitter.cpp @@ -47,7 +47,8 @@ void emitTypePredicate(std::ostream &Output, std::uint32_t OperandIndex, Rule.OperandImmediates.size() + Rule.OperandDefConstants.size() + Rule.Temporaries.size() + Rule.EraseOperandDefinitions.size(); for (const NormalizedSelectionDefUsePredicate &Predicate : Rule.DefUsePredicates) - Count += 1U + Predicate.Captures.size() + Predicate.OperandDefConstants.size(); + Count += 1U + static_cast(Predicate.IntegerPredicate.has_value()) + + Predicate.Captures.size() + Predicate.OperandDefConstants.size(); for (const NormalizedSelectionAction &Action : Rule.Actions) Count += 1U + Action.OperandRenderers.size(); return Count; @@ -137,6 +138,11 @@ std::string emitGlobalISel(const NormalizedTargetModel &Model, std::string_view } for (const NormalizedSelectionDefUsePredicate &DefUse : Rule.DefUsePredicates) { emitInstruction(Output, "CheckOperandDefOpcode", DefUse.RootOperandIndex, DefUse.Opcode); + if (DefUse.IntegerPredicate) { + emitInstruction(Output, "CheckOperandDefIntegerPredicate", DefUse.RootOperandIndex, + DefUse.IntegerPredicate->Predicate, + std::to_string(DefUse.IntegerPredicate->OperandIndex)); + } for (const NormalizedSelectionOperandDefConstantPredicate &Predicate : DefUse.OperandDefConstants) { emitInstruction(Output, "CheckOperandDefOperandConstantRanges", DefUse.RootOperandIndex, -- cgit v1.2.3