diff options
author | shadchin <shadchin@yandex-team.ru> | 2022-02-10 16:44:30 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:44:30 +0300 |
commit | 2598ef1d0aee359b4b6d5fdd1758916d5907d04f (patch) | |
tree | 012bb94d777798f1f56ac1cec429509766d05181 /contrib/libs/llvm12/lib/CodeGen/MultiHazardRecognizer.cpp | |
parent | 6751af0b0c1b952fede40b19b71da8025b5d8bcf (diff) | |
download | ydb-2598ef1d0aee359b4b6d5fdd1758916d5907d04f.tar.gz |
Restoring authorship annotation for <shadchin@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'contrib/libs/llvm12/lib/CodeGen/MultiHazardRecognizer.cpp')
-rw-r--r-- | contrib/libs/llvm12/lib/CodeGen/MultiHazardRecognizer.cpp | 184 |
1 files changed, 92 insertions, 92 deletions
diff --git a/contrib/libs/llvm12/lib/CodeGen/MultiHazardRecognizer.cpp b/contrib/libs/llvm12/lib/CodeGen/MultiHazardRecognizer.cpp index e4cd92ac48..7b325e504d 100644 --- a/contrib/libs/llvm12/lib/CodeGen/MultiHazardRecognizer.cpp +++ b/contrib/libs/llvm12/lib/CodeGen/MultiHazardRecognizer.cpp @@ -1,92 +1,92 @@ -//===- MultiHazardRecognizer.cpp - Scheduler Support ----------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// -// -// This file implements the MultiHazardRecognizer class, which is a wrapper -// for a set of ScheduleHazardRecognizer instances -// -//===----------------------------------------------------------------------===// - -#include "llvm/CodeGen/MultiHazardRecognizer.h" -#include "llvm/ADT/STLExtras.h" -#include <algorithm> -#include <functional> -#include <numeric> - -using namespace llvm; - -void MultiHazardRecognizer::AddHazardRecognizer( - std::unique_ptr<ScheduleHazardRecognizer> &&R) { - MaxLookAhead = std::max(MaxLookAhead, R->getMaxLookAhead()); - Recognizers.push_back(std::move(R)); -} - -bool MultiHazardRecognizer::atIssueLimit() const { - return llvm::any_of(Recognizers, - std::mem_fn(&ScheduleHazardRecognizer::atIssueLimit)); -} - -ScheduleHazardRecognizer::HazardType -MultiHazardRecognizer::getHazardType(SUnit *SU, int Stalls) { - for (auto &R : Recognizers) { - auto res = R->getHazardType(SU, Stalls); - if (res != NoHazard) - return res; - } - return NoHazard; -} - -void MultiHazardRecognizer::Reset() { - for (auto &R : Recognizers) - R->Reset(); -} - -void MultiHazardRecognizer::EmitInstruction(SUnit *SU) { - for (auto &R : Recognizers) - R->EmitInstruction(SU); -} - -void MultiHazardRecognizer::EmitInstruction(MachineInstr *MI) { - for (auto &R : Recognizers) - R->EmitInstruction(MI); -} - -unsigned MultiHazardRecognizer::PreEmitNoops(SUnit *SU) { - auto MN = [=](unsigned a, std::unique_ptr<ScheduleHazardRecognizer> &R) { - return std::max(a, R->PreEmitNoops(SU)); - }; - return std::accumulate(Recognizers.begin(), Recognizers.end(), 0u, MN); -} - -unsigned MultiHazardRecognizer::PreEmitNoops(MachineInstr *MI) { - auto MN = [=](unsigned a, std::unique_ptr<ScheduleHazardRecognizer> &R) { - return std::max(a, R->PreEmitNoops(MI)); - }; - return std::accumulate(Recognizers.begin(), Recognizers.end(), 0u, MN); -} - -bool MultiHazardRecognizer::ShouldPreferAnother(SUnit *SU) { - auto SPA = [=](std::unique_ptr<ScheduleHazardRecognizer> &R) { - return R->ShouldPreferAnother(SU); - }; - return llvm::any_of(Recognizers, SPA); -} - -void MultiHazardRecognizer::AdvanceCycle() { - for (auto &R : Recognizers) - R->AdvanceCycle(); -} - -void MultiHazardRecognizer::RecedeCycle() { - for (auto &R : Recognizers) - R->RecedeCycle(); -} - -void MultiHazardRecognizer::EmitNoop() { - for (auto &R : Recognizers) - R->EmitNoop(); -} +//===- MultiHazardRecognizer.cpp - Scheduler Support ----------------------===// +// +// 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 +// +//===----------------------------------------------------------------------===// +// +// This file implements the MultiHazardRecognizer class, which is a wrapper +// for a set of ScheduleHazardRecognizer instances +// +//===----------------------------------------------------------------------===// + +#include "llvm/CodeGen/MultiHazardRecognizer.h" +#include "llvm/ADT/STLExtras.h" +#include <algorithm> +#include <functional> +#include <numeric> + +using namespace llvm; + +void MultiHazardRecognizer::AddHazardRecognizer( + std::unique_ptr<ScheduleHazardRecognizer> &&R) { + MaxLookAhead = std::max(MaxLookAhead, R->getMaxLookAhead()); + Recognizers.push_back(std::move(R)); +} + +bool MultiHazardRecognizer::atIssueLimit() const { + return llvm::any_of(Recognizers, + std::mem_fn(&ScheduleHazardRecognizer::atIssueLimit)); +} + +ScheduleHazardRecognizer::HazardType +MultiHazardRecognizer::getHazardType(SUnit *SU, int Stalls) { + for (auto &R : Recognizers) { + auto res = R->getHazardType(SU, Stalls); + if (res != NoHazard) + return res; + } + return NoHazard; +} + +void MultiHazardRecognizer::Reset() { + for (auto &R : Recognizers) + R->Reset(); +} + +void MultiHazardRecognizer::EmitInstruction(SUnit *SU) { + for (auto &R : Recognizers) + R->EmitInstruction(SU); +} + +void MultiHazardRecognizer::EmitInstruction(MachineInstr *MI) { + for (auto &R : Recognizers) + R->EmitInstruction(MI); +} + +unsigned MultiHazardRecognizer::PreEmitNoops(SUnit *SU) { + auto MN = [=](unsigned a, std::unique_ptr<ScheduleHazardRecognizer> &R) { + return std::max(a, R->PreEmitNoops(SU)); + }; + return std::accumulate(Recognizers.begin(), Recognizers.end(), 0u, MN); +} + +unsigned MultiHazardRecognizer::PreEmitNoops(MachineInstr *MI) { + auto MN = [=](unsigned a, std::unique_ptr<ScheduleHazardRecognizer> &R) { + return std::max(a, R->PreEmitNoops(MI)); + }; + return std::accumulate(Recognizers.begin(), Recognizers.end(), 0u, MN); +} + +bool MultiHazardRecognizer::ShouldPreferAnother(SUnit *SU) { + auto SPA = [=](std::unique_ptr<ScheduleHazardRecognizer> &R) { + return R->ShouldPreferAnother(SU); + }; + return llvm::any_of(Recognizers, SPA); +} + +void MultiHazardRecognizer::AdvanceCycle() { + for (auto &R : Recognizers) + R->AdvanceCycle(); +} + +void MultiHazardRecognizer::RecedeCycle() { + for (auto &R : Recognizers) + R->RecedeCycle(); +} + +void MultiHazardRecognizer::EmitNoop() { + for (auto &R : Recognizers) + R->EmitNoop(); +} |