Commit 5fac5f68 authored by Eva Darulova's avatar Eva Darulova

reshuffling packages

parent fbef319d
......@@ -7,7 +7,7 @@ import scala.collection.immutable.Seq
import scala.reflect.ClassTag
import lang.Identifiers._
import utils.{Interval, PartialInterval, Rational}
import tools.{Interval, PartialInterval, Rational}
case class Context(
reporter: Reporter,
......
......@@ -35,7 +35,7 @@ object Main {
backend.CodeGenerationPhase,
transform.SSATransformerPhase,
analysis.DynamicPhase,
InfoPhase)
backend.InfoPhase)
def main(args: Array[String]): Unit = {
......@@ -174,17 +174,17 @@ object Main {
analysis.SpecsProcessingPhase andThen
transform.SSATransformerPhase andThen
analysis.RangeErrorPhase andThen
InfoPhase andThen
backend.InfoPhase andThen
backend.CodeGenerationPhase
} else if (ctx.hasFlag("codegen")) {
analysis.SpecsProcessingPhase andThen
analysis.RangeErrorPhase andThen
InfoPhase andThen
backend.InfoPhase andThen
backend.CodeGenerationPhase
} else {
analysis.SpecsProcessingPhase andThen
analysis.RangeErrorPhase andThen
InfoPhase
backend.InfoPhase
}
}
......
......@@ -3,12 +3,12 @@
package daisy
package analysis
import utils.FinitePrecision._
import lang.Trees._
import lang.NumAnnotation
import lang.Identifiers._
import utils.{AffineForm, Interval, Rational}
import utils.Interval._
import tools.{AffineForm, Interval, Rational}
import tools.FinitePrecision._
import tools.Interval._
import Rational._
/**
......
......@@ -8,7 +8,7 @@ import java.io.BufferedWriter
import scala.util.Random
import lang.Trees._
import utils.{Rational, Interval, MPFRFloat}
import tools.{Rational, Interval, MPFRFloat}
import MPFRFloat.{abs => mpfr_abs, max => mpfr_max, min => mpfr_min}
import Rational._
import lang.Identifiers._
......
......@@ -3,7 +3,7 @@
package daisy
package analysis
import utils.{MPFRFloat, Rational}
import tools.{MPFRFloat, Rational}
import MPFRFloat.{abs => mpfr_abs, max => mpfr_max, min => mpfr_min}
import Rational.{abs => rat_abs, max => rat_max, min => rat_min}
......
......@@ -5,7 +5,7 @@ package analysis
import lang.NumAnnotation
import lang.Trees._
import utils._
import tools._
import FinitePrecision._
import Rational._
import lang.Identifiers._
......
......@@ -5,9 +5,7 @@ package analysis
import lang.Identifiers._
import lang.Trees._
import utils.Interval
import utils.AffineForm
import utils.SMTRange
import tools.{Interval, AffineForm, SMTRange}
/**
......@@ -135,7 +133,7 @@ object RangePhase extends DaisyPhase {
currentRanges = currentRanges + (x -> currentRanges(x).union(intrvl))
intrvl
} catch {
case e: utils.DivisionByZeroException =>
case e: tools.DivisionByZeroException =>
reporter.fatalError(x.getPos, "possible division by zero")
}
......@@ -150,7 +148,7 @@ object RangePhase extends DaisyPhase {
currentRanges = currentRanges + (x -> currentRanges(x).union(intrvl))
intrvl
} catch {
case e: utils.NegativeSqrtException =>
case e: tools.NegativeSqrtException =>
reporter.fatalError(x.getPos, "possible negative square root")
}
......@@ -192,7 +190,7 @@ object RangePhase extends DaisyPhase {
currentRanges = currentRanges + (x -> intrvl)
intrvl
} catch {
case e: utils.DivisionByZeroException =>
case e: tools.DivisionByZeroException =>
reporter.fatalError(x.getPos, "possible division by zero")
}
......@@ -207,7 +205,7 @@ object RangePhase extends DaisyPhase {
currentRanges = currentRanges + (x -> intrvl)
intrvl
} catch {
case e: utils.NegativeSqrtException =>
case e: tools.NegativeSqrtException =>
reporter.fatalError(x.getPos, "possible negative square root")
}
......@@ -316,7 +314,7 @@ object RangePhase extends DaisyPhase {
x.interval = aform.toInterval
aform
} catch {
case e: utils.DivisionByZeroException =>
case e: tools.DivisionByZeroException =>
reporter.fatalError(x.getPos, "possible division by zero")
}
......@@ -331,7 +329,7 @@ object RangePhase extends DaisyPhase {
x.interval = aform.toInterval
aform
} catch {
case e: utils.NegativeSqrtException =>
case e: tools.NegativeSqrtException =>
reporter.fatalError(x.getPos, "possible negative square root")
}
......@@ -388,7 +386,7 @@ object RangePhase extends DaisyPhase {
x.interval = intrvl
intrvl
} catch {
case e: utils.DivisionByZeroException =>
case e: tools.DivisionByZeroException =>
reporter.fatalError(x.getPos, "possible division by zero")
}
......@@ -403,7 +401,7 @@ object RangePhase extends DaisyPhase {
x.interval = intrvl
intrvl
} catch {
case e: utils.NegativeSqrtException =>
case e: tools.NegativeSqrtException =>
reporter.fatalError(x.getPos, "possible negative square root")
}
......@@ -463,7 +461,7 @@ object RangePhase extends DaisyPhase {
x.interval = smtRange.toInterval
smtRange
} catch {
case e: utils.DivisionByZeroException =>
case e: tools.DivisionByZeroException =>
reporter.fatalError(x.getPos, "possible division by zero")
}
......@@ -478,7 +476,7 @@ object RangePhase extends DaisyPhase {
x.interval = smtRange.toInterval
smtRange
} catch {
case e: utils.NegativeSqrtException =>
case e: tools.NegativeSqrtException =>
reporter.fatalError(x.getPos, "possible negative square root")
}
......
......@@ -6,7 +6,7 @@ package analysis
import scala.util.Random
import lang.Identifiers._
import utils.{Rational, Interval}
import tools.{Rational, Interval}
import collection.immutable.Map
......
......@@ -4,7 +4,7 @@ package daisy
package analysis
import lang.Trees._
import utils.{Interval, PartialInterval, Rational}
import tools.{Interval, PartialInterval, Rational}
import lang.Identifiers._
import lang.TreeOps.preTraversal
import lang.Trees.Program
......
......@@ -5,10 +5,10 @@ package backend
import daisy.lang.{ScalaPrinter, PrettyPrinter}
import lang.Trees._
import utils.FinitePrecision._
import tools.FinitePrecision._
import lang.Types._
import lang.Extractors.ArithOperator
import utils.Rational
import tools.Rational
import lang.NumAnnotation
object CodeGenerationPhase extends DaisyPhase {
......
......@@ -2,6 +2,7 @@
// Modified work Copyright 2017 MPI-SWS, Saarbruecken, Germany
package daisy
package backend
import java.io.FileWriter
import java.io.BufferedWriter
......@@ -10,7 +11,7 @@ import java.util.Date
import lang.Trees.{Program, Let, Expr}
import lang.NumAnnotation
import utils.Rational
import tools.Rational
import Rational._
/**
......
......@@ -432,7 +432,7 @@ trait CodeExtraction extends ASTExtractors {
case ExInt32Literal(v) => Int32Literal(v)
case ExImplicitInt2Real(i) => {
val tmp = RealLiteral(utils.Rational(i))
val tmp = RealLiteral(tools.Rational(i))
tmp.stringValue = i.toString
tmp
}
......@@ -440,12 +440,12 @@ trait CodeExtraction extends ASTExtractors {
case ExBooleanLiteral(v) => BooleanLiteral(v)
// case ExFloat64Literal(d) =>
// val tmp = RealLiteral(utils.Rational.fromString(d.toString))
// val tmp = RealLiteral(tools.Rational.fromString(d.toString))
// tmp.stringValue = d.toString
// tmp
case ExImplicitDouble2Real(d) => //RealLiteral(d.toString)
val tmp = RealLiteral(utils.Rational.fromString(d.toString))
val tmp = RealLiteral(tools.Rational.fromString(d.toString))
tmp.stringValue = d.toString
tmp
......
......@@ -89,8 +89,8 @@ object Constructors {
case (_, IntegerLiteral(bi)) if bi == 0 => lhs
case (Int32Literal(0), _) => rhs
case (_, Int32Literal(0)) => lhs
case (RealLiteral(r), _) if r == utils.Rational.zero => rhs
case (_, RealLiteral(r)) if r == utils.Rational.zero => lhs
case (RealLiteral(r), _) if r == tools.Rational.zero => rhs
case (_, RealLiteral(r)) if r == tools.Rational.zero => lhs
//case (IsTyped(_, Int32Type), IsTyped(_, Int32Type)) => BVPlus(lhs, rhs)
//case (IsTyped(_, RealType), IsTyped(_, RealType)) => RealPlus(lhs, rhs)
case _ => Plus(lhs, rhs)
......
......@@ -3,7 +3,7 @@
package daisy
package lang
import utils.{Interval, Rational}
import tools.{Interval, Rational}
/**
This trait has a number of write-once fields which are to be populated
......
......@@ -9,7 +9,7 @@ import scala.collection.immutable.Seq
import Trees._
import Types._
import Identifiers._
import utils.FinitePrecision._
import tools.FinitePrecision._
object PrettyPrinter {
......
......@@ -10,8 +10,8 @@ import TypeOps._
import Types._
import utils.Positioned
import Identifiers._
import utils.Rational
import utils.FinitePrecision.Precision
import tools.Rational
import tools.FinitePrecision.Precision
object Trees {
......
......@@ -5,7 +5,7 @@ package daisy
package lang
import scala.collection.immutable.Seq
import utils.FinitePrecision.Precision
import tools.FinitePrecision.Precision
import Trees._
......
......@@ -7,7 +7,7 @@ import util.Random
import scala.collection.immutable.Seq
import lang.Trees.Expr
import utils.Rational
import tools.Rational
import Rational._
// The MutationRules should probably not be mixed-in to the generic genetic program
......
......@@ -18,7 +18,7 @@ import lang.Trees._
import lang.Identifiers._
import utils.Bijection
import lang.TreeOps.freeVariablesOf
import utils.Rational
import tools.Rational
import Rational._
import lang.Constructors._
......
// Copyright 2017 MPI-SWS, Saarbruecken, Germany
package daisy
package utils
package tools
import scala.collection.immutable.Seq
import utils.UniqueCounter
import Rational.{zero => rzero, _}
private[utils] case class Deviation(mgnt: Rational, index: Int) {
private[tools] case class Deviation(mgnt: Rational, index: Int) {
def unary_-(): Deviation = Deviation(-mgnt, index)
def +(y: Deviation): Deviation = {
assert(this.index == y.index)
......@@ -26,7 +27,7 @@ private[utils] case class Deviation(mgnt: Rational, index: Int) {
}
// to be called with nextGlobal
private[utils] object AffineIndex extends UniqueCounter[Int]
private[tools] object AffineIndex extends UniqueCounter[Int]
object AffineForm {
......
// Copyright 2017 MPI-SWS, Saarbruecken, Germany
package daisy
package utils
package tools
import scala.math.{ScalaNumericConversions, ScalaNumber}
......
// Copyright 2017 MPI-SWS, Saarbruecken, Germany
package daisy
package utils
package tools
import analysis._
import analysis.DynamicPhase._
......
// Copyright 2017 MPI-SWS, Saarbruecken, Germany
package daisy
package utils
package tools
import collection.immutable.Map
......
// Copyright 2017 MPI-SWS, Saarbruecken, Germany
package daisy
package utils
package tools
import Rational.{max, abs, double2Fraction}
import java.math.BigInteger
......
// Copyright 2017 MPI-SWS, Saarbruecken, Germany
package daisy
package utils
package tools
import Rational._
......
// Copyright 2017 MPI-SWS, Saarbruecken, Germany
package daisy
package utils
package tools
import analysis._
import analysis.DynamicPhase._
......
// Copyright 2017 MPI-SWS, Saarbruecken, Germany
package daisy
package utils
package tools
import org.kframework.mpfr._
......@@ -89,7 +89,7 @@ class MPFRFloat(val bf: BigFloat) extends ScalaNumber with Ordered[MPFRFloat] {
def longValue(): Long = bf.longValue
// Members declared in scala.math.Ordered
def compare(that: daisy.utils.MPFRFloat): Int = this.bf.compareTo(that.bf)
def compare(that: daisy.tools.MPFRFloat): Int = this.bf.compareTo(that.bf)
// Members declared in scala.math.ScalaNumber
def isWhole(): Boolean = new BigFloat(bf.intValue, context).equals(bf)
......
// Copyright 2017 MPI-SWS, Saarbruecken, Germany
package daisy
package utils
package tools
trait RangeArithmetic[T] { self: T =>
......
// Copyright 2017 MPI-SWS, Saarbruecken, Germany
package daisy
package utils
package tools
import scala.collection.immutable.Seq
......
// Copyright 2017 MPI-SWS, Saarbruecken, Germany
package daisy
package utils
package tools
import scala.collection.immutable.Seq
......
// Copyright 2017 MPI-SWS, Saarbruecken, Germany
package daisy
package utils
package tools
import scala.collection.immutable.Seq
......
// Copyright 2017 MPI-SWS, Saarbruecken, Germany
package daisy
package utils
package tools
import scala.collection.immutable.Seq
......
......@@ -3,7 +3,7 @@
package daisy
package object utils {
package object tools {
case class DivisionByZeroException(s: String) extends Exception
......
......@@ -415,7 +415,7 @@ class AbsErrorAnalysisRegressionTest extends FunSuite {
val inputPrgJet = frontend.ExtractionPhase(jetContext)
// with intervals this should crash
intercept[daisy.utils.package$DivisionByZeroException] {
intercept[daisy.tools.package$DivisionByZeroException] {
val ctx = jetContext.copy(options=Seq(ChoiceOption("rangeMethod", "interval")))
val (_, _) = pipeline.run(ctx, inputPrgJet.deepCopy)
}
......
......@@ -5,7 +5,7 @@ package test.regression
import scala.collection.immutable.Seq
import org.scalatest.FunSuite
import utils.FinitePrecision._
import tools.FinitePrecision._
/**
Regression test for the fixed-point arithmetic code generation.
......
......@@ -7,7 +7,7 @@ import java.io.FileWriter
import java.io.BufferedWriter
import scala.io.Source
import utils.{AffineForm, SMTRange, Interval}
import tools.{AffineForm, SMTRange, Interval}
import lang.Trees.Variable
// testing something that is not used...
......@@ -33,11 +33,11 @@ class RangeRegressionTest extends FunSuite {
val (ranges, errors) = analysis.SpecsProcessingPhase.extractPreCondition(fnc.precondition.get)
val inputRanges = ranges.map( x => (x._1 -> Interval(x._2._1, x._2._2)))
val affineRange = utils.Evaluators.evalAffine(fnc.body.get,
val affineRange = tools.Evaluators.evalAffine(fnc.body.get,
inputRanges.map(x => (x._1 -> AffineForm(x._2))))
val intervalRange = utils.Evaluators.evalInterval(fnc.body.get,
val intervalRange = tools.Evaluators.evalInterval(fnc.body.get,
inputRanges)
val smtRange = utils.Evaluators.evalSMT(fnc.body.get,
val smtRange = tools.Evaluators.evalSMT(fnc.body.get,
inputRanges.map({ case (id, int) => (id -> SMTRange(Variable(id), int)) })).toInterval
out.write(fnc.id + " " + intervalRange + " " + affineRange + " " + smtRange + "\n")
......
......@@ -3,7 +3,7 @@
package daisy
package test
import utils._
import tools._
import lang.Trees._
import lang.Identifiers._
import lang.Types._
......
package daisy
package test
import utils.{Interval, Rational, AffineForm}
import tools.{Interval, Rational, AffineForm}
import Rational._
class AffineArithmeticTest extends UnitSuite {
......
package daisy
package test
import utils.{Interval, Rational}
import tools.{Interval, Rational}
class IntervalTest extends UnitSuite {
......
......@@ -4,7 +4,7 @@ package test
import org.kframework.mpfr._
import utils.{MPFRFloat, Rational}
import tools.{MPFRFloat, Rational}
import Rational._
class MPFRTest extends UnitSuite {
......
......@@ -3,7 +3,7 @@ package test
import scala.collection.immutable.Seq
import utils._
import tools._
import lang.Trees._
import lang.NumAnnotation
......
......@@ -5,7 +5,7 @@ package test
import scala.collection.immutable.Seq
import lang.Trees._
import utils.Rational
import tools.Rational
import Rational._
import solvers.Z3Solver
......
......@@ -3,7 +3,7 @@ package test
import scala.collection.immutable.Seq
import utils.{Rational, Interval}
import tools.{Rational, Interval}
import lang.Trees._
import lang.Identifiers._
......
......@@ -3,10 +3,10 @@ package test
import scala.collection.immutable.Seq
import utils.Interval
import tools.Interval
import lang.Trees._
import utils.SMTRange
import utils.Rational
import tools.SMTRange
import tools.Rational
import Rational._
import lang.Constructors._
......
......@@ -4,7 +4,7 @@ package test
import org.scalatest.FunSuite
import utils.{Rational}
import tools.{Rational}
import lang.Trees._
import lang.Identifiers._
import lang.Types.{RealType}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment