private double[] getCoordFromMv(Expression mvE) { double[] result = new double[2]; double[] mv = values.get(((Variable) mvE).getName()); result[0] = mv[1] / mv[4]; //x result[1] = mv[2] / mv[4]; //y return result; }
@Override public void visit(Variable node) { variables.add(node.getName()); } };
@Override public void visit(Variable variable) { String name = variable.getName(); code.append(name.replace("_", "\\_")); }
private double getValueOfExpression(Expression e) { if (e instanceof FloatConstant) { return ((FloatConstant) e).getValue(); } else return values.get(((Variable) e).getName())[0]; } }
@Override public void visit(Variable variable) { if (variable.globalAccess()) { code.append("::"); } code.append(variable.getName().replace(optSuffix, suffix)); }
@Override public void visit(AssignmentNode node) { colors.put(node.getVariable().getName(), currentColor); super.visit(node); }
@Override public void replaceExpression(Expression old, Expression newExpression) { if (old instanceof Variable && newExpression instanceof Variable) { Variable oldVar = (Variable) old; Variable newVar = (Variable) newExpression; if (oldVar.getName() == name && oldVar.getMinValue() == minValue && oldVar.getMaxValue() == maxValue) { name = newVar.getName(); minValue = newVar.getMinValue(); maxValue = newVar.getMaxValue(); } } }
@Override public void visit(StoreResultNode node) { outputtedMultivectors.add(node.getValue().getName()); node.getSuccessor().accept(this); }
@Override public void visit(StoreResultNode node) { assigned.add(node.getValue().getName() + suffix); node.getSuccessor().accept(this); }
@Override public void visit(AssignmentNode node) { node.getValue().accept(dfgVisitor); defined.add(node.getVariable().getName()); super.visit(node); }
/** * Updates the LocalVariable-set in a graph * @param graph The graph */ public static void updateVariableSets(ControlFlowGraph graph) { VariablesCollector collector = new VariablesCollector(); graph.accept(collector); LinkedList<Variable> vars = new LinkedList<Variable>(graph.getLocalVariables()); for (Variable v: vars) if (!collector.getVariables().contains(v.getName())) graph.removeLocalVariable(v); }