-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
29 changed files
with
2,903 additions
and
161 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package esmeta.analyzer | ||
|
||
import esmeta.cfg.* | ||
import esmeta.ir.{Func => _, *} | ||
|
||
trait ControlPointDecl { self: Analyzer => | ||
|
||
/** control points */ | ||
sealed trait ControlPoint extends AnalyzerElem { | ||
def view: View | ||
def func: Func | ||
def isBuiltin: Boolean = func.isBuiltin | ||
def toReturnPoint: ReturnPoint = this match | ||
case np: NodePoint[Node] => ReturnPoint(np.func, np.view) | ||
case rp: ReturnPoint => rp | ||
} | ||
|
||
/** node points */ | ||
case class NodePoint[+T <: Node]( | ||
func: Func, | ||
node: T, | ||
view: View, | ||
) extends ControlPoint | ||
|
||
/** return points */ | ||
case class ReturnPoint( | ||
func: Func, | ||
view: View, | ||
) extends ControlPoint | ||
|
||
given Ordering[ControlPoint] = Ordering.by(_ match | ||
case NodePoint(f, n, _) => (f.id, n.id) | ||
case ReturnPoint(f, _) => (f.id, Int.MaxValue), | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,62 @@ | ||
package esmeta.analyzer | ||
|
||
import esmeta.util.Appender.* | ||
import esmeta.util.BaseUtils.* | ||
|
||
trait DomainLikeDecl { self: Analyzer => | ||
|
||
/** abstract states */ | ||
trait AbsStateLike { | ||
/** abstract domain */ | ||
trait DomainLike[Elem] { | ||
|
||
/** has imprecise elements */ | ||
def hasImprec: Boolean | ||
/** top element */ | ||
def Top: Elem | ||
|
||
/** bottom element */ | ||
def Bot: Elem | ||
|
||
/** appender */ | ||
given rule: Rule[Elem] | ||
} | ||
|
||
/** abstract return values */ | ||
trait AbsRetLike { | ||
trait DomainElemLike[Elem] { self: Elem => | ||
|
||
/** return value */ | ||
def value: AbsValue | ||
/** abstract domain */ | ||
def domain: DomainLike[Elem] | ||
|
||
/** conversion to string */ | ||
override def toString: String = stringify(this)(using domain.rule) | ||
} | ||
|
||
/** abstract values */ | ||
trait AbsValueLike { | ||
trait AbsValueLike extends DomainElemLike[AbsValue] { self: AbsValue => | ||
|
||
/** abstract domain */ | ||
def domain = AbsValue | ||
|
||
/** get string of abstract value with an abstract state */ | ||
def getString(state: AbsState): String | ||
} | ||
val AbsValue: DomainLike[AbsValue] | ||
|
||
/** abstract states */ | ||
trait AbsStateLike extends DomainElemLike[AbsState] { self: AbsState => | ||
|
||
/** abstract domain */ | ||
def domain = AbsState | ||
|
||
/** has imprecise elements */ | ||
def hasImprec: Boolean | ||
} | ||
val AbsState: DomainLike[AbsState] | ||
|
||
/** abstract return values */ | ||
trait AbsRetLike extends DomainElemLike[AbsRet] { self: AbsRet => | ||
|
||
/** abstract domain */ | ||
def domain = AbsRet | ||
|
||
/** return value */ | ||
def value: AbsValue | ||
} | ||
val AbsRet: DomainLike[AbsRet] | ||
} |
Oops, something went wrong.