1 //===- GIMatchDagPredicate.cpp - Represent a predicate to check -----------===//
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
7 //===----------------------------------------------------------------------===//
9 #include "GIMatchDagPredicate.h"
11 #include "llvm/TableGen/Record.h"
13 #include "GIMatchDagOperands.h"
14 #include "../CodeGenInstruction.h"
18 void GIMatchDagPredicate::print(raw_ostream
&OS
) const {
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()),
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();
51 GIMatchDagSameMOPredicate::GIMatchDagSameMOPredicate(GIMatchDagContext
&Ctx
,
53 : GIMatchDagPredicate(GIMatchDagPredicateKind_SameMO
, Name
,
54 Ctx
.makeTwoMOPredicateOperandList()) {}
56 void GIMatchDagSameMOPredicate::printDescription(raw_ostream
&OS
) const {
60 raw_ostream
&llvm::operator<<(raw_ostream
&OS
, const GIMatchDagPredicate
&N
) {
65 raw_ostream
&llvm::operator<<(raw_ostream
&OS
,
66 const GIMatchDagOpcodePredicate
&N
) {