go/pkg/mod/github.com/mmcloughlin/[email protected]/ir/ir.go

type Node

type Label

func (l Label) node() {}

type Comment

func (c *Comment) node() {}

// NewComment builds a Comment consisting of the provided lines.
func NewComment(lines ...string) *Comment {}

type Instruction

func (i *Instruction) node() {}

// OpcodeWithSuffixes returns the full opcode, including dot-separated suffixes.
func (i *Instruction) OpcodeWithSuffixes() string {}

// IsUnconditionalBranch reports whether i is an unconditional branch.
func (i Instruction) IsUnconditionalBranch() bool {}

// TargetLabel returns the label referenced by this instruction. Returns nil if
// no label is referenced.
func (i Instruction) TargetLabel() *Label {}

// Registers returns all registers involved in the instruction.
func (i Instruction) Registers() []reg.Register {}

// InputRegisters returns all registers read by this instruction.
func (i Instruction) InputRegisters() []reg.Register {}

// OutputRegisters returns all registers written by this instruction.
func (i Instruction) OutputRegisters() []reg.Register {}

type Section

type File

// NewFile initializes an empty file.
func NewFile() *File {}

// AddSection appends a Section to the file.
func (f *File) AddSection(s Section) {}

// Functions returns all functions in the file.
func (f *File) Functions() []*Function {}

type Pragma

type Function

func (f *Function) section() {}

// NewFunction builds an empty function of the given name.
func NewFunction(name string) *Function {}

// AddPragma adds a pragma to this function.
func (f *Function) AddPragma(directive string, args ...string) {}

// SetSignature sets the function signature.
func (f *Function) SetSignature(s *gotypes.Signature) {}

// AllocLocal allocates size bytes in this function's stack.
// Returns a reference to the base pointer for the newly allocated region.
func (f *Function) AllocLocal(size int) operand.Mem {}

// AddInstruction appends an instruction to f.
func (f *Function) AddInstruction(i *Instruction) {}

// AddLabel appends a label to f.
func (f *Function) AddLabel(l Label) {}

// AddComment adds comment lines to f.
func (f *Function) AddComment(lines ...string) {}

// AddNode appends a Node to f.
func (f *Function) AddNode(n Node) {}

// Instructions returns just the list of instruction nodes.
func (f *Function) Instructions() []*Instruction {}

// Labels returns just the list of label nodes.
func (f *Function) Labels() []Label {}

// Stub returns the Go function declaration.
func (f *Function) Stub() string {}

// FrameBytes returns the size of the stack frame in bytes.
func (f *Function) FrameBytes() int {}

// ArgumentBytes returns the size of the arguments in bytes.
func (f *Function) ArgumentBytes() int {}

type Datum

// NewDatum builds a Datum from the given constant.
func NewDatum(offset int, v operand.Constant) Datum {}

// Interval returns the range of bytes this datum will occupy within its section.
func (d Datum) Interval() (int, int) {}

// Overlaps returns true
func (d Datum) Overlaps(other Datum) bool {}

type Global

// NewGlobal constructs an empty DATA section.
func NewGlobal(sym operand.Symbol) *Global {}

// NewStaticGlobal is a convenience for building a static DATA section.
func NewStaticGlobal(name string) *Global {}

func (g *Global) section() {}

// Base returns a pointer to the start of the data section.
func (g *Global) Base() operand.Mem {}

// Grow ensures that the data section has at least the given size.
func (g *Global) Grow(size int) {}

// AddDatum adds d to this data section, growing it if necessary. Errors if the datum overlaps with existing data.
func (g *Global) AddDatum(d Datum) error {}

// Append the constant to the end of the data section.
func (g *Global) Append(v operand.Constant) {}

func (g *Global) add(d Datum) {}