Documentation
¶
Overview ¶
Package ir declares an intermediate representation for acc programs.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var One = Index(0)
One is the first element in the addition chain, which by definition always has the value 1.
Functions ¶
Types ¶
type Instruction ¶
Instruction assigns the result of an operation to an operand.
func (Instruction) Clone ¶
func (i Instruction) Clone() *Instruction
Clone returns a copy of the instruction.
func (Instruction) Operands ¶
func (i Instruction) Operands() []*Operand
Operands returns the input and output operands.
func (Instruction) String ¶
func (i Instruction) String() string
type Operand ¶
Operand represents an element of an addition chain, with an optional identifier.
func NewOperand ¶
NewOperand builds a named operand for index i.
type Program ¶
type Program struct { Instructions []*Instruction // Pass/analysis results. Operands map[int]*Operand ReadCount map[int]int Program addchain.Program Chain addchain.Chain Temporaries []string }
Program is a sequence of acc instructions.
func (*Program) AddInstruction ¶
func (p *Program) AddInstruction(i *Instruction)
AddInstruction appends an instruction to the program.
func (Program) Clone ¶
Clone returns a copy of p. Pass results are not copied and would need to be rerun on the clone.
Click to show internal directories.
Click to hide internal directories.