vrp

package
v2.0.1+incompatible Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 5, 2017 License: MIT, MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var EmptyIntInterval = IntInterval{true, PInfinity, NInfinity}
View Source
var NInfinity = Z{/* contains filtered or unexported fields */}
View Source
var PInfinity = Z{/* contains filtered or unexported fields */}

Functions

func NewConstraint

func NewConstraint(y ssa.Value) aConstraint

func VertexString

func VertexString(v *Vertex) string

Types

type ArraySliceConstraint

type ArraySliceConstraint struct {
	X     ssa.Value
	Lower ssa.Value
	Upper ssa.Value
	// contains filtered or unexported fields
}

func (*ArraySliceConstraint) Eval

func (c *ArraySliceConstraint) Eval(g *Graph) Range

func (*ArraySliceConstraint) Operands

func (c *ArraySliceConstraint) Operands() []ssa.Value

func (*ArraySliceConstraint) String

func (c *ArraySliceConstraint) String() string

func (ArraySliceConstraint) Y

func (c ArraySliceConstraint) Y() ssa.Value

type ChannelChangeTypeConstraint

type ChannelChangeTypeConstraint struct {
	X ssa.Value
	// contains filtered or unexported fields
}

func (*ChannelChangeTypeConstraint) Eval

func (*ChannelChangeTypeConstraint) Operands

func (c *ChannelChangeTypeConstraint) Operands() []ssa.Value

func (*ChannelChangeTypeConstraint) String

func (c *ChannelChangeTypeConstraint) String() string

func (ChannelChangeTypeConstraint) Y

func (c ChannelChangeTypeConstraint) Y() ssa.Value

type ChannelInterval

type ChannelInterval struct {
	Size IntInterval
}

func (ChannelInterval) IsKnown

func (c ChannelInterval) IsKnown() bool

func (ChannelInterval) String

func (c ChannelInterval) String() string

func (ChannelInterval) Union

func (c ChannelInterval) Union(other Range) Range

type Constraint

type Constraint interface {
	Y() ssa.Value

	String() string
	Eval(*Graph) Range
	Operands() []ssa.Value
	// contains filtered or unexported methods
}

func NewArraySliceConstraint

func NewArraySliceConstraint(x, lower, upper, y ssa.Value) Constraint

func NewChannelChangeTypeConstraint

func NewChannelChangeTypeConstraint(x, y ssa.Value) Constraint

func NewCopyConstraint

func NewCopyConstraint(x, y ssa.Value) Constraint

func NewIntAddConstraint

func NewIntAddConstraint(a, b, y ssa.Value) Constraint

func NewIntConversionConstraint

func NewIntConversionConstraint(x, y ssa.Value) Constraint

func NewIntIntersectionConstraint

func NewIntIntersectionConstraint(a, b ssa.Value, op token.Token, ranges Ranges, y ssa.Value) Constraint

func NewIntIntervalConstraint

func NewIntIntervalConstraint(i IntInterval, y ssa.Value) Constraint

func NewIntMulConstraint

func NewIntMulConstraint(a, b, y ssa.Value) Constraint

func NewIntSubConstraint

func NewIntSubConstraint(a, b, y ssa.Value) Constraint

func NewMakeChannelConstraint

func NewMakeChannelConstraint(buffer, y ssa.Value) Constraint

func NewMakeSliceConstraint

func NewMakeSliceConstraint(size, y ssa.Value) Constraint

func NewPhiConstraint

func NewPhiConstraint(vars []ssa.Value, y ssa.Value) Constraint

func NewSliceAppendConstraint

func NewSliceAppendConstraint(a, b, y ssa.Value) Constraint

func NewSliceIntersectionConstraint

func NewSliceIntersectionConstraint(x ssa.Value, i IntInterval, y ssa.Value) Constraint

func NewSliceIntervalConstraint

func NewSliceIntervalConstraint(i IntInterval, y ssa.Value) Constraint

func NewSliceLengthConstraint

func NewSliceLengthConstraint(x, y ssa.Value) Constraint

func NewSliceSliceConstraint

func NewSliceSliceConstraint(x, lower, upper, y ssa.Value) Constraint

func NewStringConcatConstraint

