[ORC] Add std::tuple support to SimplePackedSerialization.
[llvm-project.git] / llvm / utils / TableGen / GlobalISel / GIMatchDagPredicate.cpp
blob1aca2f9dc1352bb3cade860e1d4e4d2838f4ccbf
1 //===- GIMatchDagPredicate.cpp - Represent a predicate to check -----------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
9 #include "GIMatchDagPredicate.h"
11 #include "llvm/TableGen/Record.h"
13 #include "GIMatchDagOperands.h"
14 #include "../CodeGenInstruction.h"
16 using namespace llvm;
18 void GIMatchDagPredicate::print(raw_ostream &OS) const {
19 OS << "<<";
20 printDescription(OS);
21 OS << ">>:$" << Name;
24 void GIMatchDagPredicate::printDescription(raw_ostream &OS) const { OS << ""; }
26 GIMatchDagOpcodePredicate::GIMatchDagOpcodePredicate(
27 GIMatchDagContext &Ctx, StringRef Name, const CodeGenInstruction &Instr)
28 : GIMatchDagPredicate(GIMatchDagPredicateKind_Opcode, Name,
29 Ctx.makeMIPredicateOperandList()),
30 Instr(Instr) {}
32 void GIMatchDagOpcodePredicate::printDescription(raw_ostream &OS) const {
33 OS << "$mi.getOpcode() == " << Instr.TheDef->getName();
36 GIMatchDagOneOfOpcodesPredicate::GIMatchDagOneOfOpcodesPredicate(
37 GIMatchDagContext &Ctx, StringRef Name)
38 : GIMatchDagPredicate(GIMatchDagPredicateKind_OneOfOpcodes, Name,
39 Ctx.makeMIPredicateOperandList()) {}
41 void GIMatchDagOneOfOpcodesPredicate::printDescription(raw_ostream &OS) const {
42 OS << "$mi.getOpcode() == oneof(";
43 StringRef Separator = "";
44 for (const CodeGenInstruction *Instr : Instrs) {
45 OS << Separator << Instr->TheDef->getName();
46 Separator = ",";
48 OS << ")";
51 GIMatchDagSameMOPredicate::GIMatchDagSameMOPredicate(GIMatchDagContext &Ctx,
52 StringRef Name)
53 : GIMatchDagPredicate(GIMatchDagPredicateKind_SameMO, Name,
54 Ctx.makeTwoMOPredicateOperandList()) {}
56 void GIMatchDagSameMOPredicate::printDescription(raw_ostream &OS) const {
57 OS << "$mi0 == $mi1";
60 raw_ostream &llvm::operator<<(raw_ostream &OS, const GIMatchDagPredicate &N) {
61 N.print(OS);
62 return OS;
65 raw_ostream &llvm::operator<<(raw_ostream &OS,
66 const GIMatchDagOpcodePredicate &N) {
67 N.print(OS);
68 return OS;