Olivier Deprez | f4ef2d0 | 2021-04-20 13:36:24 +0200 | [diff] [blame] | 1 | //=- llvm/CodeGen/MultiHazardRecognizer.h - Scheduling Support ----*- C++ -*-=// |
| 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 | //===----------------------------------------------------------------------===// |
| 8 | // |
| 9 | // This file implements the MultiHazardRecognizer class, which is a wrapper |
| 10 | // for a set of ScheduleHazardRecognizer instances |
| 11 | // |
| 12 | //===----------------------------------------------------------------------===// |
| 13 | |
| 14 | #ifndef LLVM_CODEGEN_MULTIHAZARDRECOGNIZER_H |
| 15 | #define LLVM_CODEGEN_MULTIHAZARDRECOGNIZER_H |
| 16 | |
| 17 | #include "llvm/ADT/SmallVector.h" |
| 18 | #include "llvm/CodeGen/ScheduleHazardRecognizer.h" |
| 19 | |
| 20 | namespace llvm { |
| 21 | |
| 22 | class MachineInstr; |
| 23 | class SUnit; |
| 24 | |
| 25 | class MultiHazardRecognizer : public ScheduleHazardRecognizer { |
| 26 | SmallVector<std::unique_ptr<ScheduleHazardRecognizer>, 4> Recognizers; |
| 27 | |
| 28 | public: |
| 29 | MultiHazardRecognizer() = default; |
| 30 | void AddHazardRecognizer(std::unique_ptr<ScheduleHazardRecognizer> &&); |
| 31 | |
| 32 | bool atIssueLimit() const override; |
| 33 | HazardType getHazardType(SUnit *, int Stalls = 0) override; |
| 34 | void Reset() override; |
| 35 | void EmitInstruction(SUnit *) override; |
| 36 | void EmitInstruction(MachineInstr *) override; |
| 37 | unsigned PreEmitNoops(SUnit *) override; |
| 38 | unsigned PreEmitNoops(MachineInstr *) override; |
| 39 | bool ShouldPreferAnother(SUnit *) override; |
| 40 | void AdvanceCycle() override; |
| 41 | void RecedeCycle() override; |
| 42 | void EmitNoop() override; |
| 43 | }; |
| 44 | |
| 45 | } // end namespace llvm |
| 46 | |
| 47 | #endif // LLVM_CODEGEN_MULTIHAZARDRECOGNIZER_H |