func NewStringConcatConstraint(a, b, y ssa.Value) Constraint

func NewStringIntersectionConstraint

func NewStringIntersectionConstraint(a, b ssa.Value, op token.Token, ranges Ranges, y ssa.Value) Constraint

func NewStringIntervalConstraint

func NewStringIntervalConstraint(i IntInterval, y ssa.Value) Constraint

func NewStringLengthConstraint

func NewStringLengthConstraint(x ssa.Value, y ssa.Value) Constraint

func NewStringSliceConstraint

func NewStringSliceConstraint(x, lower, upper, y ssa.Value) Constraint

type CopyConstraint

type CopyConstraint struct {
	X ssa.Value
	// contains filtered or unexported fields
}

func (*CopyConstraint) Eval

func (c *CopyConstraint) Eval(g *Graph) Range

func (*CopyConstraint) Operands

func (c *CopyConstraint) Operands() []ssa.Value

func (*CopyConstraint) String

func (c *CopyConstraint) String() string

func (CopyConstraint) Y

func (c CopyConstraint) Y() ssa.Value

type Edge

type Edge struct {
	From, To *Vertex
	// contains filtered or unexported fields
}

func (Edge) String

func (e Edge) String() string

type Future

type Future interface {
	Constraint
	Futures() []ssa.Value
	Resolve()
	IsKnown() bool
	MarkUnresolved()
	MarkResolved()
	IsResolved() bool
}

type Graph

type Graph struct {
	Vertices map[interface{}]*Vertex
	Edges    []Edge
	SCCs     [][]*Vertex
	// contains filtered or unexported fields
}

func BuildGraph

func BuildGraph(f *ssa.Function) *Graph

func (*Graph) AddEdge

func (g *Graph) AddEdge(from, to interface{}, ctrl bool)

func (*Graph) FindSCCs

func (g *Graph) FindSCCs()

func (Graph) Graphviz

func (g Graph) Graphviz() string

func (*Graph) Range

func (g *Graph) Range(x ssa.Value) Range

func (*Graph) SetRange

func (g *Graph) SetRange(x ssa.Value, r Range)

func (*Graph) Solve

func (g *Graph) Solve() Ranges

type IntAddConstraint

type IntAddConstraint struct{ *IntArithmeticConstraint }

func (IntAddConstraint) Y

func (c IntAddConstraint) Y() ssa.Value

type IntArithmeticConstraint

type IntArithmeticConstraint struct {
	A  ssa.Value
	B  ssa.Value
	Op token.Token
	Fn func(IntInterval, IntInterval) IntInterval
	// contains filtered or unexported fields
}

func NewIntArithmeticConstraint

func NewIntArithmeticConstraint(a, b, y ssa.Value, op token.Token, fn func(IntInterval, IntInterval) IntInterval) *IntArithmeticConstraint

func (*IntArithmeticConstraint) Eval

func (c *IntArithmeticConstraint) Eval(g *Graph) Range

func (*IntArithmeticConstraint) Operands

func (c *IntArithmeticConstraint) Operands() []ssa.Value

func (*IntArithmeticConstraint) String

func (c *IntArithmeticConstraint) String() string

func (IntArithmeticConstraint) Y

func (c IntArithmeticConstraint) Y() ssa.Value

type IntConversionConstraint

type IntConversionConstraint struct {
	X ssa.Value
	// contains filtered or unexported fields
}

func (*IntConversionConstraint) Eval

func (c *IntConversionConstraint) Eval(g *Graph) Range

func (*IntConversionConstraint) Operands

func (c *IntConversionConstraint) Operands() []ssa.Value

func (*IntConversionConstraint) String

func (c *IntConversionConstraint) String() string

func (IntConversionConstraint) Y

func (c IntConversionConstraint) Y() ssa.Value

type IntIntersectionConstraint

type IntIntersectionConstraint struct {
	A  ssa.Value
	B  ssa.Value
	Op token.Token
	I  IntInterval
	// contains filtered or unexported fields
}

func (*IntIntersectionConstraint) Eval

func (*IntIntersectionConstraint) Futures

func (c *IntIntersectionConstraint) Futures() []ssa.Value

func (*IntIntersectionConstraint) IsKnown

func (c *IntIntersectionConstraint) IsKnown() bool

