Skip to content

Commit

Permalink
Ran the refactoring script to remove unused code
Browse files Browse the repository at this point in the history
  • Loading branch information
sjoelund authored and OpenModelica-Hudson committed Jun 8, 2016
1 parent 7e1286c commit a1a5408
Show file tree
Hide file tree
Showing 30 changed files with 172 additions and 165 deletions.
9 changes: 4 additions & 5 deletions Compiler/BackEnd/BackendDAECreate.mo
Expand Up @@ -451,7 +451,7 @@ algorithm
then (DAE.CALL(Absyn.IDENT("delay"), DAE.ICONST(iDelay)::es, attr), (ht, iDelay+1, iSample, timeEvents));

// sample [already in ht]
case (DAE.CALL(Absyn.IDENT("sample"), es as {start, interval}, attr), (ht, iDelay, iSample, timeEvents))
case (DAE.CALL(Absyn.IDENT("sample"), es as {_, interval}, attr), (ht, iDelay, iSample, timeEvents))
guard (not Types.isClockOrSubTypeClock(Expression.typeof(interval))) equation
i = BaseHashTable.get(inExp, ht);
then (DAE.CALL(Absyn.IDENT("sample"), DAE.ICONST(i)::es, attr), (ht, iDelay, iSample, timeEvents));
Expand Down Expand Up @@ -697,7 +697,6 @@ algorithm
b = DAEUtil.boolVarVisibility(protection);
dae_var_attr = DAEUtil.setProtectedAttr(dae_var_attr, b);
dae_var_attr = setMinMaxFromEnumeration(t, dae_var_attr);
fnstpl = (SOME(functionTree), {DAE.NORM_INLINE()});
// build algorithms for the inlined asserts
eqLst = buildAssertAlgorithms({},source,assrtEqIn);
// building an algorithm of the assert
Expand Down Expand Up @@ -1097,7 +1096,7 @@ algorithm
(eqns,inREquations,inIEquations);

// Only succeds for initial tuple equations, i.e. (a,b,c) = foo(x,y,z) or foo(x,y,z) = (a,b,c)
case(DAE.INITIALEQUATION(e1 as DAE.TUPLE(explst),e2 as DAE.CALL(),source),_,_,_,_)
case(DAE.INITIALEQUATION(e1 as DAE.TUPLE(_),e2 as DAE.CALL(),source),_,_,_,_)
equation
(DAE.EQUALITY_EXPS(e1_1,e2_1), source) = ExpressionSimplify.simplifyAddSymbolicOperation(DAE.EQUALITY_EXPS(e1,e2),source);
eqns = lowerExtendedRecordEqn(e1_1,e2_1,source,BackendDAE.INITIAL_EQUATION(),functionTree,inIEquations);
Expand Down Expand Up @@ -1801,7 +1800,7 @@ algorithm
then
(eqnl, reqnl);

case DAE.EQUATION(exp = cre as DAE.TUPLE(PR=expl), scalar = e, source = source)::xs
case DAE.EQUATION(exp = DAE.TUPLE(PR=expl), scalar = e, source = source)::xs
equation
eqnl = lowerWhenTupleEqn(expl, inCond, e, source, 1, iEquationLst);
(eqnl, reqnl) = lowerWhenEqn2(xs, inCond, functionTree, eqnl, iREquationLst);
Expand Down Expand Up @@ -2189,7 +2188,7 @@ algorithm
ht = BaseHashTable.add((cr, (e, source)), iHt);
then
lowerWhenIfEqnsElse(rest, functionTree, ht);
case (DAE.IF_EQUATION(condition1=expl, equations2=eqnslst, equations3=eqns, source = source)::rest, _, _)
case (DAE.IF_EQUATION(condition1=expl, equations2=eqnslst, equations3=eqns)::rest, _, _)
equation
ht = lowerWhenIfEqnsElse(eqns, functionTree, iHt);
ht = lowerWhenIfEqns(listReverse(expl), listReverse(eqnslst), functionTree, ht);
Expand Down
18 changes: 9 additions & 9 deletions Compiler/BackEnd/BackendDAEOptimize.mo
Expand Up @@ -874,7 +874,7 @@ algorithm
list<BackendDAE.Equation> lsteqns;
Boolean b;

