Documentation ¶
Index ¶
- func AliasCorrect(p *ast.Program, aliases [][]ast.Variable, outputs []ast.Variable, ...) *ast.Program
- func InputSet(p *ast.Program) map[ast.Variable]bool
- func Inputs(p *ast.Program) []ast.Variable
- func IsPrimitive(p *ast.Program) bool
- func IsPrimitiveExpression(expr ast.Expression) bool
- func IsSSA(p *ast.Program) bool
- func Lower(p *ast.Program) (*ast.Program, error)
- func Pare(p *ast.Program, outputs []ast.Variable) (*ast.Program, error)
- func ReadOnly(p *ast.Program, v ast.Variable) bool
- func RenameVariables(p *ast.Program, replacements map[ast.Variable]ast.Variable) *ast.Program
- func SortedVariables(vs []ast.Variable) []ast.Variable
- func VariableSet(vs []ast.Variable) map[ast.Variable]bool
- func Variables(p *ast.Program) []ast.Variable
- type InterferenceGraph
- type LiveSet
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AliasCorrect ¶
func AliasCorrect(p *ast.Program, aliases [][]ast.Variable, outputs []ast.Variable, vars name.UniqueSequence) *ast.Program
AliasCorrect ensures that the program p will compute the same result if the given variables are aliased. Aliased variables are pointers to the same memory location. If the program is already robust to the given alias sets, no changes will be made. Otherwise the program will be modified with additional temporaries.
func IsPrimitive ¶
IsPrimitive reports whether p consists of only primitive operations.
func IsPrimitiveExpression ¶
func IsPrimitiveExpression(expr ast.Expression) bool
IsPrimitiveExpression reports whether expr is a primitive operation. By "primitive", we mean that the operation directly translates to an efficient field operation.
1. Powers other than square are not considered primitive. They must be decomposed into multiplies and squares.
2. Constant multiplies are not primitive. Although they could be executed as multiplies, they are typically best replaced with additions.
func RenameVariables ¶
RenameVariables applies the given variable replacements to the program p.
func SortedVariables ¶
SortedVariables returns the variables vs sorted in string order.
func VariableSet ¶
VariableSet builds a set from a list of variables.
Types ¶
type InterferenceGraph ¶
type InterferenceGraph struct {
// contains filtered or unexported fields
}
InterferenceGraph records which variables interfere with each other.
func BuildInterferenceGraph ¶
func BuildInterferenceGraph(p *ast.Program, outputs []ast.Variable) *InterferenceGraph
BuildInterferenceGraph builds the interference graph for variables in p, given that the provided outputs are required.
func NewInterferenceGraph ¶
func NewInterferenceGraph() *InterferenceGraph
NewInterferenceGraph builds an empty interference graph.
func (*InterferenceGraph) AddInterference ¶
func (g *InterferenceGraph) AddInterference(x, y ast.Variable)
AddInterference records that x and y interfere.
type LiveSet ¶
LiveSet maintains a set of live variables.
func (LiveSet) Update ¶
func (l LiveSet) Update(a ast.Assignment)
Update the live set based on the assignment. In liveness analysis, program assignments should be processed in reverse.
Directories ¶
Path | Synopsis |
---|---|
Package eval provides an evaluator for op3 programs.
|
Package eval provides an evaluator for op3 programs. |