Changeset 13389
- Timestamp:
- 2012-10-15T14:56:06+02:00 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Compiler/BackEnd/BackendVariable.mo
r13323 r13389 46 46 protected import Absyn; 47 47 protected import BackendDAEUtil; 48 protected import BaseHashSet; 48 49 protected import ComponentReference; 49 50 protected import DAEUtil; … … 55 56 protected import Flags; 56 57 protected import HashTable2; 58 protected import HashSet; 57 59 protected import List; 58 60 protected import SCode; … … 3423 3425 sv := varStartValueOption(inVar); 3424 3426 sva := varStartValueOption(inAVar); 3425 (v1):= mergeStartFixed(inVar,fixed,sv,inAVar,fixeda,sva,negate,knVars);3427 v1 := mergeStartFixed(inVar,fixed,sv,inAVar,fixeda,sva,negate,knVars); 3426 3428 // nominal 3427 3429 v2 := mergeNominalAttribute(inAVar,v1,negate); … … 3589 3591 end mergeStartFixed1; 3590 3592 3591 p ublicfunction replaceCrefWithBindExp3592 input tuple<DAE.Exp, tuple<BackendDAE.Variables,Boolean >> inTuple;3593 output tuple<DAE.Exp, tuple<BackendDAE.Variables,Boolean >> outTuple;3593 protected function replaceCrefWithBindExp 3594 input tuple<DAE.Exp, tuple<BackendDAE.Variables,Boolean,HashSet.HashSet>> inTuple; 3595 output tuple<DAE.Exp, tuple<BackendDAE.Variables,Boolean,HashSet.HashSet>> outTuple; 3594 3596 algorithm 3595 3597 outTuple := matchcontinue(inTuple) … … 3599 3601 DAE.ComponentRef cr; 3600 3602 Boolean b; 3603 HashSet.HashSet hs; 3601 3604 // true if crefs replaced in expression 3602 case ((DAE.CREF(componentRef=cr), (vars,_))) 3603 equation 3604 ({BackendDAE.VAR(bindExp = SOME(e))}, _) = getVar(cr, vars); 3605 ((e, _)) = Expression.traverseExp(e, replaceCrefWithBindExp, (vars,false)); 3606 then 3607 ((e, (vars,true))); 3605 case ((DAE.CREF(componentRef=cr), (vars,_,hs))) 3606 equation 3607 // check for cyclic bindings in start value 3608 false = BaseHashSet.has(cr, hs); 3609 ({BackendDAE.VAR(bindExp = SOME(e))}, _) = getVar(cr, vars); 3610 hs = BaseHashSet.add(cr,hs); 3611 ((e, (_,_,hs))) = Expression.traverseExp(e, replaceCrefWithBindExp, (vars,false,hs)); 3612 then 3613 ((e, (vars,true,hs))); 3608 3614 // true if crefs in expression 3609 case ((e as DAE.CREF(componentRef=cr), (vars,_ )))3610 then 3611 ((e, (vars,true )));3615 case ((e as DAE.CREF(componentRef=cr), (vars,_,hs))) 3616 then 3617 ((e, (vars,true,hs))); 3612 3618 else then inTuple; 3613 3619 end matchcontinue; … … 3641 3647 equation 3642 3648 // simple evaluation, by replace crefs with bind expressions recursivly 3643 ((exp1_1, (_,b ))) = Expression.traverseExp(exp1, replaceCrefWithBindExp, (knVars,false));3644 ((exp2_1, _)) = Expression.traverseExp(exp2, replaceCrefWithBindExp, (knVars,false ));3649 ((exp1_1, (_,b,_))) = Expression.traverseExp(exp1, replaceCrefWithBindExp, (knVars,false,HashSet.emptyHashSet())); 3650 ((exp2_1, _)) = Expression.traverseExp(exp2, replaceCrefWithBindExp, (knVars,false,HashSet.emptyHashSet())); 3645 3651 true = Expression.expEqual(exp1_1, exp2_1); 3646 3652 exp1_1 = Util.if_(b,exp1,exp2);
Note: See TracChangeset
for help on using the changeset viewer.