case syst as BackendDAE.EQSYSTEM(orderedVars=vars, orderedEqs=eqns)
case syst as BackendDAE.EQSYSTEM(orderedEqs=eqns)
algorithm
lsteqns := BackendEquation.equationList(eqns);
(lsteqns, b) := BackendVarTransform.replaceEquations(lsteqns, repl, NONE());
Expand Down Expand Up @@ -1193,7 +1193,7 @@ algorithm
BackendDAE.Var v;
BackendDAE.Variables vars,vars1;
DAE.ComponentRef cr;
case (v as BackendDAE.VAR(varKind = BackendDAE.PARAM()),(vars,vars1))
case (v as BackendDAE.VAR(varKind = BackendDAE.PARAM()),(_,_))
then (v,inTpl);
case (v as BackendDAE.VAR(),(vars,vars1))
equation
Expand Down Expand Up @@ -1237,7 +1237,7 @@ algorithm
tuple<BackendDAE.Variables,BackendDAE.Variables> tp;

// special case for time, it is never part of the equation system
case (e as DAE.CREF(componentRef = DAE.CREF_IDENT(ident="time")),(vars,vars1))
case (e as DAE.CREF(componentRef = DAE.CREF_IDENT(ident="time")),(_,_))
then (e, inTuple);

// Special Case for Records
Expand Down Expand Up @@ -2234,7 +2234,7 @@ algorithm
BackendDAE.EqSystem syst;
BackendDAE.Shared shared;

