[ORC] Add std::tuple support to SimplePackedSerialization.
[llvm-project.git] / llvm / utils / TableGen / GlobalISel / GIMatchDagInstr.cpp
blobad9fbea8f88151a556c193a79784d0b2952e7367
1 //===- GIMatchDagInstr.cpp - A shared operand list for nodes --------------===//
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 "GIMatchDagInstr.h"
10 #include "../CodeGenInstruction.h"
11 #include "GIMatchDag.h"
12 #include "llvm/TableGen/Record.h"
14 using namespace llvm;
16 void GIMatchDagInstr::print(raw_ostream &OS) const {
17 OS << "(";
18 if (const auto *Annotation = getOpcodeAnnotation())
19 OS << Annotation->TheDef->getName();
20 else
21 OS << "<unknown>";
22 OS << " ";
23 OperandInfo.print(OS);
24 OS << "):$" << Name;
25 if (!UserAssignedNamesForOperands.empty()) {
26 OS << " // ";
27 SmallVector<std::pair<unsigned, StringRef>, 8> ToPrint;
28 for (const auto &Assignment : UserAssignedNamesForOperands)
29 ToPrint.emplace_back(Assignment.first, Assignment.second);
30 llvm::sort(ToPrint);
31 StringRef Separator = "";
32 for (const auto &Assignment : ToPrint) {
33 OS << Separator << "$" << Assignment.second << "=getOperand("
34 << Assignment.first << ")";
35 Separator = ", ";
40 void GIMatchDagInstr::setMatchRoot() {
41 IsMatchRoot = true;
42 Dag.addMatchRoot(this);
45 raw_ostream &llvm::operator<<(raw_ostream &OS, const GIMatchDagInstr &N) {
46 N.print(OS);
47 return OS;