tgossa

package
v0.0.0-...-e0dd9a7 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2016 License: BSD-3-Clause, MIT Imports: 3 Imported by: 0

Documentation

Overview

Package tgossa provides pure ssa optimization functions in TARDISgo.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckNames

func CheckNames(f *ssa.Function) error

CheckNames exists because of this comment in the SSA code documentation: "Many objects are nonetheless named to aid in debugging, but it is not essential that the names be either accurate or unambiguous. "

func DeRefUl

func DeRefUl(T types.Type) types.Type

DeRefUl dereferencs a type and gets to it's underlying type

func VisitedFunctions

func VisitedFunctions(prog *ssa.Program, packs []*ssa.Package, isOvl isOverloaded) (seen, usesGR map[*ssa.Function]bool)

VisitedFunctions finds only those functions visited from the main package, using the logic of: AllFunctions finds and returns the set of functions potentially needed by program prog, as determined by a simple linker-style reachability algorithm starting from the members and method-sets of each package. The result may include anonymous functions and synthetic wrappers.

Precondition: all packages are built.

Types

type BlockAction

type BlockAction int

BlockAction keeps track of what action a block has when it is reconstructed

const (

	// IsElse is an else block to an if statement
	IsElse BlockAction
	// NotElse is when the if statement does not have an else block
	NotElse
	// EndElseBracket shows where to put the end-bracket of an else
	EndElseBracket
	// EndWhile shows where to put the end-bracket of a while
	EndWhile
)

func (BlockAction) String

func (ba BlockAction) String() string

type BlockFormat

type BlockFormat struct {
	Seq, Index        int
	Stack             *BlockStack
	WhileCandidateEnd int
	IfCandidate       BlockAction
	ReversePolarity   bool
	IsWhileCandidate  bool
}

BlockFormat holds how to reconstruct an individual block

func Reconstruct

func Reconstruct(blocksIn []*ssa.BasicBlock, usesGr bool) []BlockFormat

Reconstruct builds instructions for reconstructing SSA form into a High Level Language

type BlockStack

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

BlockStack keeps track of the block reconstructions for a function

func (*BlockStack) Len

func (bs *BlockStack) Len() int

Len returns the size of the stack

func (*BlockStack) Pop

func (bs *BlockStack) Pop() (action BlockAction, seq, index int, ok bool)

Pop a value from the BlockStack

func (*BlockStack) Push

func (bs *BlockStack) Push(action BlockAction, seq, index int) bool

Push onto the BlockStack

type BlockStackEntry

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

BlockStackEntry holds the action and where it should be done

Jump to

Keyboard shortcuts

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