case ( syst as BackendDAE.EQSYSTEM(orderedVars=vars, orderedEqs=eqns),
case ( syst as BackendDAE.EQSYSTEM(orderedEqs=eqns),
shared as BackendDAE.SHARED(globalKnownVars=globalKnownVars) )
algorithm
// traverse the equations
Expand Down Expand Up @@ -2866,7 +2866,7 @@ algorithm
oExp;
// complex equation
// (x,_) = f(.)
case(BackendDAE.COMPLEX_EQUATION(left = e1 as DAE.TUPLE(expl), right = e2))
case(BackendDAE.COMPLEX_EQUATION(left = DAE.TUPLE(expl), right = e2))
algorithm
expl1 := {};
idxs := {};
Expand Down Expand Up @@ -3433,7 +3433,7 @@ algorithm
BackendDAE.Shared shared;
list<BackendDAE.Equation> lsteqns;
Boolean b;
case BackendDAE.DAE(systs, shared as BackendDAE.SHARED(globalKnownVars=globalKnownVars, initialEqs=inieqns))
case BackendDAE.DAE(systs, shared as BackendDAE.SHARED(globalKnownVars=globalKnownVars))
algorithm
repl := BackendVarTransform.emptyReplacements();
repl := BackendVariable.traverseBackendDAEVars(globalKnownVars, removeConstantsFinder, repl);
Expand Down Expand Up @@ -3470,7 +3470,7 @@ algorithm
list<BackendDAE.Equation> lsteqns;
Boolean b;
BackendDAE.EqSystem syst;
case syst as BackendDAE.EQSYSTEM(orderedVars=vars, orderedEqs=eqns)
case syst as BackendDAE.EQSYSTEM(orderedVars=vars)
algorithm
BackendVariable.traverseBackendDAEVarsWithUpdate(vars, replaceFinalVarTraverser, (repl, 0));

Expand Down Expand Up @@ -4592,7 +4592,7 @@ algorithm
e2 := hetsSplitExp(e2);
then DAE.BINARY(e1, op, e2);

case e as DAE.BINARY(e1, op, e2)
case e as DAE.BINARY(_, op, _)
guard Expression.isAddOrSub(op)
algorithm
terms := Expression.terms(e);
Expand Down Expand Up @@ -5632,7 +5632,7 @@ algorithm
BackendDAE.EqSystem syst;
BackendDAE.BaseClockPartitionKind partitionKind;

case syst as BackendDAE.EQSYSTEM(orderedVars=orderedVars, orderedEqs=orderedEqs)
case syst as BackendDAE.EQSYSTEM( orderedEqs=orderedEqs)
algorithm
BackendEquation.traverseEquationArray_WithUpdate(orderedEqs, addTimeAsState2, inFoo);
then syst;
Expand Down
24 changes: 12 additions & 12 deletions Compiler/BackEnd/BackendDAEUtil.mo
Expand Up @@ -775,7 +775,7 @@ algorithm
BackendDAE.Var backendVar;
Absyn.Ident name;

case (e as DAE.CREF(componentRef=cr), (vars, globalKnownVars, blst)) equation
case (e as DAE.CREF(componentRef=cr), (vars, globalKnownVars, _)) equation
((backendVar::_), _) = BackendVariable.getVar(cr, vars);
false = BackendVariable.isVarDiscrete(backendVar);
then (e, false, (vars, globalKnownVars, SOME(true)));
Expand Down Expand Up @@ -1919,7 +1919,7 @@ algorithm
then (e,inTpl);
case (e as DAE.MATRIX(matrix=(((DAE.UNARY(exp = DAE.CREF())))::_)::_), (DAE.STMT_WHEN(), _))
then (e,inTpl);
case (e as DAE.ARRAY(array=(DAE.CREF())::_), (x as DAE.STMT_WHEN(), _))
case (e as DAE.ARRAY(array=(DAE.CREF())::_), (DAE.STMT_WHEN(), _))
then (e,inTpl);
case (e as DAE.ARRAY(array=(DAE.UNARY(exp = DAE.CREF()))::_), (DAE.STMT_WHEN(), _))
then (e,inTpl);
Expand Down Expand Up @@ -3034,7 +3034,7 @@ algorithm
equation
failure(_ = List.getMemberOnTrue(i, vars, intEq));
then incidenceRowExp1(rest,irest,i::vars,diffindex);
case (_ :: rest,_::irest,_,_)
case (_ :: _,_::_,_,_)
then vars;
end matchcontinue;
end incidenceRowExp1withInput;
Expand Down Expand Up @@ -3489,11 +3489,11 @@ algorithm
BackendDAE.StateSets stateSets;
BackendDAE.BaseClockPartitionKind partitionKind;

case BackendDAE.EQSYSTEM(orderedVars=v, orderedEqs=eq, m=NONE()) equation
case BackendDAE.EQSYSTEM(m=NONE()) equation
(m, mT) = incidenceMatrix(inSyst, inIndxType, inFunctionTree);
then (BackendDAEUtil.setEqSystMatrices(inSyst, SOME(m), SOME(mT)), m, mT);

case BackendDAE.EQSYSTEM(orderedVars=v, orderedEqs=eq, m=SOME(m), mT=NONE()) equation
case BackendDAE.EQSYSTEM(orderedVars=v, m=SOME(m), mT=NONE()) equation
mT = transposeMatrix(m, BackendVariable.varsSize(v));
then (BackendDAEUtil.setEqSystMatrices(inSyst, SOME(m), SOME(mT)), m, mT);

Expand Down Expand Up @@ -4821,7 +4821,7 @@ algorithm
DAE.Constraint con;
list<DAE.ComponentRef> crlst;
Boolean localCon;
case DAE.BINARY(exp1=e1, operator=DAE.DIV(), exp2=e2)
case DAE.BINARY(operator=DAE.DIV(), exp2=e2)
equation
rel = DAE.RELATION(e2,DAE.NEQUAL(DAE.T_UNKNOWN(DAE.emptyTypeSource)),DAE.RCONST(0.0),-1,NONE());
(_,crlst) = Expression.traverseExpTopDown(rel, Expression.traversingComponentRefFinderNoPreDer, {});
Expand Down Expand Up @@ -5096,15 +5096,15 @@ algorithm
then (inExp, false, (vars, bs, iat, res));

// pre(v) is considered a known variable
case (DAE.CALL(path=Absyn.IDENT(name="pre"), expLst={DAE.CREF()}), (vars, bs, iat, pa))
case (DAE.CALL(path=Absyn.IDENT(name="pre"), expLst={DAE.CREF()}), (_, _, _, _))
then (inExp, false, inTpl);

// previous(v) is considered a known variable
case (DAE.CALL(path=Absyn.IDENT(name="previous"), expLst={DAE.CREF()}), (vars, bs, iat, pa))
case (DAE.CALL(path=Absyn.IDENT(name="previous"), expLst={DAE.CREF()}), (_, _, _, _))
then (inExp, false, inTpl);

// delay(e) can be used to break algebraic loops given some solver options
case (DAE.CALL(path=Absyn.IDENT(name="delay"), expLst={_, _, e1, e2}), (vars, bs, iat, pa)) equation
case (DAE.CALL(path=Absyn.IDENT(name="delay"), expLst={_, _, e1, e2}), (_, _, _, _)) equation
b = Flags.getConfigBool(Flags.DELAY_BREAK_LOOP) and Expression.expEqual(e1, e2);
then (inExp, not b, inTpl);

Expand Down Expand Up @@ -6388,7 +6388,7 @@ algorithm
a = SOME(DAE.VAR_ATTR_ENUMERATION(q_,min_,max_,i_,f_,eqbound_,p,fin,startOrigin));
end if;
then (a,outExtraArg);
case(SOME(DAE.VAR_ATTR_CLOCK(p, fin)),_,_)
case(SOME(DAE.VAR_ATTR_CLOCK(_, _)),_,_)
then (attr,extraArg);

end match;
Expand Down Expand Up @@ -8705,7 +8705,7 @@ author: Waurich TUD 09-2015"
output list<BackendDAE.Equation> eqsOut;
output list<Integer> eqIdcxs;
algorithm
(varsOut,varIdxs,eqsOut,eqIdcxs) := matchcontinue(comp,varArr,eqArr)
(varsOut,varIdxs,eqsOut,eqIdcxs) := match(comp,varArr,eqArr)
local
Integer vidx,eidx;
list<Integer> vidxs,eidxs, otherEqns, otherVars;
Expand Down Expand Up @@ -8759,7 +8759,7 @@ algorithm
vars = List.map1(vidxs,BackendVariable.getVarAtIndexFirst,varArr);
eqs = BackendEquation.getEqns(eidxs,eqArr);
then (vars,vidxs,eqs,eidxs);
end matchcontinue;
end match;
end getStrongComponentVarsAndEquations;

public function getStrongComponentEquations"gets all equations from a component"
Expand Down
8 changes: 4 additions & 4 deletions Compiler/BackEnd/BackendDump.mo
Expand Up @@ -900,7 +900,7 @@ algorithm
dumpBackendDAEEqnList2(res,printExpTree);
then ();

case (BackendDAE.WHEN_EQUATION(whenEquation=weqn, attr=BackendDAE.EQUATION_ATTRIBUTES(kind=eqKind))::res, _) equation
case (BackendDAE.WHEN_EQUATION(whenEquation=weqn, attr=BackendDAE.EQUATION_ATTRIBUTES(kind=eqKind))::_, _) equation
print("WHEN_EQUATION: ");
str = whenEquationString(weqn, true);
print(str);
Expand Down Expand Up @@ -1502,7 +1502,7 @@ public function equationString "Helper function to e.g. dump."
input BackendDAE.Equation inEquation;
output String outString;
algorithm
outString := matchcontinue (inEquation)
outString := match (inEquation)
local
String s1,s2,s3,s4,res;
DAE.Exp e1,e2,e,cond, start, stop, iter;
Expand All @@ -1515,7 +1515,7 @@ algorithm
list<list<BackendDAE.Equation>> eqnstrue;
list<BackendDAE.Equation> eqnsfalse,eqns;
list<BackendDAE.WhenOperator> whenStmtLst;
case (BackendDAE.EQUATION(exp = e1,scalar = e2, attr=attr))
case (BackendDAE.EQUATION(exp = e1,scalar = e2))
equation
s1 = ExpressionDump.printExpStr(e1);
s2 = ExpressionDump.printExpStr(e2);
Expand Down Expand Up @@ -1574,7 +1574,7 @@ algorithm
res = stringAppendList({"for ",s1," loop \n ",s2, "; end for; "});
then
res;
end matchcontinue;
end match;
end equationString;

protected function zeroCrossingString "Dumps a zerocrossing into a string, for debugging purposes."
Expand Down
10 changes: 5 additions & 5 deletions Compiler/BackEnd/BackendEquation.mo
Expand Up @@ -297,11 +297,11 @@ algorithm
then (e, true, inTuple);

// case for pre vars
case (e as DAE.CALL(path = Absyn.IDENT(name = "pre")), _)
case (DAE.CALL(path = Absyn.IDENT(name = "pre")), _)
then (inExp, false, inTuple);

// case for previous vars
case (e as DAE.CALL(path = Absyn.IDENT(name = "previous")), _)
case (DAE.CALL(path = Absyn.IDENT(name = "previous")), _)
then (inExp, false, inTuple);

// add it
Expand Down Expand Up @@ -707,7 +707,7 @@ algorithm
(we_1, extArg) = traverseExpsOfWhenEquation(we, inFunc, inTypeA);
then (if referenceEq(we,we_1) then inEquation else BackendDAE.WHEN_EQUATION(size, we_1, source, attr), extArg);

case BackendDAE.ALGORITHM(size=size, alg=alg as DAE.ALGORITHM_STMTS(statementLst = stmts), source=source, expand=crefExpand, attr=attr) equation
case BackendDAE.ALGORITHM(size=size, alg=DAE.ALGORITHM_STMTS(statementLst = stmts), source=source, expand=crefExpand, attr=attr) equation
(stmts1, extArg) = DAEUtil.traverseDAEEquationsStmts(stmts, inFunc, inTypeA);
then (if referenceEq(stmts,stmts1) then inEquation else BackendDAE.ALGORITHM(size, DAE.ALGORITHM_STMTS(stmts1), source, crefExpand, attr), extArg);

Expand Down Expand Up @@ -1058,7 +1058,7 @@ algorithm
(b, extArg) = traverseExpsOfWhenOps_WithStop(rest, inFunc, extArg, b);
then (b, extArg);

case (BackendDAE.ASSERT(condition = e1, message = e2, level = level)::rest)
case (BackendDAE.ASSERT(condition = e1, message = e2)::rest)
equation
if inCont then
(_, b, extArg) = inFunc(e1, inTypeA);
Expand All @@ -1077,7 +1077,7 @@ algorithm
(b, extArg) = traverseExpsOfWhenOps_WithStop(rest, inFunc, extArg, b);
then (b, extArg);

case (BackendDAE.NORETCALL(exp = e1, source = source)::rest)
case (BackendDAE.NORETCALL(exp = e1)::rest)
equation
if inCont then
(_, b, extArg) = inFunc(e1, inTypeA);
Expand Down
6 changes: 3 additions & 3 deletions Compiler/BackEnd/BackendInline.mo
Expand Up @@ -344,7 +344,7 @@ protected function inlineWhenEq
output DAE.ElementSource outSource;
output Boolean inlined;
algorithm
(outWhenEquation,outSource,inlined) := matchcontinue(inWhenEquation)
(outWhenEquation,outSource,inlined) := match(inWhenEquation)
local
DAE.ComponentRef cref;
DAE.Exp e,e_1,cond;
Expand All @@ -371,7 +371,7 @@ algorithm
end if;
then (BackendDAE.WHEN_STMTS(cond, whenStmtLst, oelsewe), source, b1 or b2 or b3);

end matchcontinue;
end match;
end inlineWhenEq;

protected function inlineWhenOps
Expand Down Expand Up @@ -1195,7 +1195,7 @@ algorithm
guard not Expression.isRecordType(ComponentReference.crefTypeFull(cr))
algorithm
// create variables
(crVar, varLst, repl) := createReplacementVariables(cr, funcname, repl);
(_, varLst, repl) := createReplacementVariables(cr, funcname, repl);
varLst := list(BackendVariable.setVarTS(_var, SOME(BackendDAE.AVOID())) for _var in varLst);
outEqs := BackendVariable.addVarsDAE(varLst, outEqs);
then ();
Expand Down
2 changes: 0 additions & 2 deletions Compiler/BackEnd/BackendVariable.mo
Expand Up @@ -1751,7 +1751,6 @@ algorithm
fail();
end if;
e = Expression.crefExp(name);
varStr = ComponentReference.printComponentRefStr(name);
tp = BackendDAEUtil.makeExpType(varType);

// do not add if const true
Expand Down Expand Up @@ -1842,7 +1841,6 @@ algorithm
cond = getMinMaxAsserts1(min, max, e, tp);
(cond, _) = ExpressionSimplify.simplify(cond);
false = Expression.isConstTrue(cond);
varStr = ComponentReference.printComponentRefStr(name);
str = getMinMaxAsserts1Str(min, max, ComponentReference.printComponentRefStr(name), nominal=true);
// if is real use %g otherwise use %d (ints and enums)
format = if Types.isRealOrSubTypeReal(tp) then "g" else "d";
Expand Down

0 comments on commit a1a5408

Please sign in to comment.