redFsm->errState = allStates + errState;
for ( EntryIdVect::Iter en = entryPointIds; en.lte(); en++ )
redFsm->entryPoints.insert( allStates + *en );
+
+ /* The nextStateId is no longer used to assign state ids (they come in set
+ * from the frontend now), however generation code still depends on it.
+ * Should eventually remove this variable. */
+ redFsm->nextStateId = redFsm->stateList.length();
}
void CodeGenData::setStartState( unsigned long startState )
}
}
+void RedFsmAp::sortByStateId()
+{
+ /* FIXME: Implement. */
+}
+
/* Find the final state with the lowest id. */
void RedFsmAp::findFirstFinState()
{
/* Arrange states in by final id. This is a stable sort. */
void sortStatesByFinal();
+ /* Sorting states by id. */
+ void sortByStateId();
+
/* Locating the first final state. This is the final state with the lowest
* id. */
void findFirstFinState();
redFsm->assignActionLocs();
- /* Order the states. */
- redFsm->depthFirstOrdering();
-
if ( codeStyle == GenGoto || codeStyle == GenFGoto ||
codeStyle == GenIpGoto || codeStyle == GenSplit )
{
- /* For goto driven machines we can keep the original depth
- * first ordering because it's ok if the state ids are not
- * sequential. Split the the ids by final state status. */
- redFsm->sortStateIdsByFinal();
+ /* For directly executable machines there is no required state
+ * ordering. Choose a depth-first ordering to increase the
+ * potential for fall-throughs. */
+ redFsm->depthFirstOrdering();
}
else {
- /* For table driven machines the location of the state is used to
- * identify it so the states must be sorted by their final ids.
- * Though having a deterministic ordering is important,
- * specifically preserving the depth first ordering is not because
- * states are stored in tables. */
- redFsm->sortStatesByFinal();
- redFsm->sequentialStateIds();
+ /* The frontend will do this for us, but it may be a good idea to
+ * force it if the intermediate file is edited. */
+ redFsm->sortByStateId();
}
/* Find the first final state. This is the final state with the lowest
redFsm->assignActionLocs();
- /* Order the states. */
- redFsm->depthFirstOrdering();
-
- /* For table driven machines the location of the state is used to
- * identify it so the states must be sorted by their final ids.
- * Though having a deterministic ordering is important,
- * specifically preserving the depth first ordering is not because
- * states are stored in tables. */
- redFsm->sortStatesByFinal();
- redFsm->sequentialStateIds();
+ /* The frontend will do this for us, but it may be a good idea to force it
+ * if the intermediate file is edited. */
+ redFsm->sortByStateId();
/* Find the first final state. This is the final state with the lowest
* id. */
redFsm->assignActionLocs();
- /* Order the states. */
- redFsm->depthFirstOrdering();
-
- /* For table driven machines the location of the state is used to
- * identify it so the states must be sorted by their final ids.
- * Though having a deterministic ordering is important,
- * specifically preserving the depth first ordering is not because
- * states are stored in tables. */
- redFsm->sortStatesByFinal();
- redFsm->sequentialStateIds();
+ /* The frontend will do this for us, but it may be a good idea to force it
+ * if the intermediate file is edited. */
+ redFsm->sortByStateId();
/* Find the first final state. This is the final state with the lowest
* id. */