diff options
-rw-r--r-- | colm/compiler.cc | 8 | ||||
-rw-r--r-- | colm/fsmap.cc | 1 | ||||
-rw-r--r-- | colm/fsmcodegen.cc | 10 | ||||
-rw-r--r-- | colm/fsmgraph.h | 12 | ||||
-rw-r--r-- | colm/fsmstate.cc | 30 | ||||
-rw-r--r-- | colm/parsedata.h | 2 | ||||
-rw-r--r-- | colm/redbuild.cc | 87 | ||||
-rw-r--r-- | colm/redfsm.cc | 30 |
8 files changed, 4 insertions, 176 deletions
diff --git a/colm/compiler.cc b/colm/compiler.cc index 41ec82a8..7fbf66d1 100644 --- a/colm/compiler.cc +++ b/colm/compiler.cc @@ -738,9 +738,6 @@ void Compiler::initKeyOps( ) thisKeyOps.minKey = makeFsmKeyNum( lowerNum, rangeLowLoc, this ); thisKeyOps.maxKey = makeFsmKeyNum( upperNum, rangeHighLoc, this ); } - - thisCondData.nextCondKey = thisKeyOps.maxKey; - thisCondData.nextCondKey.increment(); } void Compiler::printNameInst( NameInst *nameInst, int level ) @@ -996,11 +993,6 @@ void Compiler::analyzeGraph( FsmGraph *graph ) for ( ActionTable::Iter at = st->eofActionTable; at.lte(); at++ ) at->value->numEofRefs += 1; - - for ( StateCondList::Iter sc = st->stateCondList; sc.lte(); sc++ ) { - for ( CondSet::Iter sci = sc->condSpace->condSet; sci.lte(); sci++ ) - (*sci)->numCondRefs += 1; - } } } diff --git a/colm/fsmap.cc b/colm/fsmap.cc index 3026ce5c..e70e5887 100644 --- a/colm/fsmap.cc +++ b/colm/fsmap.cc @@ -27,7 +27,6 @@ using std::cerr; using std::endl; -CondData *condData = 0; KeyOps *keyOps = 0; /* Insert an action into an action table. */ diff --git a/colm/fsmcodegen.cc b/colm/fsmcodegen.cc index 16fbaff0..42085009 100644 --- a/colm/fsmcodegen.cc +++ b/colm/fsmcodegen.cc @@ -126,18 +126,12 @@ string FsmCodeGen::CS() string FsmCodeGen::GET_WIDE_KEY() { - if ( redFsm->anyConditions() ) - return "_widec"; - else - return GET_KEY(); + return GET_KEY(); } string FsmCodeGen::GET_WIDE_KEY( RedState *state ) { - if ( state->stateCondList.length() > 0 ) - return "_widec"; - else - return GET_KEY(); + return GET_KEY(); } string FsmCodeGen::GET_KEY() diff --git a/colm/fsmgraph.h b/colm/fsmgraph.h index 250f5204..0fc5344a 100644 --- a/colm/fsmgraph.h +++ b/colm/fsmgraph.h @@ -478,18 +478,6 @@ struct StateCond typedef DList<StateCond> StateCondList; typedef Vector<long> LongVect; -struct CondData -{ - CondData() : nextCondKey(0) {} - - /* Condition info. */ - Key nextCondKey; - - CondSpaceMap condSpaceMap; -}; - -extern CondData *condData; - /* State class that implements actions and priorities. */ struct FsmState { diff --git a/colm/fsmstate.cc b/colm/fsmstate.cc index dae1479b..f917302e 100644 --- a/colm/fsmstate.cc +++ b/colm/fsmstate.cc @@ -80,9 +80,6 @@ FsmState::FsmState() entryIds(), epsilonTrans(), - /* Conditions. */ - stateCondList(), - /* No transitions in from other states. */ foreignInTrans(0), @@ -122,9 +119,6 @@ FsmState::FsmState(const FsmState &other) entryIds(other.entryIds), epsilonTrans(other.epsilonTrans), - /* Copy in the elements of the conditions. */ - stateCondList( other.stateCondList ), - /* No transitions in from other states. */ foreignInTrans(0), @@ -246,30 +240,6 @@ int InitPartitionCompare::compare( const FsmState *state1 , const FsmState *stat if ( compareRes != 0 ) return compareRes; - /* Use a pair iterator to test the condition pairs. */ - PairIter<StateCond> condPair( state1->stateCondList.head, state2->stateCondList.head ); - for ( ; !condPair.end(); condPair++ ) { - switch ( condPair.userState ) { - case RangeInS1: - return 1; - case RangeInS2: - return -1; - - case RangeOverlap: { - CondSpace *condSpace1 = condPair.s1Tel.trans->condSpace; - CondSpace *condSpace2 = condPair.s2Tel.trans->condSpace; - if ( condSpace1 < condSpace2 ) - return -1; - else if ( condSpace1 > condSpace2 ) - return 1; - break; - } - case BreakS1: - case BreakS2: - break; - } - } - /* Use a pair iterator to test the transition pairs. */ PairIter<FsmTrans> outPair( state1->outList.head, state2->outList.head ); for ( ; !outPair.end(); outPair++ ) { diff --git a/colm/parsedata.h b/colm/parsedata.h index 6f0839c7..69e97be6 100644 --- a/colm/parsedata.h +++ b/colm/parsedata.h @@ -689,11 +689,9 @@ struct Compiler void beginProcessing() { - ::condData = &thisCondData; ::keyOps = &thisKeyOps; } - CondData thisCondData; KeyOps thisKeyOps; UniqueType *mainReturnUT; diff --git a/colm/redbuild.cc b/colm/redbuild.cc index ae5faf38..87d73586 100644 --- a/colm/redbuild.cc +++ b/colm/redbuild.cc @@ -233,61 +233,14 @@ void RedFsmBuild::setStateActions( int snum, long toStateAction, void RedFsmBuild::closeMachine() { - //for ( GenActionList::Iter a = redFsm->actionList; a.lte(); a++ ) - // resolveTargetStates( a->inlineList ); - - /* Note that even if we want a complete graph we do not give the error - * state a default transition. All machines break out of the processing - * loop when in the error state. */ - - for ( RedStateList::Iter st = redFsm->stateList; st.lte(); st++ ) { - for ( GenStateCondList::Iter sci = st->stateCondList; sci.lte(); sci++ ) - st->stateCondVect.append( sci ); - } -} - -void RedFsmBuild::initCondSpaceList( ulong length ) -{ - redFsm->allCondSpaces = new GenCondSpace[length]; - for ( ulong c = 0; c < length; c++ ) - redFsm->condSpaceList.append( redFsm->allCondSpaces + c ); -} - -void RedFsmBuild::newCondSpace( int cnum, int condSpaceId, Key baseKey ) -{ - GenCondSpace *cond = redFsm->allCondSpaces + cnum; - cond->condSpaceId = condSpaceId; - cond->baseKey = baseKey; } -void RedFsmBuild::condSpaceItem( int cnum, long condActionId ) -{ - GenCondSpace *cond = redFsm->allCondSpaces + cnum; - cond->condSet.append( redFsm->allActions + condActionId ); -} void RedFsmBuild::initStateCondList( int snum, ulong length ) { /* Could preallocate these, as we could with transitions. */ } -void RedFsmBuild::addStateCond( int snum, Key lowKey, Key highKey, long condNum ) -{ - RedState *curState = redFsm->allStates + snum; - - /* Create the new state condition. */ - GenStateCond *stateCond = new GenStateCond; - stateCond->lowKey = lowKey; - stateCond->highKey = highKey; - - /* Assign it a cond space. */ - GenCondSpace *condSpace = redFsm->allCondSpaces + condNum; - stateCond->condSpace = condSpace; - - curState->stateCondList.append( stateCond ); -} - - void RedFsmBuild::setForcedErrorState() { redFsm->forcedErrorState = true; @@ -493,23 +446,6 @@ void RedFsmBuild::makeStateActions( FsmState *state ) } } -void RedFsmBuild::makeStateConditions( FsmState *state ) -{ - if ( state->stateCondList.length() > 0 ) { - - long length = state->stateCondList.length(); - initStateCondList( curState, length ); - curStateCond = 0; - - for ( StateCondList::Iter scdi = state->stateCondList; scdi.lte(); scdi++ ) { - Key lowKey = scdi->lowKey; - Key highKey = scdi->highKey; - long condId = scdi->condSpace->condSpaceId; - addStateCond( curState, lowKey, highKey, condId ); - } - } -} - void RedFsmBuild::makeStateList() { /* Write the list of states. */ @@ -522,7 +458,6 @@ void RedFsmBuild::makeStateList() assert( !( (st->eofTarget != 0) xor (st->eofActionTable.length() > 0) ) ); makeStateActions( st ); - makeStateConditions( st ); makeTransList( st ); setId( curState, st->alg.stateNum ); @@ -590,28 +525,6 @@ void RedFsmBuild::makeMachine() void RedFsmBuild::makeConditions() { - if ( condData->condSpaceMap.length() > 0 ) { - long nextCondSpaceId = 0; - for ( CondSpaceMap::Iter cs = condData->condSpaceMap; cs.lte(); cs++ ) - cs->condSpaceId = nextCondSpaceId++; - - long length = condData->condSpaceMap.length(); - initCondSpaceList( length ); - curCondSpace = 0; - - for ( CondSpaceMap::Iter cs = condData->condSpaceMap; cs.lte(); cs++ ) { - long condSpaceId = cs->condSpaceId; - Key baseKey = cs->baseKey; - - newCondSpace( curCondSpace, condSpaceId, baseKey ); - for ( CondSet::Iter csi = cs->condSet; csi.lte(); csi++ ) { - long actionOffset = (*csi)->actionId; - condSpaceItem( curCondSpace, actionOffset ); - } - - curCondSpace += 1; - } - } } RedFsm *RedFsmBuild::reduceMachine() diff --git a/colm/redfsm.cc b/colm/redfsm.cc index d3a65b7c..090157b3 100644 --- a/colm/redfsm.cc +++ b/colm/redfsm.cc @@ -303,26 +303,8 @@ void RedFsm::chooseSingle() void RedFsm::makeFlat() { for ( RedStateList::Iter st = stateList; st.lte(); st++ ) { - if ( st->stateCondList.length() == 0 ) { - st->condLowKey = 0; - st->condHighKey = 0; - } - else { - st->condLowKey = st->stateCondList.head->lowKey; - st->condHighKey = st->stateCondList.tail->highKey; - - unsigned long long span = keyOps->span( st->condLowKey, st->condHighKey ); - st->condList = new GenCondSpace*[ span ]; - memset( st->condList, 0, sizeof(GenCondSpace*)*span ); - - for ( GenStateCondList::Iter sci = st->stateCondList; sci.lte(); sci++ ) { - unsigned long long base, trSpan; - base = keyOps->span( st->condLowKey, sci->lowKey )-1; - trSpan = keyOps->span( sci->lowKey, sci->highKey ); - for ( unsigned long long pos = 0; pos < trSpan; pos++ ) - st->condList[base+pos] = sci->condSpace; - } - } + st->condLowKey = 0; + st->condHighKey = 0; if ( st->outRange.length() == 0 ) { st->lowKey = st->highKey = 0; @@ -651,10 +633,6 @@ void RedFsm::setValueLimits() } for ( RedStateList::Iter st = stateList; st.lte(); st++ ) { - /* Maximum cond length. */ - if ( st->stateCondList.length() > maxCondLen ) - maxCondLen = st->stateCondList.length(); - /* Maximum single length. */ if ( st->outSingle.length() > maxSingleLen ) maxSingleLen = st->outSingle.length(); @@ -665,7 +643,6 @@ void RedFsm::setValueLimits() /* The key offset index offset for the state after last is not used, skip it.. */ if ( ! st.last() ) { - maxCondOffset += st->stateCondList.length(); maxKeyOffset += st->outSingle.length() + st->outRange.length()*2; maxIndexOffset += st->outSingle.length() + st->outRange.length() + 1; } @@ -853,9 +830,6 @@ void RedFsm::analyzeMachine() if ( st->defTrans != 0 && st->defTrans->action != 0 && st->defTrans->action->anyCurStateRef() ) st->bAnyRegCurStateRef = true; - - if ( st->stateCondList.length() > 0 ) - bAnyConditions = true; } /* Assign ids to actions that are referenced. */ |