Documentation ¶
Index ¶
- Constants
- func HasVArg(t *types.Tuple, n int) bool
- func Initialize(flags InitFlags)
- func IsVArg(arg *types.Var) bool
- func SetDebug(dbgFlags dbgFlags)
- func VArg() *types.Var
- type BasicBlock
- type Builder
- func (b Builder) Alloc(t Type, heap bool) (ret Expr)
- func (b Builder) BinOp(op token.Token, x, y Expr) Expr
- func (b Builder) Call(fn Expr, args ...Expr) (ret Expr)
- func (b Builder) Const(v constant.Value, typ Type) Expr
- func (b Builder) If(cond Expr, thenb, elseb BasicBlock)
- func (b Builder) IndexAddr(x, idx Expr) Expr
- func (b Builder) Jump(jmpb BasicBlock)
- func (b Builder) Load(ptr Expr) Expr
- func (b Builder) Return(results ...Expr)
- func (b Builder) SetBlock(blk BasicBlock) Builder
- func (b Builder) Store(ptr, val Expr) Builder
- func (b Builder) UnOp(op token.Token, x Expr) Expr
- type Expr
- type Function
- type Global
- type InitFlags
- type NamedConst
- type Package
- func (p Package) FuncOf(name string) Function
- func (p Package) NewConst(name string, val constant.Value) NamedConst
- func (p Package) NewFunc(name string, sig *types.Signature) Function
- func (p Package) NewVar(name string, typ types.Type) Global
- func (p Package) String() string
- func (p Package) VarOf(name string) Global
- type Program
- func (p Program) Bool() Type
- func (p Program) BoolVal(v bool) Expr
- func (p Program) Elem(typ Type) Type
- func (p Program) Float64() Type
- func (p Program) Index(typ Type) Type
- func (p Program) Int() Type
- func (p Program) IntVal(v uint64, t Type) Expr
- func (p Program) NewPackage(name, pkgPath string) Package
- func (p Program) Null(t Type) Expr
- func (p Program) Pointer(typ Type) Type
- func (p Program) Type(typ types.Type) Type
- func (p Program) Val(v interface{}) Expr
- func (p Program) Void() Type
- type Target
- type Type
Constants ¶
const ( DbgFlagInstruction dbgFlags = 1 << iota DbgFlagAll = DbgFlagInstruction )
const (
NameValist = "__llgo_va_list"
)
Variables ¶
This section is empty.
Functions ¶
Types ¶
type BasicBlock ¶
type BasicBlock = *aBasicBlock
BasicBlock represents a basic block in a function.
func (BasicBlock) Index ¶
func (p BasicBlock) Index() int
Index returns the index of the basic block in the parent function.
func (BasicBlock) Parent ¶
func (p BasicBlock) Parent() Function
Parent returns the function to which the basic block belongs.
type Builder ¶
type Builder = *aBuilder
Builder represents a builder for creating instructions in a function.
func (Builder) Alloc ¶
The Alloc instruction reserves space for a variable of the given type, zero-initializes it, and yields its address.
If heap is false, Alloc zero-initializes the same local variable in the call frame and returns its address; in this case the Alloc must be present in Function.Locals. We call this a "local" alloc.
If heap is true, Alloc allocates a new zero-initialized variable each time the instruction is executed. We call this a "new" alloc.
When Alloc is applied to a channel, map or slice type, it returns the address of an uninitialized (nil) reference of that kind; store the result of MakeSlice, MakeMap or MakeChan in that location to instantiate these types.
Example printed form:
t0 = local int t1 = new int
func (Builder) BinOp ¶
The BinOp instruction yields the result of binary operation (x op y). op can be: ADD SUB MUL QUO REM + - * / % AND OR XOR SHL SHR AND_NOT & | ^ << >> &^ EQL NEQ LSS LEQ GTR GEQ == != < <= < >=
func (Builder) Call ¶
The Call instruction represents a function or method call.
The Call instruction yields the function result if there is exactly one. Otherwise it returns a tuple, the components of which are accessed via Extract.
Example printed form:
t2 = println(t0, t1) t4 = t3() t7 = invoke t5.Println(...t6)
func (Builder) If ¶
func (b Builder) If(cond Expr, thenb, elseb BasicBlock)
If emits an if instruction.
func (Builder) IndexAddr ¶
The IndexAddr instruction yields the address of the element at index `idx` of collection `x`. `idx` is an integer expression.
The elements of maps and strings are not addressable; use Lookup (map), Index (string), or MapUpdate instead.
Dynamically, this instruction panics if `x` evaluates to a nil *array pointer.
Example printed form:
t2 = &t0[t1]
func (Builder) SetBlock ¶
func (b Builder) SetBlock(blk BasicBlock) Builder
SetBlock sets the current block to the specified basic block.
type Function ¶
type Function = *aFunction
Function represents a function or method.
func (Function) Block ¶
func (p Function) Block(idx int) BasicBlock
Block returns the ith basic block of the function.
func (Function) MakeBlocks ¶
func (p Function) MakeBlocks(nblk int) []BasicBlock
MakeBlocks creates nblk basic blocks for the function.
func (Function) MakeBody ¶
MakeBody creates nblk basic blocks for the function, and creates a new Builder associated to #0 block.
func (Function) NewBuilder ¶
NewBuilder creates a new Builder for the function.
type Global ¶
type Global = *aGlobal
A Global is a named Value holding the address of a package-level variable.
type InitFlags ¶
type InitFlags int
InitFlags is a set of flags for initializing the LLVM library.
const ( InitNativeTarget InitFlags = 1 << iota InitAllTargets InitAllTargetInfos InitAllTargetMCs InitNativeAsmPrinter InitAllAsmPrinters InitAllAsmParsers InitNative = InitNativeTarget | InitNativeAsmPrinter InitAll = InitAllTargets | InitAllAsmParsers | InitAllAsmPrinters | InitAllTargetInfos | InitAllTargetMCs )
type NamedConst ¶
type NamedConst = *aNamedConst
A NamedConst is a Member of a Package representing a package-level named constant.
Pos() returns the position of the declaring ast.ValueSpec.Names[*] identifier.
NB: a NamedConst is not a Value; it contains a constant Value, which it augments with the name and position of its 'const' declaration.
type Package ¶
type Package = *aPackage
type Program ¶
type Program = *aProgram
A Program presents a program.
func (Program) NewPackage ¶
NewPackage creates a new package.