ir

package
v0.15.0 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2020 License: BSD-3-Clause Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MethodSignature

func MethodSignature(method *types.Func) string

Make a readable version of a method signature (including the function name, excluding the receiver name). This string is used internally to match interfaces and to call the correct method on an interface. Examples:

String() string
Read([]byte) (int, error)

Types

type Function

type Function struct {
	*ssa.Function
	LLVMFn llvm.Value
	// contains filtered or unexported fields
}

Function or method.

func (*Function) CName

func (f *Function) CName() string

Return the name of the C function if this is a CGo wrapper. Otherwise, return a zero-length string.

func (*Function) Inline added in v0.6.0

func (f *Function) Inline() InlineType

Return the inline directive of this function.

func (*Function) IsExported

func (f *Function) IsExported() bool

Return true iff this function is externally visible.

func (*Function) IsNoBounds

func (f *Function) IsNoBounds() bool

func (*Function) LinkName

func (f *Function) LinkName() string

Return the link name for this function.

func (*Function) Module added in v0.8.0

func (f *Function) Module() string

Return the module name if not the default.

type InlineType added in v0.6.0

type InlineType int
const (
	// Default behavior. The compiler decides for itself whether any given
	// function will be inlined. Whether any function is inlined depends on the
	// optimization level.
	InlineDefault InlineType = iota

	// Inline hint, just like the C inline keyword (signalled using
	// //go:inline). The compiler will be more likely to inline this function,
	// but it is not a guarantee.
	InlineHint

	// Don't inline, just like the GCC noinline attribute. Signalled using
	// //go:noinline.
	InlineNone
)

How much to inline.

type Interface

type Interface struct {
	Num  int
	Type *types.Interface
}

Interface type that is at some point used in a type assert (to check whether it implements another interface).

type Program

type Program struct {
	Program       *ssa.Program
	LoaderProgram *loader.Program

	Functions []*Function
	// contains filtered or unexported fields
}

View on all functions, types, and globals in a program, with analysis results.

func NewProgram

func NewProgram(lprogram *loader.Program) *Program

Create and initialize a new *Program from a *ssa.Program.

func (*Program) AddPackage

func (p *Program) AddPackage(pkg *ssa.Package)

Add a package to this Program. All packages need to be added first before any analysis is done for correct results.

func (*Program) GetFunction

func (p *Program) GetFunction(ssaFn *ssa.Function) *Function

func (*Program) MainPkg

func (p *Program) MainPkg() *ssa.Package

func (*Program) SimpleDCE

func (p *Program) SimpleDCE() error

Simple pass that removes dead code. This pass makes later analysis passes more useful.

Jump to

Keyboard shortcuts

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