blob: 71ac979e6cd8d1eed39c5452fecff4549f4310d5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
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
|