MultiHazardRecognizer.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. #pragma once
  2. #ifdef __GNUC__
  3. #pragma GCC diagnostic push
  4. #pragma GCC diagnostic ignored "-Wunused-parameter"
  5. #endif
  6. //=- llvm/CodeGen/MultiHazardRecognizer.h - Scheduling Support ----*- C++ -*-=//
  7. //
  8. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  9. // See https://llvm.org/LICENSE.txt for license information.
  10. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  11. //
  12. //===----------------------------------------------------------------------===//
  13. //
  14. // This file implements the MultiHazardRecognizer class, which is a wrapper
  15. // for a set of ScheduleHazardRecognizer instances
  16. //
  17. //===----------------------------------------------------------------------===//
  18. #ifndef LLVM_CODEGEN_MULTIHAZARDRECOGNIZER_H
  19. #define LLVM_CODEGEN_MULTIHAZARDRECOGNIZER_H
  20. #include "llvm/ADT/SmallVector.h"
  21. #include "llvm/CodeGen/ScheduleHazardRecognizer.h"
  22. namespace llvm {
  23. class MachineInstr;
  24. class SUnit;
  25. class MultiHazardRecognizer : public ScheduleHazardRecognizer {
  26. SmallVector<std::unique_ptr<ScheduleHazardRecognizer>, 4> Recognizers;
  27. public:
  28. MultiHazardRecognizer() = default;
  29. void AddHazardRecognizer(std::unique_ptr<ScheduleHazardRecognizer> &&);
  30. bool atIssueLimit() const override;
  31. HazardType getHazardType(SUnit *, int Stalls = 0) override;
  32. void Reset() override;
  33. void EmitInstruction(SUnit *) override;
  34. void EmitInstruction(MachineInstr *) override;
  35. unsigned PreEmitNoops(SUnit *) override;
  36. unsigned PreEmitNoops(MachineInstr *) override;
  37. bool ShouldPreferAnother(SUnit *) override;
  38. void AdvanceCycle() override;
  39. void RecedeCycle() override;
  40. void EmitNoop() override;
  41. };
  42. } // end namespace llvm
  43. #endif // LLVM_CODEGEN_MULTIHAZARDRECOGNIZER_H
  44. #ifdef __GNUC__
  45. #pragma GCC diagnostic pop
  46. #endif