1 //===- GIMatchDagInstr.cpp - A shared operand list for nodes --------------===//
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 "GIMatchDagInstr.h"
10 #include "../CodeGenInstruction.h"
11 #include "GIMatchDag.h"
12 #include "llvm/TableGen/Record.h"
16 void GIMatchDagInstr::print(raw_ostream
&OS
) const {
18 if (const auto *Annotation
= getOpcodeAnnotation())
19 OS
<< Annotation
->TheDef
->getName();
23 OperandInfo
.print(OS
);
25 if (!UserAssignedNamesForOperands
.empty()) {
27 SmallVector
<std::pair
<unsigned, StringRef
>, 8> ToPrint
;
28 for (const auto &Assignment
: UserAssignedNamesForOperands
)
29 ToPrint
.emplace_back(Assignment
.first
, Assignment
.second
);
31 StringRef Separator
= "";
32 for (const auto &Assignment
: ToPrint
) {
33 OS
<< Separator
<< "$" << Assignment
.second
<< "=getOperand("
34 << Assignment
.first
<< ")";
40 void GIMatchDagInstr::setMatchRoot() {
42 Dag
.addMatchRoot(this);
45 raw_ostream
&llvm::operator<<(raw_ostream
&OS
, const GIMatchDagInstr
&N
) {