[ORC] Add std::tuple support to SimplePackedSerialization.
[llvm-project.git] / llvm / utils / TableGen / GlobalISel / GIMatchDagEdge.cpp
blobe59cb3aae49a9c323187868d9f3e97378337e3b4
1 //===- GIMatchDagEdge.cpp - An edge describing a def/use lookup -----------===//
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 "GIMatchDagEdge.h"
10 #include "GIMatchDagInstr.h"
11 #include "llvm/Support/raw_ostream.h"
13 using namespace llvm;
15 LLVM_DUMP_METHOD void GIMatchDagEdge::print(raw_ostream &OS) const {
16 OS << getFromMI()->getName() << "[" << getFromMO()->getName() << "] --["
17 << Name << "]--> " << getToMI()->getName() << "[" << getToMO()->getName()
18 << "]";
21 bool GIMatchDagEdge::isDefToUse() const {
22 // Def -> Def is invalid so we only need to check FromMO.
23 return FromMO->isDef();
26 void GIMatchDagEdge::reverse() {
27 std::swap(FromMI, ToMI);
28 std::swap(FromMO, ToMO);
31 #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
32 LLVM_DUMP_METHOD void GIMatchDagEdge::dump() const { print(errs()); }
33 #endif // if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
35 raw_ostream &llvm::operator<<(raw_ostream &OS, const GIMatchDagEdge &E) {
36 E.print(OS);
37 return OS;