+
+ DEBUG(dbgs() << " thisState: 0x" << utohexstr(thisState) << "\n");
+ AddInsnClassStages(InsnClass, ComboBitToBitsMap,
+ numstages - 1, numstages,
+ thisState, thisState,
+ VisitedResourceStates, PossibleStates);
+ }
+}
+
+void State::AddInsnClassStages(std::vector<unsigned> &InsnClass,
+ std::map<unsigned, unsigned> &ComboBitToBitsMap,
+ unsigned chkstage, unsigned numstages,
+ unsigned prevState, unsigned origState,
+ DenseSet<unsigned> &VisitedResourceStates,
+ std::set<unsigned> &PossibleStates) const {
+
+ assert((chkstage < numstages) && "AddInsnClassStages: stage out of range");
+ unsigned thisStage = InsnClass[chkstage];
+
+ dbgsIndent((1 + numstages - chkstage) << 1);
+ DEBUG(dbgs() << "AddInsnClassStages " << chkstage
+ << " (0x" << utohexstr(thisStage) << ") from ");
+ dbgsInsnClass(InsnClass);
+ DEBUG(dbgs() << "\n");
+
+ //
+ // Iterate over all possible resources used in thisStage.
+ // For ex: for thisStage = 0x11, all resources = {0x01, 0x10}.
+ //
+ for (unsigned int j = 0; j < DFA_MAX_RESOURCES; ++j) {
+ unsigned resourceMask = (0x1 << j);
+ if (resourceMask & thisStage) {
+ unsigned combo = ComboBitToBitsMap[resourceMask];
+ if (combo && ((~prevState & combo) != combo)) {
+ DEBUG(dbgs() << "\tSkipped Add 0x" << utohexstr(prevState)
+ << " - combo op 0x" << utohexstr(resourceMask)
+ << " (0x" << utohexstr(combo) <<") cannot be scheduled\n");
+ continue;
+ }
+ //
+ // For each possible resource used in thisStage, generate the
+ // resource state if that resource was used.
+ //
+ unsigned ResultingResourceState = prevState | resourceMask | combo;
+ dbgsIndent((2 + numstages - chkstage) << 1);
+ DEBUG(dbgs() << "0x" << utohexstr(prevState)
+ << " | 0x" << utohexstr(resourceMask));
+ if (combo) {
+ DEBUG(dbgs() << " | 0x" << utohexstr(combo));
+ }
+ DEBUG(dbgs() << " = 0x" << utohexstr(ResultingResourceState) << " ");
+
+ //
+ // If this is the final stage for this class
+ //
+ if (chkstage == 0) {