func (*IntIntersectionConstraint) IsResolved

func (c *IntIntersectionConstraint) IsResolved() bool

func (*IntIntersectionConstraint) MarkResolved

func (c *IntIntersectionConstraint) MarkResolved()

func (*IntIntersectionConstraint) MarkUnresolved

func (c *IntIntersectionConstraint) MarkUnresolved()

func (*IntIntersectionConstraint) Operands

func (c *IntIntersectionConstraint) Operands() []ssa.Value

func (*IntIntersectionConstraint) Resolve

func (c *IntIntersectionConstraint) Resolve()

func (*IntIntersectionConstraint) String

func (c *IntIntersectionConstraint) String() string

func (IntIntersectionConstraint) Y

func (c IntIntersectionConstraint) Y() ssa.Value

type IntInterval

type IntInterval struct {
	Lower Z
	Upper Z
	// contains filtered or unexported fields
}

func InfinityFor

func InfinityFor(v ssa.Value) IntInterval

func NewIntInterval

func NewIntInterval(l, u Z) IntInterval

func (IntInterval) Add

func (i1 IntInterval) Add(i2 IntInterval) IntInterval

func (IntInterval) Empty

func (i IntInterval) Empty() bool

func (IntInterval) Intersection

func (i1 IntInterval) Intersection(i2 IntInterval) IntInterval

func (IntInterval) IsKnown

func (i IntInterval) IsKnown() bool

func (IntInterval) IsMaxRange

func (i IntInterval) IsMaxRange() bool

func (IntInterval) Mul

func (i1 IntInterval) Mul(i2 IntInterval) IntInterval

func (IntInterval) String

func (i1 IntInterval) String() string

func (IntInterval) Sub

func (i1 IntInterval) Sub(i2 IntInterval) IntInterval

func (IntInterval) Union

func (i1 IntInterval) Union(other Range) Range

type IntIntervalConstraint

type IntIntervalConstraint struct {
	I IntInterval
	// contains filtered or unexported fields
}

func (*IntIntervalConstraint) Eval

func (c *IntIntervalConstraint) Eval(*Graph) Range

func (*IntIntervalConstraint) Operands

func (s *IntIntervalConstraint) Operands() []ssa.Value

func (*IntIntervalConstraint) String

func (c *IntIntervalConstraint) String() string

func (IntIntervalConstraint) Y

func (c IntIntervalConstraint) Y() ssa.Value

type IntMulConstraint

type IntMulConstraint struct{ *IntArithmeticConstraint }

func (IntMulConstraint) Y

func (c IntMulConstraint) Y() ssa.Value

type IntSubConstraint

type IntSubConstraint struct{ *IntArithmeticConstraint }

func (IntSubConstraint) Y

func (c IntSubConstraint) Y() ssa.Value

type MakeChannelConstraint

type MakeChannelConstraint struct {
	Buffer ssa.Value
	// contains filtered or unexported fields
}

func (*MakeChannelConstraint) Eval

func (c *MakeChannelConstraint) Eval(g *Graph) Range

func (*MakeChannelConstraint) Operands

func (c *MakeChannelConstraint) Operands() []ssa.Value

func (*MakeChannelConstraint) String

func (c *MakeChannelConstraint) String() string

func (MakeChannelConstraint) Y

func (c MakeChannelConstraint) Y() ssa.Value

type MakeSliceConstraint

type MakeSliceConstraint struct {
	Size ssa.Value
	// contains filtered or unexported fields
}

func (*MakeSliceConstraint) Eval

func (c *MakeSliceConstraint) Eval(g *Graph) Range

func (*MakeSliceConstraint) Operands

func (c *MakeSliceConstraint) Operands() []ssa.Value

func (*MakeSliceConstraint) String

func (c *MakeSliceConstraint) String() string

func (MakeSliceConstraint) Y

func (c MakeSliceConstraint) Y() ssa.Value

type PhiConstraint

type PhiConstraint struct {
	Vars []ssa.Value
	// contains filtered or unexported fields
}

func (*PhiConstraint) Eval

func (c *PhiConstraint) Eval(g *Graph) Range

func (*PhiConstraint) Operands

func (c *PhiConstraint) Operands() []ssa.Value

