1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 19:23:23 +01:00
llvm-mirror/utils/TableGen/GlobalISel/GIMatchDagInstr.cpp
Daniel Sanders c57301aa25 Revert "Temporarily Revert "[gicombiner] Add the MatchDag structure and parse instruction DAG's from the input""
This reverts commit e62e760f29567fe0841af870c65a4f8ef685d217.

The issue @uweigand raised should have been fixed by iterating over the
vector that owns the operand list data instead of the FoldingSet.

The MSVC issue raised by @thakis should have been fixed by relaxing the
regexes a little. I don't have a Windows machine available to test that so
I tested it by using `perl -p -e 's/0x([0-9a-f]+)/\U\1\E/g' to convert the
output of %p to the windows style.

I've guessed at the issue @phosek raised as there wasn't enough information
to investigate it. What I think is happening on that bot is the -debug
option isn't available because the second stage build is a release build.
I'm not sure why other release-mode bots didn't report it though.
2019-12-18 11:37:12 +00:00

49 lines
1.4 KiB
C++

//===- GIMatchDagInstr.cpp - A shared operand list for nodes --------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#include "GIMatchDagInstr.h"
#include "../CodeGenInstruction.h"
#include "GIMatchDag.h"
#include "llvm/TableGen/Record.h"
using namespace llvm;
void GIMatchDagInstr::print(raw_ostream &OS) const {
OS << "(";
if (const auto *Annotation = getOpcodeAnnotation())
OS << Annotation->TheDef->getName();
else
OS << "<unknown>";
OS << " ";
OperandInfo.print(OS);
OS << "):$" << Name;
if (!UserAssignedNamesForOperands.empty()) {
OS << " // ";
SmallVector<std::pair<unsigned, StringRef>, 8> ToPrint;
for (const auto &Assignment : UserAssignedNamesForOperands)
ToPrint.emplace_back(Assignment.first, Assignment.second);
llvm::sort(ToPrint.begin(), ToPrint.end());
StringRef Separator = "";
for (const auto &Assignment : ToPrint) {
OS << Separator << "$" << Assignment.second << "=getOperand("
<< Assignment.first << ")";
Separator = ", ";
}
}
}
void GIMatchDagInstr::setMatchRoot() {
IsMatchRoot = true;
Dag.addMatchRoot(this);
}
raw_ostream &llvm::operator<<(raw_ostream &OS, const GIMatchDagInstr &N) {
N.print(OS);
return OS;
}