diff options
| author | David Goodwin <david_goodwin@apple.com> | 2009-08-10 15:55:25 +0000 |
|---|---|---|
| committer | David Goodwin <david_goodwin@apple.com> | 2009-08-10 15:55:25 +0000 |
| commit | 6021b4dccc6b134a4ee91ba5481a18c063625f1b (patch) | |
| tree | 6aa3d78c4fa6d2650c8cd9037e1d8bcb19e0bce1 /llvm/lib/CodeGen/ExactHazardRecognizer.h | |
| parent | 5bb93ce7697210356ba5f11ae286bfbc827755c5 (diff) | |
| download | bcm5719-llvm-6021b4dccc6b134a4ee91ba5481a18c063625f1b.tar.gz bcm5719-llvm-6021b4dccc6b134a4ee91ba5481a18c063625f1b.zip | |
Post RA scheduler changes. Introduce a hazard recognizer that uses the target schedule information to accurately model the pipeline. Update the scheduler to correctly handle multi-issue targets.
llvm-svn: 78563
Diffstat (limited to 'llvm/lib/CodeGen/ExactHazardRecognizer.h')
| -rw-r--r-- | llvm/lib/CodeGen/ExactHazardRecognizer.h | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/ExactHazardRecognizer.h b/llvm/lib/CodeGen/ExactHazardRecognizer.h new file mode 100644 index 00000000000..71ac979e6cd --- /dev/null +++ b/llvm/lib/CodeGen/ExactHazardRecognizer.h @@ -0,0 +1,61 @@ +//=- llvm/CodeGen/ExactHazardRecognizer.h - Scheduling Support -*- C++ -*-=// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file implements the ExactHazardRecognizer class, which +// implements hazard-avoidance heuristics for scheduling, based on the +// scheduling itineraries specified for the target. +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_CODEGEN_EXACTHAZARDRECOGNIZER_H +#define LLVM_CODEGEN_EXACTHAZARDRECOGNIZER_H + +#include "llvm/CodeGen/ScheduleHazardRecognizer.h" +#include "llvm/CodeGen/ScheduleDAG.h" +#include "llvm/Target/TargetInstrItineraries.h" + +namespace llvm { + class ExactHazardRecognizer : public ScheduleHazardRecognizer { + // Itinerary data for the target. + const InstrItineraryData &ItinData; + + // Scoreboard to track function unit usage. Scoreboard[0] is a + // mask of the FUs in use in the cycle currently being + // schedule. Scoreboard[1] is a mask for the next cycle. The + // Scoreboard is used as a circular buffer with the current cycle + // indicated by ScoreboardHead. + unsigned *Scoreboard; + + // The maximum number of cycles monitored by the Scoreboard. This + // value is determined based on the target itineraries to ensure + // that all hazards can be tracked. + unsigned ScoreboardDepth; + + // Indices into the Scoreboard that represent the current cycle. + unsigned ScoreboardHead; + + // Return the scoreboard index to use for 'offset' cycles in the + // future. 'offset' of 0 returns ScoreboardHead. + unsigned getFutureIndex(unsigned offset); + + // Print the scoreboard. + void dumpScoreboard(); + + public: + ExactHazardRecognizer(const InstrItineraryData &ItinData); + ~ExactHazardRecognizer(); + + virtual HazardType getHazardType(SUnit *SU); + virtual void Reset(); + virtual void EmitInstruction(SUnit *SU); + virtual void AdvanceCycle(); + }; +} + +#endif |

