aboutsummaryrefslogtreecommitdiff
path: root/include/llvm/Target/TargetInstrItineraries.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/llvm/Target/TargetInstrItineraries.h')
-rw-r--r--include/llvm/Target/TargetInstrItineraries.h52
1 files changed, 52 insertions, 0 deletions
diff --git a/include/llvm/Target/TargetInstrItineraries.h b/include/llvm/Target/TargetInstrItineraries.h
index 3a622c7732..3be5b9513a 100644
--- a/include/llvm/Target/TargetInstrItineraries.h
+++ b/include/llvm/Target/TargetInstrItineraries.h
@@ -16,6 +16,8 @@
#ifndef LLVM_TARGET_TARGETINSTRITINERARIES_H
#define LLVM_TARGET_TARGETINSTRITINERARIES_H
+#include "llvm/Support/Debug.h"
+
namespace llvm {
//===----------------------------------------------------------------------===//
@@ -41,6 +43,56 @@ struct InstrItinerary {
};
+
+//===----------------------------------------------------------------------===//
+// Instruction itinerary Data - Itinerary data supplied by a subtarget to be
+// used by a target.
+//
+class InstrItineraryData {
+ InstrStage *Stages; // Array of stages selected
+ unsigned NStages; // Number of stages
+ InstrItinerary *Itineratries; // Array of itineraries selected
+ unsigned NItineraries; // Number of itineraries (actually classes)
+
+public:
+
+ //
+ // Ctors.
+ //
+ InstrItineraryData()
+ : Stages(NULL), NStages(0), Itineratries(NULL), NItineraries(0)
+ {}
+ InstrItineraryData(InstrStage *S, unsigned NS, InstrItinerary *I, unsigned NI)
+ : Stages(S), NStages(NS), Itineratries(I), NItineraries(NI)
+ {}
+
+ //
+ // isEmpty - Returns true if there are no itineraries.
+ //
+ inline bool isEmpty() const { return NItineraries == 0; }
+
+ //
+ // begin - Return the first stage of the itinerary.
+ //
+ inline InstrStage *begin(unsigned ItinClassIndx) const {
+ assert(ItinClassIndx < NItineraries && "Itinerary index out of range");
+ unsigned StageIdx = Itineratries[ItinClassIndx].First;
+ assert(StageIdx < NStages && "Stage index out of range");
+ return Stages + StageIdx;
+ }
+
+ //
+ // end - Return the last+1 stage of the itinerary.
+ //
+ inline InstrStage *end(unsigned ItinClassIndx) const {
+ assert(ItinClassIndx < NItineraries && "Itinerary index out of range");
+ unsigned StageIdx = Itineratries[ItinClassIndx].Last;
+ assert(StageIdx < NStages && "Stage index out of range");
+ return Stages + StageIdx;
+ }
+};
+
+
} // End llvm namespace
#endif