func (*PhiConstraint) String

func (c *PhiConstraint) String() string

func (PhiConstraint) Y

func (c PhiConstraint) Y() ssa.Value

type Range

type Range interface {
	Union(other Range) Range
	IsKnown() bool
}

type Ranges

type Ranges map[ssa.Value]Range

func (Ranges) Get

func (r Ranges) Get(x ssa.Value) Range

type SliceAppendConstraint

type SliceAppendConstraint struct {
	A ssa.Value
	B ssa.Value
	// contains filtered or unexported fields
}

func (*SliceAppendConstraint) Eval

func (c *SliceAppendConstraint) Eval(g *Graph) Range

func (*SliceAppendConstraint) Operands

func (c *SliceAppendConstraint) Operands() []ssa.Value

func (*SliceAppendConstraint) String

func (c *SliceAppendConstraint) String() string

func (SliceAppendConstraint) Y

func (c SliceAppendConstraint) Y() ssa.Value

type SliceIntersectionConstraint

type SliceIntersectionConstraint struct {
	X ssa.Value
	I IntInterval
	// contains filtered or unexported fields
}

func (*SliceIntersectionConstraint) Eval

func (*SliceIntersectionConstraint) Operands

func (c *SliceIntersectionConstraint) Operands() []ssa.Value

func (*SliceIntersectionConstraint) String

func (c *SliceIntersectionConstraint) String() string

func (SliceIntersectionConstraint) Y

func (c SliceIntersectionConstraint) Y() ssa.Value

type SliceInterval

type SliceInterval struct {
	Length IntInterval
}

func (SliceInterval) IsKnown

func (s SliceInterval) IsKnown() bool

func (SliceInterval) String

func (s SliceInterval) String() string

func (SliceInterval) Union

func (s SliceInterval) Union(other Range) Range

type SliceIntervalConstraint

type SliceIntervalConstraint struct {
	I IntInterval
	// contains filtered or unexported fields
}

func (*SliceIntervalConstraint) Eval

func (*SliceIntervalConstraint) Operands

func (s *SliceIntervalConstraint) Operands() []ssa.Value

func (*SliceIntervalConstraint) String

func (c *SliceIntervalConstraint) String() string

func (SliceIntervalConstraint) Y

func (c SliceIntervalConstraint) Y() ssa.Value

type SliceLengthConstraint

type SliceLengthConstraint struct {
	X ssa.Value
	// contains filtered or unexported fields
}

func (*SliceLengthConstraint) Eval

func (c *SliceLengthConstraint) Eval(g *Graph) Range

func (*SliceLengthConstraint) Operands

func (c *SliceLengthConstraint) Operands() []ssa.Value

func (*SliceLengthConstraint) String

func (c *SliceLengthConstraint) String() string

func (SliceLengthConstraint) Y

func (c SliceLengthConstraint) Y() ssa.Value

type SliceSliceConstraint

type SliceSliceConstraint struct {
	X     ssa.Value
	Lower ssa.Value
	Upper ssa.Value
	// contains filtered or unexported fields
}

func (*SliceSliceConstraint) Eval

func (c *SliceSliceConstraint) Eval(g *Graph) Range

func (*SliceSliceConstraint) Operands

func (c *SliceSliceConstraint) Operands() []ssa.Value

func (*SliceSliceConstraint) String

func (c *SliceSliceConstraint) String() string

func (SliceSliceConstraint) Y

func (c SliceSliceConstraint) Y() ssa.Value

type StringConcatConstraint

type StringConcatConstraint struct {
	A ssa.Value
	B ssa.Value
	// contains filtered or unexported fields
}

func (StringConcatConstraint) Eval

func (c StringConcatConstraint) Eval(g *Graph) Range

func (StringConcatConstraint) Operands

func (c StringConcatConstraint) Operands() []ssa.Value

func (StringConcatConstraint) String

func (c StringConcatConstraint) String() string

func (StringConcatConstraint) Y

func (c StringConcatConstraint) Y() ssa.Value

type StringIntersectionConstraint

type StringIntersectionConstraint struct {
	A  ssa.Value
	B  ssa.Value
	Op token.Token
	I  IntInterval
	// contains filtered or unexported fields
}

