ARMHazardRecognizer.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. //===-- ARMHazardRecognizer.h - ARM Hazard Recognizers ----------*- 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 defines hazard recognizers for scheduling ARM functions.
  10. //
  11. //===----------------------------------------------------------------------===//
  12. #ifndef LLVM_LIB_TARGET_ARM_ARMHAZARDRECOGNIZER_H
  13. #define LLVM_LIB_TARGET_ARM_ARMHAZARDRECOGNIZER_H
  14. #include "ARMBaseInstrInfo.h"
  15. #include "llvm/ADT/BitmaskEnum.h"
  16. #include "llvm/ADT/SmallVector.h"
  17. #include "llvm/CodeGen/ScheduleHazardRecognizer.h"
  18. #include "llvm/Support/DataTypes.h"
  19. #include <array>
  20. #include <initializer_list>
  21. namespace llvm {
  22. class DataLayout;
  23. class MachineFunction;
  24. class MachineInstr;
  25. class ScheduleDAG;
  26. // Hazards related to FP MLx instructions
  27. class ARMHazardRecognizerFPMLx : public ScheduleHazardRecognizer {
  28. MachineInstr *LastMI = nullptr;
  29. unsigned FpMLxStalls = 0;
  30. public:
  31. ARMHazardRecognizerFPMLx() { MaxLookAhead = 1; }
  32. HazardType getHazardType(SUnit *SU, int Stalls) override;
  33. void Reset() override;
  34. void EmitInstruction(SUnit *SU) override;
  35. void AdvanceCycle() override;
  36. void RecedeCycle() override;
  37. };
  38. // Hazards related to bank conflicts
  39. class ARMBankConflictHazardRecognizer : public ScheduleHazardRecognizer {
  40. SmallVector<MachineInstr *, 8> Accesses;
  41. const MachineFunction &MF;
  42. const DataLayout &DL;
  43. int64_t DataMask;
  44. bool AssumeITCMBankConflict;
  45. public:
  46. ARMBankConflictHazardRecognizer(const ScheduleDAG *DAG, int64_t DDM,
  47. bool ABC);
  48. HazardType getHazardType(SUnit *SU, int Stalls) override;
  49. void Reset() override;
  50. void EmitInstruction(SUnit *SU) override;
  51. void AdvanceCycle() override;
  52. void RecedeCycle() override;
  53. private:
  54. inline HazardType CheckOffsets(unsigned O0, unsigned O1);
  55. };
  56. } // end namespace llvm
  57. #endif