Documentation
¶
Overview ¶
Package pass implements processing passes on avo Files.
Index ¶
- Variables
- func AllocateRegisters(fn *ir.Function) error
- func BindRegisters(fn *ir.Function) error
- func CFG(fn *ir.Function) error
- func EnsureBasePointerCalleeSaved(fn *ir.Function) error
- func IncludeTextFlagHeader(f *ir.File) error
- func LabelTarget(fn *ir.Function) error
- func Liveness(fn *ir.Function) error
- func PruneDanglingLabels(fn *ir.Function) error
- func PruneJumpToFollowingLabel(fn *ir.Function) error
- func PruneSelfMoves(fn *ir.Function) error
- func RequiredISAExtensions(fn *ir.Function) error
- func VerifyAllocation(fn *ir.Function) error
- func VerifyMemOperands(i *ir.Instruction) error
- func ZeroExtend32BitOutputs(i *ir.Instruction) error
- type Allocator
- type Func
- type FunctionPass
- type InstructionPass
- type Interface
- type Output
Constants ¶
This section is empty.
Variables ¶
var Compile = Concat( Verify, FunctionPass(PruneJumpToFollowingLabel), FunctionPass(PruneDanglingLabels), FunctionPass(LabelTarget), FunctionPass(CFG), InstructionPass(ZeroExtend32BitOutputs), FunctionPass(Liveness), FunctionPass(AllocateRegisters), FunctionPass(BindRegisters), FunctionPass(VerifyAllocation), FunctionPass(EnsureBasePointerCalleeSaved), Func(IncludeTextFlagHeader), FunctionPass(PruneSelfMoves), FunctionPass(RequiredISAExtensions), )
Compile pass compiles an avo file. Upon successful completion the avo file may be printed to Go assembly.
var Verify = Concat( InstructionPass(VerifyMemOperands), )
Verify pass validates an avo file.
Functions ¶
func AllocateRegisters ¶
AllocateRegisters performs register allocation.
func BindRegisters ¶
BindRegisters applies the result of register allocation, replacing all virtual registers with their assigned physical registers.
func EnsureBasePointerCalleeSaved ¶
EnsureBasePointerCalleeSaved ensures that the base pointer register will be saved and restored if it has been clobbered by the function.
func IncludeTextFlagHeader ¶
IncludeTextFlagHeader includes textflag.h if necessary.
func LabelTarget ¶
LabelTarget populates the LabelTarget of the given function. This maps from label name to the following instruction.
func PruneDanglingLabels ¶
PruneDanglingLabels removes labels that are not referenced by any branches.
func PruneJumpToFollowingLabel ¶
PruneJumpToFollowingLabel removes jump instructions that target an immediately following label.
func PruneSelfMoves ¶
PruneSelfMoves removes move instructions from one register to itself.
func RequiredISAExtensions ¶
RequiredISAExtensions determines ISA extensions required for the given function. Populates the ISA field.
func VerifyAllocation ¶
VerifyAllocation performs sanity checks following register allocation.
func VerifyMemOperands ¶
func VerifyMemOperands(i *ir.Instruction) error
VerifyMemOperands checks the instruction's memory operands.
func ZeroExtend32BitOutputs ¶
func ZeroExtend32BitOutputs(i *ir.Instruction) error
ZeroExtend32BitOutputs applies the rule that "32-bit operands generate a 32-bit result, zero-extended to a 64-bit result in the destination general-purpose register" (Intel Software Developer’s Manual, Volume 1, 3.4.1.1).
Types ¶
type Allocator ¶
type Allocator struct {
// contains filtered or unexported fields
}
Allocator is a graph-coloring register allocator.
func NewAllocator ¶
NewAllocator builds an allocator for the given physical registers.
func NewAllocatorForKind ¶
NewAllocatorForKind builds an allocator for the given kind of registers.
func (*Allocator) Add ¶
Add adds a register to be allocated. Does nothing if the register has already been added.
func (*Allocator) AddInterference ¶
AddInterference records that x and y must be assigned to non-conflicting physical registers.
func (*Allocator) AddInterferenceSet ¶
AddInterferenceSet records that r interferes with every register in s. Convenience wrapper around AddInterference.
func (*Allocator) Allocate ¶
func (a *Allocator) Allocate() (reg.Allocation, error)
Allocate allocates physical registers.
func (*Allocator) SetPriority ¶
SetPriority sets the priority of the given regiser to p. Higher priority registers are preferred in allocations. By default all registers have 0 priority. Priority will only apply to subsequent Add() calls, therefore typically all SetPriority calls should happen at allocator initialization.
type FunctionPass ¶
FunctionPass is a convenience for implementing a full file pass with a function that operates on each avo Function independently.
type InstructionPass ¶
type InstructionPass func(*ir.Instruction) error
InstructionPass is a convenience for implementing a full file pass with a function that operates on each Instruction independently.