func (*StringIntersectionConstraint) Eval

func (*StringIntersectionConstraint) Futures

func (c *StringIntersectionConstraint) Futures() []ssa.Value

func (*StringIntersectionConstraint) IsKnown

func (c *StringIntersectionConstraint) IsKnown() bool

func (*StringIntersectionConstraint) IsResolved

func (c *StringIntersectionConstraint) IsResolved() bool

func (*StringIntersectionConstraint) MarkResolved

func (c *StringIntersectionConstraint) MarkResolved()

func (*StringIntersectionConstraint) MarkUnresolved

func (c *StringIntersectionConstraint) MarkUnresolved()

func (*StringIntersectionConstraint) Operands

func (c *StringIntersectionConstraint) Operands() []ssa.Value

func (*StringIntersectionConstraint) Resolve

func (c *StringIntersectionConstraint) Resolve()

func (*StringIntersectionConstraint) String

func (StringIntersectionConstraint) Y

func (c StringIntersectionConstraint) Y() ssa.Value

type StringInterval

type StringInterval struct {
	Length IntInterval
}

func (StringInterval) IsKnown

func (s StringInterval) IsKnown() bool

func (StringInterval) String

func (s StringInterval) String() string

func (StringInterval) Union

func (s StringInterval) Union(other Range) Range

type StringIntervalConstraint

type StringIntervalConstraint struct {
	I IntInterval
	// contains filtered or unexported fields
}

func (*StringIntervalConstraint) Eval

func (*StringIntervalConstraint) Operands

func (s *StringIntervalConstraint) Operands() []ssa.Value

func (*StringIntervalConstraint) String

func (c *StringIntervalConstraint) String() string

func (StringIntervalConstraint) Y

func (c StringIntervalConstraint) Y() ssa.Value

type StringLengthConstraint

type StringLengthConstraint struct {
	X ssa.Value
	// contains filtered or unexported fields
}

func (*StringLengthConstraint) Eval

func (c *StringLengthConstraint) Eval(g *Graph) Range

func (*StringLengthConstraint) Operands

func (c *StringLengthConstraint) Operands() []ssa.Value

func (*StringLengthConstraint) String

func (c *StringLengthConstraint) String() string

func (StringLengthConstraint) Y

func (c StringLengthConstraint) Y() ssa.Value

type StringSliceConstraint

type StringSliceConstraint struct {
	X     ssa.Value
	Lower ssa.Value
	Upper ssa.Value
	// contains filtered or unexported fields
}

func (*StringSliceConstraint) Eval

func (c *StringSliceConstraint) Eval(g *Graph) Range

func (*StringSliceConstraint) Operands

func (c *StringSliceConstraint) Operands() []ssa.Value

func (*StringSliceConstraint) String

func (c *StringSliceConstraint) String() string

func (StringSliceConstraint) Y

func (c StringSliceConstraint) Y() ssa.Value

type Vertex

type Vertex struct {
	Value interface{} // one of Constraint or ssa.Value
	SCC   int

	Succs []Edge
	// contains filtered or unexported fields
}

type Z

type Z struct {
	// contains filtered or unexported fields
}

func ConstantToZ

func ConstantToZ(c constant.Value) Z

func MaxZ

func MaxZ(zs ...Z) Z

func MinZ

func MinZ(zs ...Z) Z

func NewBigZ

func NewBigZ(n *big.Int) Z

func NewZ

func NewZ(n int64) Z

func (Z) Add

func (z1 Z) Add(z2 Z) Z

func (Z) Cmp

func (z1 Z) Cmp(z2 Z) int

func (Z) Infinite

func (z1 Z) Infinite() bool

func (Z) Mul

func (z1 Z) Mul(z2 Z) Z

func (Z) Negate

func (z1 Z) Negate() Z

func (Z) Sign

func (z1 Z) Sign() int

func (Z) String

func (z1 Z) String() string

func (Z) Sub

func (z1 Z) Sub(z2 Z) Z

type Zs

type Zs []Z

func (Zs) Len

func (zs Zs) Len() int

func (Zs) Less

func (zs Zs) Less(i int, j int) bool

func (Zs) Swap

func (zs Zs) Swap(i int, j int)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL