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 ¶
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 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) 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