1//===-- ARMHazardRecognizer.h - ARM Hazard Recognizers ----------*- C++ -*-===//
2//
3//                     The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9//
10// This file defines hazard recognizers for scheduling ARM functions.
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef ARMHAZARDRECOGNIZER_H
15#define ARMHAZARDRECOGNIZER_H
16
17#include "llvm/CodeGen/ScoreboardHazardRecognizer.h"
18
19namespace llvm {
20
21class ARMBaseInstrInfo;
22class ARMBaseRegisterInfo;
23class ARMSubtarget;
24class MachineInstr;
25
26/// ARMHazardRecognizer handles special constraints that are not expressed in
27/// the scheduling itinerary. This is only used during postRA scheduling. The
28/// ARM preRA scheduler uses an unspecialized instance of the
29/// ScoreboardHazardRecognizer.
30class ARMHazardRecognizer : public ScoreboardHazardRecognizer {
31  const ARMBaseInstrInfo &TII;
32  const ARMBaseRegisterInfo &TRI;
33  const ARMSubtarget &STI;
34
35  MachineInstr *LastMI;
36  unsigned FpMLxStalls;
37
38public:
39  ARMHazardRecognizer(const InstrItineraryData *ItinData,
40                      const ARMBaseInstrInfo &tii,
41                      const ARMBaseRegisterInfo &tri,
42                      const ARMSubtarget &sti,
43                      const ScheduleDAG *DAG) :
44    ScoreboardHazardRecognizer(ItinData, DAG, "post-RA-sched"), TII(tii),
45    TRI(tri), STI(sti), LastMI(0) {}
46
47  virtual HazardType getHazardType(SUnit *SU, int Stalls);
48  virtual void Reset();
49  virtual void EmitInstruction(SUnit *SU);
50  virtual void AdvanceCycle();
51  virtual void RecedeCycle();
52};
53
54} // end namespace llvm
55
56#endif // ARMHAZARDRECOGNIZER_H
57