Documentation ¶
Index ¶
- Constants
- Variables
- func AddUser(v Value, u User)
- func AddValue(user User, v Value)
- func DeleteInst(i Instruction)
- func EmitBefore(before, inst Instruction)
- func EmitInst(i Instruction)
- func GetTypeStr(n Node) string
- func HasUser(n Node) bool
- func Insert(i Instruction, b *BasicBlock)
- func IsConst(v Value) bool
- func IsField(v Value) bool
- func IsObject(v Value) bool
- func NewBlockId() string
- func NewNode() anNode
- func ReplaceValue(v Value, to Value)
- type AliasType
- type Assert
- func (a *Assert) AddValue(v Value)
- func (a *Assert) GetBlock() *BasicBlock
- func (a *Assert) GetParent() *Function
- func (a *Assert) GetType() Type
- func (a *Assert) GetUsers() []User
- func (a *Assert) GetValues() []Value
- func (a *Assert) GetVariable() string
- func (an Assert) NewError(kind ErrorKind, tag ErrorTag, format string, arg ...any)
- func (a *Assert) Pos() string
- func (a *Assert) RemoveValue(v Value)
- func (a *Assert) ReplaceValue(v, to Value)
- func (a *Assert) SetType(ts Type)
- func (a *Assert) SetVariable(name string)
- func (a *Assert) String() string
- type BasicBlock
- func (b *BasicBlock) AddSucc(succ *BasicBlock)
- func (b *BasicBlock) AddUser(u User)
- func (b *BasicBlock) GetBlock(name string) *BasicBlock
- func (b *BasicBlock) GetType() Type
- func (b *BasicBlock) GetUsers() []User
- func (b *BasicBlock) GetValues() []Value
- func (b *BasicBlock) IsBlock(name string) bool
- func (b *BasicBlock) LastInst() Instruction
- func (b *BasicBlock) NewError(kind ErrorKind, tag ErrorTag, format string, arg ...any)
- func (b *BasicBlock) Reachable() int
- func (b *BasicBlock) RemoveUser(u User)
- func (b *BasicBlock) Sealed()
- func (b *BasicBlock) SetPosition(pos *Position)
- func (b *BasicBlock) SetType(ts Type)
- func (b *BasicBlock) String() string
- type BasicType
- type BinOp
- func (n *BinOp) AddUser(u User)
- func (n *BinOp) AddValue(v Value)
- func (a *BinOp) GetBlock() *BasicBlock
- func (a *BinOp) GetParent() *Function
- func (a *BinOp) GetType() Type
- func (n *BinOp) GetUsers() []User
- func (n *BinOp) GetValues() []Value
- func (a *BinOp) GetVariable() string
- func (an BinOp) NewError(kind ErrorKind, tag ErrorTag, format string, arg ...any)
- func (a *BinOp) Pos() string
- func (n *BinOp) RemoveUser(u User)
- func (n *BinOp) RemoveValue(v Value)
- func (b *BinOp) ReplaceValue(v Value, to Value)
- func (a *BinOp) SetType(ts Type)
- func (a *BinOp) SetVariable(name string)
- func (b *BinOp) String() string
- type BinaryOpcode
- type Builder
- type Call
- func (n *Call) AddUser(u User)
- func (n *Call) AddValue(v Value)
- func (a *Call) GetBlock() *BasicBlock
- func (a *Call) GetParent() *Function
- func (a *Call) GetType() Type
- func (n *Call) GetUsers() []User
- func (n *Call) GetValues() []Value
- func (a *Call) GetVariable() string
- func (an Call) NewError(kind ErrorKind, tag ErrorTag, format string, arg ...any)
- func (a *Call) Pos() string
- func (n *Call) RemoveUser(u User)
- func (n *Call) RemoveValue(v Value)
- func (c *Call) ReplaceValue(v Value, to Value)
- func (a *Call) SetType(ts Type)
- func (a *Call) SetVariable(name string)
- func (c *Call) String() string
- type ChanType
- type Const
- func (n *Const) AddUser(u User)
- func (n *Const) AddValue(v Value)
- func (c *Const) Boolean() bool
- func (c *Const) Float() float64
- func (c *Const) GetType() Type
- func (c *Const) GetTypeKind() TypeKind
- func (n *Const) GetUsers() []User
- func (n *Const) GetValues() []Value
- func (c *Const) IsBoolean() bool
- func (c *Const) IsFloat() bool
- func (c *Const) IsNumber() bool
- func (c *Const) IsString() bool
- func (c *Const) Number() int64
- func (n *Const) RemoveUser(u User)
- func (n *Const) RemoveValue(v Value)
- func (c *Const) SetType(ts Type)
- func (c Const) String() string
- func (c *Const) VarString() string
- type ConstInst
- func (n *ConstInst) AddUser(u User)
- func (n *ConstInst) AddValue(v Value)
- func (a *ConstInst) GetBlock() *BasicBlock
- func (a *ConstInst) GetParent() *Function
- func (c *ConstInst) GetType() Type
- func (n *ConstInst) GetUsers() []User
- func (n *ConstInst) GetValues() []Value
- func (a *ConstInst) GetVariable() string
- func (an ConstInst) NewError(kind ErrorKind, tag ErrorTag, format string, arg ...any)
- func (a *ConstInst) Pos() string
- func (n *ConstInst) RemoveUser(u User)
- func (n *ConstInst) RemoveValue(v Value)
- func (c *ConstInst) ReplaceValue(v, to Value)
- func (c *ConstInst) SetType(ts Type)
- func (a *ConstInst) SetVariable(name string)
- func (c *ConstInst) String() string
- type ErrorHandler
- func (e *ErrorHandler) AddDone(d *BasicBlock)
- func (e *ErrorHandler) AddFinal(f *BasicBlock)
- func (a *ErrorHandler) GetBlock() *BasicBlock
- func (a *ErrorHandler) GetParent() *Function
- func (a *ErrorHandler) GetType() Type
- func (a *ErrorHandler) GetVariable() string
- func (an ErrorHandler) NewError(kind ErrorKind, tag ErrorTag, format string, arg ...any)
- func (a *ErrorHandler) Pos() string
- func (a *ErrorHandler) SetType(ts Type)
- func (a *ErrorHandler) SetVariable(name string)
- func (e *ErrorHandler) String() string
- type ErrorKind
- type ErrorTag
- type Field
- func (n *Field) AddUser(u User)
- func (n *Field) AddValue(v Value)
- func (field *Field) Assign(v Value, f *FunctionBuilder)
- func (a *Field) GetBlock() *BasicBlock
- func (f *Field) GetLastValue() Value
- func (a *Field) GetParent() *Function
- func (a *Field) GetType() Type
- func (n *Field) GetUsers() []User
- func (f *Field) GetValue(_ *FunctionBuilder) Value
- func (n *Field) GetValues() []Value
- func (a *Field) GetVariable() string
- func (an Field) NewError(kind ErrorKind, tag ErrorTag, format string, arg ...any)
- func (a *Field) Pos() string
- func (n *Field) RemoveUser(u User)
- func (n *Field) RemoveValue(v Value)
- func (f *Field) ReplaceValue(v, to Value)
- func (a *Field) SetType(ts Type)
- func (a *Field) SetVariable(name string)
- func (f *Field) String() string
- type Function
- func (f *Function) AddUser(u User)
- func (f *Function) DisAsm(flag FunctionAsmFlag) string
- func (f *Function) Finish()
- func (f *Function) GetParent() *Function
- func (f *Function) GetSymbol() *Make
- func (f *Function) GetType() Type
- func (f *Function) GetUsers() []User
- func (f *Function) GetValues() []Value
- func (f *Function) InspectVariable(varName string) *InspectVariableResult
- func (f *Function) NewBasicBlock(name string) *BasicBlock
- func (f *Function) NewBasicBlockUnSealed(name string) *BasicBlock
- func (f *Function) NewErrorWithPos(kind ErrorKind, tag ErrorTag, Pos *Position, format string, arg ...any)
- func (f *Function) NewParam(name string)
- func (f *Function) RemoveUser(u User)
- func (f *Function) ReplaceSymbolTable(v InstructionValue, to Value)
- func (f *Function) ReturnValue() []Value
- func (f *Function) SetReg(i Instruction)
- func (f *Function) SetType(t Type)
- func (f *Function) String() string
- func (f *Function) WriteSymbolTable(variable string, value Value)
- func (f *Function) WriteVariable(variable string, value Value)
- type FunctionAsmFlag
- type FunctionBuilder
- func (b *FunctionBuilder) AddDefer(call *Call)
- func (b *FunctionBuilder) AddSubFunction(builder func())
- func (b *FunctionBuilder) BuildFreeValue(variable string) Value
- func (b *FunctionBuilder) BuildLoop() *LoopBuilder
- func (b *FunctionBuilder) BuildValueFromAny(libname, id string, v any) (value Value)
- func (b *FunctionBuilder) CanBuildFreeValue(variable string) bool
- func (f *FunctionBuilder) CoverReflectFunctionType(itype reflect.Type) *FunctionType
- func (b *FunctionBuilder) CreateInterfaceWithVs(keys []Value, vs []Value) *Make
- func (f *FunctionBuilder) EmitAssert(cond, msgValue Value, msg string) *Assert
- func (f *FunctionBuilder) EmitBinOp(op BinaryOpcode, x, y Value) Value
- func (f *FunctionBuilder) EmitCall(c *Call) *Call
- func (f *FunctionBuilder) EmitConstInst(c *Const) *ConstInst
- func (f *FunctionBuilder) EmitErrorHandler(try, catch *BasicBlock) *ErrorHandler
- func (f *FunctionBuilder) EmitField(i User, key Value) Value
- func (f *FunctionBuilder) EmitFieldMust(i User, key Value) *Field
- func (f *FunctionBuilder) EmitIf(cond Value) *If
- func (f *FunctionBuilder) EmitJump(to *BasicBlock) *Jump
- func (f *FunctionBuilder) EmitLoop(body, exit *BasicBlock, cond Value) *Loop
- func (f *FunctionBuilder) EmitMakeBuildWithType(typ Type, Len, Cap Value) *Make
- func (f *FunctionBuilder) EmitMakeSlice(i User, low, high, max Value) *Make
- func (f *FunctionBuilder) EmitMakeWithoutType(Len, Cap Value) *Make
- func (f *FunctionBuilder) EmitNext(iter Value) (key, field, ok Value)
- func (f *FunctionBuilder) EmitNextOnly(iter Value) *Next
- func (f *FunctionBuilder) EmitPanic(info Value) *Panic
- func (f *FunctionBuilder) EmitRecover() *Recover
- func (f *FunctionBuilder) EmitReturn(vs []Value) *Return
- func (f *FunctionBuilder) EmitSwitch(cond Value, defaultb *BasicBlock, label []SwitchLabel) *Switch
- func (f *FunctionBuilder) EmitTypeCast(v Value, typ Type) *TypeCast
- func (f *FunctionBuilder) EmitUnOp(op UnaryOpcode, v Value) Value
- func (f *FunctionBuilder) EmitUndefine(name string) Value
- func (f *FunctionBuilder) EmitUpdate(address User, v Value) *Update
- func (b *FunctionBuilder) Finish()
- func (b *FunctionBuilder) GetBreak() *BasicBlock
- func (b *FunctionBuilder) GetContinue() *BasicBlock
- func (b *FunctionBuilder) GetFallthrough() *BasicBlock
- func (b *FunctionBuilder) GetField(i User, key Value, create bool) *Field
- func (b *FunctionBuilder) GetIdByBlockSymbolTable(id string) string
- func (b FunctionBuilder) GetParentBuilder() *FunctionBuilder
- func (b FunctionBuilder) HandlerEllipsis()
- func (b *FunctionBuilder) IfBuilder() *IfBuilder
- func (b *FunctionBuilder) MapBlockSymbolTable(text string) string
- func (f *FunctionBuilder) NewCall(target Value, args []Value, isDropError bool) *Call
- func (b *FunctionBuilder) NewCaptureField(text string) *Field
- func (b *FunctionBuilder) NewError(kind ErrorKind, tag ErrorTag, format string, arg ...any)
- func (b *FunctionBuilder) NewField(key string) *Field
- func (b *FunctionBuilder) NewFunc() *Function
- func (b *FunctionBuilder) PopBlockSymbolTable()
- func (b *FunctionBuilder) PopFunction() *FunctionBuilder
- func (b *FunctionBuilder) PopTarget() bool
- func (b *FunctionBuilder) PushBlockSymbolTable()
- func (b *FunctionBuilder) PushFunction(newfunc *Function) *FunctionBuilder
- func (b *FunctionBuilder) PushTarget(_break, _continue, _fallthrough *BasicBlock)
- func (b *FunctionBuilder) ReadField(key string) *Field
- func (b *FunctionBuilder) ReadVariable(variable string, create bool) (ret Value)
- func (b *FunctionBuilder) ReplaceVariable(variable string, v, to Value)
- func (b *FunctionBuilder) SetPosition(pos *Position) *Position
- func (b *FunctionBuilder) TryBuildExternInstance(id string) Value
- func (b *FunctionBuilder) WithExternInstance(vs map[string]any)
- type FunctionType
- type IdentifierLV
- type If
- func (i *If) AddFalse(f *BasicBlock)
- func (i *If) AddTrue(t *BasicBlock)
- func (i *If) AddValue(v Value)
- func (a *If) GetBlock() *BasicBlock
- func (a *If) GetParent() *Function
- func (a *If) GetType() Type
- func (i *If) GetUsers() []User
- func (i *If) GetValues() []Value
- func (a *If) GetVariable() string
- func (an If) NewError(kind ErrorKind, tag ErrorTag, format string, arg ...any)
- func (a *If) Pos() string
- func (i *If) RemoveValue(v Value)
- func (i *If) ReplaceValue(v Value, to Value)
- func (a *If) SetType(ts Type)
- func (a *If) SetVariable(name string)
- func (i *If) String() string
- type IfBuilder
- type InspectVariableResult
- type Instruction
- type InstructionValue
- type InterfaceType
- type Jump
- func (a *Jump) GetBlock() *BasicBlock
- func (a *Jump) GetParent() *Function
- func (a *Jump) GetType() Type
- func (a *Jump) GetVariable() string
- func (an Jump) NewError(kind ErrorKind, tag ErrorTag, format string, arg ...any)
- func (a *Jump) Pos() string
- func (a *Jump) SetType(ts Type)
- func (a *Jump) SetVariable(name string)
- func (j *Jump) String() string
- type LeftValue
- type Loop
- func (l *Loop) AddValue(v Value)
- func (l *Loop) Finish(init, step []Value)
- func (a *Loop) GetBlock() *BasicBlock
- func (a *Loop) GetParent() *Function
- func (a *Loop) GetType() Type
- func (l *Loop) GetUsers() []User
- func (l *Loop) GetValues() []Value
- func (a *Loop) GetVariable() string
- func (an Loop) NewError(kind ErrorKind, tag ErrorTag, format string, arg ...any)
- func (a *Loop) Pos() string
- func (l *Loop) RemoveValue(v Value)
- func (l *Loop) ReplaceValue(v Value, to Value)
- func (a *Loop) SetType(ts Type)
- func (a *Loop) SetVariable(name string)
- func (l *Loop) String() string
- type LoopBuilder
- type Make
- func (n *Make) AddUser(u User)
- func (n *Make) AddValue(v Value)
- func (a *Make) GetBlock() *BasicBlock
- func (a *Make) GetParent() *Function
- func (a *Make) GetType() Type
- func (n *Make) GetUsers() []User
- func (n *Make) GetValues() []Value
- func (a *Make) GetVariable() string
- func (an Make) NewError(kind ErrorKind, tag ErrorTag, format string, arg ...any)
- func (a *Make) Pos() string
- func (n *Make) RemoveUser(u User)
- func (n *Make) RemoveValue(v Value)
- func (i *Make) ReplaceValue(v, to Value)
- func (a *Make) SetType(ts Type)
- func (a *Make) SetVariable(name string)
- func (i *Make) String() string
- type Next
- func (n *Next) AddUser(u User)
- func (n *Next) AddValue(v Value)
- func (a *Next) GetBlock() *BasicBlock
- func (a *Next) GetParent() *Function
- func (a *Next) GetType() Type
- func (n *Next) GetUsers() []User
- func (n *Next) GetValues() []Value
- func (a *Next) GetVariable() string
- func (an Next) NewError(kind ErrorKind, tag ErrorTag, format string, arg ...any)
- func (a *Next) Pos() string
- func (n *Next) RemoveUser(u User)
- func (n *Next) RemoveValue(v Value)
- func (n *Next) ReplaceValue(v, to Value)
- func (a *Next) SetType(ts Type)
- func (a *Next) SetVariable(name string)
- func (n *Next) String() string
- type Node
- type ObjectKind
- type ObjectType
- func (s *ObjectType) AddField(key Value, field Type)
- func (s *ObjectType) Finish()
- func (s *ObjectType) GetField(key Value) (Type, Type)
- func (i *ObjectType) GetMethod(id string) *FunctionType
- func (i *ObjectType) GetTypeKind() TypeKind
- func (itype ObjectType) RawString() string
- func (i *ObjectType) SetMethod(m map[string]*FunctionType)
- func (i *ObjectType) SetName(name string)
- func (itype ObjectType) String() string
- type Package
- type Panic
- func (n *Panic) AddUser(u User)
- func (n *Panic) AddValue(v Value)
- func (a *Panic) GetBlock() *BasicBlock
- func (a *Panic) GetParent() *Function
- func (a *Panic) GetType() Type
- func (n *Panic) GetUsers() []User
- func (n *Panic) GetValues() []Value
- func (a *Panic) GetVariable() string
- func (an Panic) NewError(kind ErrorKind, tag ErrorTag, format string, arg ...any)
- func (a *Panic) Pos() string
- func (n *Panic) RemoveUser(u User)
- func (n *Panic) RemoveValue(v Value)
- func (p *Panic) ReplaceValue(v, to Value)
- func (a *Panic) SetType(ts Type)
- func (a *Panic) SetVariable(name string)
- func (p *Panic) String() string
- type Parameter
- func (n *Parameter) AddUser(u User)
- func (n *Parameter) AddValue(v Value)
- func (p *Parameter) GetType() Type
- func (n *Parameter) GetUsers() []User
- func (n *Parameter) GetValues() []Value
- func (n *Parameter) RemoveUser(u User)
- func (n *Parameter) RemoveValue(v Value)
- func (p *Parameter) ReplaceValue(v, to Value)
- func (p *Parameter) SetType(ts Type)
- func (p *Parameter) String() string
- type Phi
- func (p *Phi) AddEdge(v Value)
- func (n *Phi) AddUser(u User)
- func (n *Phi) AddValue(v Value)
- func (phi *Phi) Build() Value
- func (a *Phi) GetBlock() *BasicBlock
- func (a *Phi) GetParent() *Function
- func (a *Phi) GetType() Type
- func (n *Phi) GetUsers() []User
- func (n *Phi) GetValues() []Value
- func (a *Phi) GetVariable() string
- func (phi *Phi) Name() string
- func (an Phi) NewError(kind ErrorKind, tag ErrorTag, format string, arg ...any)
- func (a *Phi) Pos() string
- func (n *Phi) RemoveUser(u User)
- func (n *Phi) RemoveValue(v Value)
- func (phi *Phi) Replace(to Value)
- func (p *Phi) ReplaceValue(v Value, to Value)
- func (a *Phi) SetType(ts Type)
- func (a *Phi) SetVariable(name string)
- func (p *Phi) String() string
- type Position
- type Program
- func (prog *Program) AddPackage(pkg *Package)
- func (prog *Program) Build(b Builder)
- func (prog *Program) GetErrors() SSAErrors
- func (p *Program) InspectVariable(varName string) *InspectVariableResult
- func (p *Program) InspectVariableLast(varName string) *InspectVariableResult
- func (p *Program) Show()
- func (p *Program) ShowWithSource()
- type Recover
- func (n *Recover) AddUser(u User)
- func (n *Recover) AddValue(v Value)
- func (a *Recover) GetBlock() *BasicBlock
- func (a *Recover) GetParent() *Function
- func (a *Recover) GetType() Type
- func (n *Recover) GetUsers() []User
- func (n *Recover) GetValues() []Value
- func (a *Recover) GetVariable() string
- func (an Recover) NewError(kind ErrorKind, tag ErrorTag, format string, arg ...any)
- func (a *Recover) Pos() string
- func (n *Recover) RemoveUser(u User)
- func (n *Recover) RemoveValue(v Value)
- func (a *Recover) SetType(ts Type)
- func (a *Recover) SetVariable(name string)
- func (r *Recover) String() string
- type Return
- func (r *Return) AddValue(v Value)
- func (a *Return) GetBlock() *BasicBlock
- func (a *Return) GetParent() *Function
- func (a *Return) GetType() Type
- func (r *Return) GetUsers() []User
- func (r *Return) GetValues() []Value
- func (a *Return) GetVariable() string
- func (an Return) NewError(kind ErrorKind, tag ErrorTag, format string, arg ...any)
- func (a *Return) Pos() string
- func (r *Return) RemoveValue(v Value)
- func (r *Return) ReplaceValue(v Value, to Value)
- func (a *Return) SetType(ts Type)
- func (a *Return) SetVariable(name string)
- func (r *Return) String() string
- type SSAError
- type SSAErrors
- type Switch
- func (sw *Switch) AddValue(v Value)
- func (a *Switch) GetBlock() *BasicBlock
- func (a *Switch) GetParent() *Function
- func (a *Switch) GetType() Type
- func (sw *Switch) GetUsers() []User
- func (sw *Switch) GetValues() []Value
- func (a *Switch) GetVariable() string
- func (an Switch) NewError(kind ErrorKind, tag ErrorTag, format string, arg ...any)
- func (a *Switch) Pos() string
- func (sw *Switch) RemoveValue(v Value)
- func (sw *Switch) ReplaceValue(v Value, to Value)
- func (a *Switch) SetType(ts Type)
- func (a *Switch) SetVariable(name string)
- func (sw *Switch) String() string
- type SwitchLabel
- type Type
- type TypeCast
- func (n *TypeCast) AddUser(u User)
- func (n *TypeCast) AddValue(v Value)
- func (a *TypeCast) GetBlock() *BasicBlock
- func (a *TypeCast) GetParent() *Function
- func (a *TypeCast) GetType() Type
- func (n *TypeCast) GetUsers() []User
- func (n *TypeCast) GetValues() []Value
- func (a *TypeCast) GetVariable() string
- func (an TypeCast) NewError(kind ErrorKind, tag ErrorTag, format string, arg ...any)
- func (a *TypeCast) Pos() string
- func (n *TypeCast) RemoveUser(u User)
- func (n *TypeCast) RemoveValue(v Value)
- func (t *TypeCast) ReplaceValue(v, to Value)
- func (a *TypeCast) SetType(ts Type)
- func (a *TypeCast) SetVariable(name string)
- func (t *TypeCast) String() string
- type TypeKind
- type Types
- type UnOp
- func (n *UnOp) AddUser(u User)
- func (n *UnOp) AddValue(v Value)
- func (a *UnOp) GetBlock() *BasicBlock
- func (a *UnOp) GetParent() *Function
- func (a *UnOp) GetType() Type
- func (n *UnOp) GetUsers() []User
- func (n *UnOp) GetValues() []Value
- func (a *UnOp) GetVariable() string
- func (an UnOp) NewError(kind ErrorKind, tag ErrorTag, format string, arg ...any)
- func (a *UnOp) Pos() string
- func (n *UnOp) RemoveUser(u User)
- func (n *UnOp) RemoveValue(v Value)
- func (u *UnOp) ReplaceValue(v Value, to Value)
- func (a *UnOp) SetType(ts Type)
- func (a *UnOp) SetVariable(name string)
- func (u *UnOp) String() string
- type UnaryOpcode
- type Undefine
- func (n *Undefine) AddUser(u User)
- func (n *Undefine) AddValue(v Value)
- func (a *Undefine) GetBlock() *BasicBlock
- func (a *Undefine) GetParent() *Function
- func (a *Undefine) GetType() Type
- func (n *Undefine) GetUsers() []User
- func (n *Undefine) GetValues() []Value
- func (a *Undefine) GetVariable() string
- func (an Undefine) NewError(kind ErrorKind, tag ErrorTag, format string, arg ...any)
- func (a *Undefine) Pos() string
- func (n *Undefine) RemoveUser(u User)
- func (n *Undefine) RemoveValue(v Value)
- func (c *Undefine) ReplaceValue(v, to Value)
- func (a *Undefine) SetType(ts Type)
- func (a *Undefine) SetVariable(name string)
- func (u *Undefine) String() string
- type Update
- func (s *Update) AddUser(u User)
- func (s *Update) AddValue(_ Value)
- func (a *Update) GetBlock() *BasicBlock
- func (a *Update) GetParent() *Function
- func (a *Update) GetType() Type
- func (s *Update) GetUsers() []User
- func (s *Update) GetValues() []Value
- func (a *Update) GetVariable() string
- func (an Update) NewError(kind ErrorKind, tag ErrorTag, format string, arg ...any)
- func (a *Update) Pos() string
- func (s *Update) RemoveUser(u User)
- func (s *Update) RemoveValue(_ Value)
- func (s *Update) ReplaceValue(v, to Value)
- func (a *Update) SetType(ts Type)
- func (a *Update) SetVariable(name string)
- func (s *Update) String() string
- type User
- type Value
Constants ¶
const ( // loop LoopHeader = "loop.header" LoopBody = "loop.body" LoopExit = "loop.exit" LoopLatch = "loop.latch" // if IfDone = "if.done" IfTrue = "if.true" IfFalse = "if.false" IfElif = "if.elif" )
const (
MAXTYPELEVEL = 4
)
Variables ¶
var BasicTypes = []*BasicType{ Number: {Number, "number", make(map[string]*FunctionType, 0)}, String: {String, "string", make(map[string]*FunctionType, 0)}, Boolean: {Boolean, "boolean", make(map[string]*FunctionType, 0)}, UndefineType: {UndefineType, "undefine", make(map[string]*FunctionType, 0)}, Null: {Null, "null", make(map[string]*FunctionType, 0)}, Any: {Any, "any", make(map[string]*FunctionType, 0)}, ErrorType: {ErrorType, "error", make(map[string]*FunctionType, 0)}, }
var BinaryOpcodeName = map[BinaryOpcode]string{
OpLogicAnd: `&&`,
OpLogicOr: `||`,
OpAnd: `and`,
OpAndNot: `and-not`,
OpOr: `or`,
OpXor: `xor`,
OpShl: `shl`,
OpShr: `shr`,
OpAdd: `add`,
OpSub: `sub`,
OpMod: `mod`,
OpMul: `mul`,
OpDiv: `div`,
OpGt: `gt`,
OpLt: `lt`,
OpLtEq: `lt-eq`,
OpGtEq: `gt-eq`,
OpNotEq: `neq`,
OpEq: `eq`,
OpIn: `in`,
OpSend: `send`,
}
----------- BinOp
var (
ConstMap = make(map[any]*Const)
)
var UnaryOpcodeName = map[UnaryOpcode]string{
OpNone: ``,
OpNot: `not`,
OpPlus: `plus`,
OpNeg: `neg`,
OpChan: `chan`,
OpBitwiseNot: `bitwise-not`,
}
----------- UnOp
Functions ¶
func DeleteInst ¶ added in v1.2.8
func DeleteInst(i Instruction)
func EmitBefore ¶
func EmitBefore(before, inst Instruction)
func EmitInst ¶
func EmitInst(i Instruction)
func GetTypeStr ¶
func Insert ¶
func Insert(i Instruction, b *BasicBlock)
func NewBlockId ¶
func NewBlockId() string
func ReplaceValue ¶
Types ¶
type AliasType ¶ added in v1.2.8
type AliasType struct { Name string // contains filtered or unexported fields }
====================== alias type
func NewAliasType ¶ added in v1.2.8
func (*AliasType) GetMethod ¶ added in v1.2.8
func (a *AliasType) GetMethod(id string) *FunctionType
func (*AliasType) GetTypeKind ¶ added in v1.2.8
func (*AliasType) SetMethod ¶ added in v1.2.8
func (a *AliasType) SetMethod(m map[string]*FunctionType)
type Assert ¶ added in v1.2.8
type Assert struct { Cond Value Msg string MsgValue Value // contains filtered or unexported fields }
----------- assert
func NewAssert ¶ added in v1.2.8
func NewAssert(cond, msgValue Value, msg string, block *BasicBlock) *Assert
func (*Assert) GetBlock ¶ added in v1.2.8
func (a *Assert) GetBlock() *BasicBlock
implement instruction
func (*Assert) GetVariable ¶ added in v1.2.8
func (a *Assert) GetVariable() string
func (*Assert) RemoveValue ¶
func (*Assert) ReplaceValue ¶ added in v1.2.8
func (*Assert) SetVariable ¶ added in v1.2.8
func (a *Assert) SetVariable(name string)
type BasicBlock ¶
type BasicBlock struct { Index int Name string // function Parent *Function // basicblock graph Preds, Succs []*BasicBlock /* if Condition == true: this block reach */ Condition Value // instruction list Instrs []Instruction Phis []*Phi // error catch Handler *ErrorHandler Skip bool // for phi build, avoid recursive // contains filtered or unexported fields }
implement Value
func (*BasicBlock) AddSucc ¶
func (b *BasicBlock) AddSucc(succ *BasicBlock)
func (*BasicBlock) AddUser ¶
func (b *BasicBlock) AddUser(u User)
func (*BasicBlock) GetBlock ¶ added in v1.2.8
func (b *BasicBlock) GetBlock(name string) *BasicBlock
func (*BasicBlock) GetType ¶
func (b *BasicBlock) GetType() Type
func (*BasicBlock) GetUsers ¶
func (b *BasicBlock) GetUsers() []User
func (*BasicBlock) IsBlock ¶ added in v1.2.8
func (b *BasicBlock) IsBlock(name string) bool
func (*BasicBlock) LastInst ¶
func (b *BasicBlock) LastInst() Instruction
func (*BasicBlock) NewError ¶ added in v1.2.8
func (b *BasicBlock) NewError(kind ErrorKind, tag ErrorTag, format string, arg ...any)
func (*BasicBlock) Reachable ¶ added in v1.2.8
func (b *BasicBlock) Reachable() int
func (*BasicBlock) RemoveUser ¶
func (b *BasicBlock) RemoveUser(u User)
func (*BasicBlock) Sealed ¶
func (b *BasicBlock) Sealed()
func (*BasicBlock) SetPosition ¶ added in v1.2.8
func (b *BasicBlock) SetPosition(pos *Position)
func (*BasicBlock) SetType ¶
func (b *BasicBlock) SetType(ts Type)
type BasicType ¶
type BasicType struct { Kind TypeKind // contains filtered or unexported fields }
func (*BasicType) GetMethod ¶ added in v1.2.8
func (b *BasicType) GetMethod(id string) *FunctionType
func (*BasicType) GetTypeKind ¶ added in v1.2.8
func (*BasicType) SetMethod ¶ added in v1.2.8
func (b *BasicType) SetMethod(method map[string]*FunctionType)
type BinOp ¶
type BinOp struct { Op BinaryOpcode X, Y Value // contains filtered or unexported fields }
----------- BinOp
func NewBinOpOnly ¶ added in v1.2.8
func NewBinOpOnly(op BinaryOpcode, x, y Value, block *BasicBlock) *BinOp
func (*BinOp) GetVariable ¶ added in v1.2.8
func (a *BinOp) GetVariable() string
func (*BinOp) RemoveUser ¶
func (n *BinOp) RemoveUser(u User)
func (*BinOp) RemoveValue ¶
func (n *BinOp) RemoveValue(v Value)
func (*BinOp) SetVariable ¶ added in v1.2.8
func (a *BinOp) SetVariable(name string)
type BinaryOpcode ¶
type BinaryOpcode int
const ( // Binary OpShl BinaryOpcode = iota // << OpLogicAnd // && OpLogicOr // || OpShr // >> OpAnd // & OpAndNot // &^ OpOr // | OpXor // ^ OpAdd // + OpSub // - OpDiv // / OpMod // % // mul OpMul // * // boolean opcode OpGt // > OpLt // < OpGtEq // >= OpLtEq // <= OpEq // == OpNotEq // != <> OpIn // a in b OpSend // <- )
type Call ¶
type Call struct { // for call function Method Value Args []Value // go function Async bool // caller // caller Value // ~ drop error IsDropError bool // contains filtered or unexported fields }
----------- Call call instruction call method function with args as argument
func NewCall ¶ added in v1.2.8
func NewCall(target Value, args, binding []Value, isDropError bool, block *BasicBlock) *Call
func (*Call) GetVariable ¶ added in v1.2.8
func (a *Call) GetVariable() string
func (*Call) RemoveUser ¶
func (n *Call) RemoveUser(u User)
func (*Call) RemoveValue ¶
func (n *Call) RemoveValue(v Value)
func (*Call) SetVariable ¶ added in v1.2.8
func (a *Call) SetVariable(name string)
type ChanType ¶
type ChanType struct {
// contains filtered or unexported fields
}
====================== chan type
func NewChanType ¶
func (*ChanType) GetMethod ¶ added in v1.2.8
func (c *ChanType) GetMethod(id string) *FunctionType
func (*ChanType) GetTypeKind ¶ added in v1.2.8
func (*ChanType) SetMethod ¶ added in v1.2.8
func (c *ChanType) SetMethod(m map[string]*FunctionType)
type Const ¶
type Const struct { // other Unary int // contains filtered or unexported fields }
const only Value
func CalcConstBinary ¶ added in v1.2.8
func CalcConstBinary(x, y *Const, op BinaryOpcode) *Const
func CalcConstUnary ¶ added in v1.2.8
func CalcConstUnary(x *Const, op UnaryOpcode) *Const
OpNone UnaryOpcode = iota OpNot // ! OpPlus // + OpNeg // - OpChan // ->
func (*Const) GetTypeKind ¶ added in v1.2.8
func (*Const) RemoveUser ¶
func (n *Const) RemoveUser(u User)
func (*Const) RemoveValue ¶
func (n *Const) RemoveValue(v Value)
type ConstInst ¶ added in v1.2.8
type ConstInst struct { Const // contains filtered or unexported fields }
----------- Const constinst also have block pointer, which block set this const to variable
func NewConstInst ¶ added in v1.2.8
func NewConstInst(c *Const, block *BasicBlock) *ConstInst
func (*ConstInst) GetBlock ¶ added in v1.2.8
func (a *ConstInst) GetBlock() *BasicBlock
implement instruction
func (*ConstInst) GetVariable ¶ added in v1.2.8
func (a *ConstInst) GetVariable() string
func (*ConstInst) RemoveUser ¶ added in v1.2.8
func (n *ConstInst) RemoveUser(u User)
func (*ConstInst) RemoveValue ¶
func (n *ConstInst) RemoveValue(v Value)
func (*ConstInst) ReplaceValue ¶ added in v1.3.0
----------- ConstInst
func (*ConstInst) SetVariable ¶ added in v1.2.8
func (a *ConstInst) SetVariable(name string)
type ErrorHandler ¶ added in v1.2.8
type ErrorHandler struct {
// contains filtered or unexported fields
}
------------- ErrorHandler
func NewErrorHandler ¶ added in v1.2.8
func NewErrorHandler(try, catch, block *BasicBlock) *ErrorHandler
func (*ErrorHandler) AddDone ¶ added in v1.2.8
func (e *ErrorHandler) AddDone(d *BasicBlock)
func (*ErrorHandler) AddFinal ¶ added in v1.2.8
func (e *ErrorHandler) AddFinal(f *BasicBlock)
func (*ErrorHandler) GetBlock ¶ added in v1.2.8
func (a *ErrorHandler) GetBlock() *BasicBlock
implement instruction
func (*ErrorHandler) GetVariable ¶ added in v1.2.8
func (a *ErrorHandler) GetVariable() string
func (*ErrorHandler) SetVariable ¶ added in v1.2.8
func (a *ErrorHandler) SetVariable(name string)
func (*ErrorHandler) String ¶ added in v1.2.8
func (e *ErrorHandler) String() string
type Field ¶
type Field struct { // field Key Value Obj User // capture by other function OutCapture bool Update []Value // value // contains filtered or unexported fields }
instruction ----------- Field use-chain: interface(user) -> *field(self) -> multiple update(value) -> value
func NewFieldOnly ¶ added in v1.2.8
func NewFieldOnly(key Value, obj User, block *BasicBlock) *Field
func (*Field) Assign ¶
func (field *Field) Assign(v Value, f *FunctionBuilder)
--------------- point variable to value `f.symbol[variable]value` --------------- it's memory address, not SSA value
func (*Field) GetLastValue ¶
func (*Field) GetValue ¶
func (f *Field) GetValue(_ *FunctionBuilder) Value
func (*Field) GetVariable ¶ added in v1.2.8
func (a *Field) GetVariable() string
func (*Field) RemoveUser ¶
func (n *Field) RemoveUser(u User)
func (*Field) RemoveValue ¶
func (n *Field) RemoveValue(v Value)
func (*Field) SetVariable ¶ added in v1.2.8
func (a *Field) SetVariable(name string)
type Function ¶
type Function struct { Name string Type *FunctionType // package Package *Package Param []*Parameter Return []*Return // BasicBlock list Blocks []*BasicBlock EnterBlock *BasicBlock ExitBlock *BasicBlock // anonymous function in this function AnonFuncs []*Function FreeValues []Value // the value, captured variable form parent-function, Pos *Position // current position // for instruction InstReg map[Instruction]string // instruction -> virtual register // contains filtered or unexported fields }
implement Value
func NewFunctionWithType ¶ added in v1.2.8
func NewFunctionWithType(name string, typ *FunctionType) *Function
just create a function define, only function parameter type \ return type \ ellipsis
func (*Function) DisAsm ¶
func (f *Function) DisAsm(flag FunctionAsmFlag) string
func (*Function) InspectVariable ¶
func (f *Function) InspectVariable(varName string) *InspectVariableResult
func (*Function) NewBasicBlock ¶
func (f *Function) NewBasicBlock(name string) *BasicBlock
func (*Function) NewBasicBlockUnSealed ¶
func (f *Function) NewBasicBlockUnSealed(name string) *BasicBlock
func (*Function) NewErrorWithPos ¶
func (*Function) RemoveUser ¶
func (*Function) ReplaceSymbolTable ¶
func (f *Function) ReplaceSymbolTable(v InstructionValue, to Value)
func (*Function) ReturnValue ¶
func (*Function) SetReg ¶
func (f *Function) SetReg(i Instruction)
func (*Function) WriteSymbolTable ¶
func (*Function) WriteVariable ¶
--------------- `f.currentDef` hanlder, read && write
type FunctionAsmFlag ¶
type FunctionAsmFlag int
const ( DisAsmDefault FunctionAsmFlag = 1 << iota DisAsmWithSource )
type FunctionBuilder ¶
type FunctionBuilder struct { *Function CurrentBlock *BasicBlock // current block to build CurrtenPos *Position // current position in source code // contains filtered or unexported fields }
Function builder API
func NewBuilder ¶
func NewBuilder(f *Function, next *FunctionBuilder) *FunctionBuilder
func (*FunctionBuilder) AddDefer ¶
func (b *FunctionBuilder) AddDefer(call *Call)
add current function defer function
func (*FunctionBuilder) AddSubFunction ¶ added in v1.2.8
func (b *FunctionBuilder) AddSubFunction(builder func())
sub-function builder
func (*FunctionBuilder) BuildFreeValue ¶
func (b *FunctionBuilder) BuildFreeValue(variable string) Value
func (*FunctionBuilder) BuildLoop ¶ added in v1.2.8
func (b *FunctionBuilder) BuildLoop() *LoopBuilder
func (*FunctionBuilder) BuildValueFromAny ¶ added in v1.2.8
func (b *FunctionBuilder) BuildValueFromAny(libname, id string, v any) (value Value)
func (*FunctionBuilder) CanBuildFreeValue ¶
func (b *FunctionBuilder) CanBuildFreeValue(variable string) bool
func (*FunctionBuilder) CoverReflectFunctionType ¶ added in v1.2.8
func (f *FunctionBuilder) CoverReflectFunctionType(itype reflect.Type) *FunctionType
func (*FunctionBuilder) CreateInterfaceWithVs ¶
func (b *FunctionBuilder) CreateInterfaceWithVs(keys []Value, vs []Value) *Make
func (*FunctionBuilder) EmitAssert ¶ added in v1.2.8
func (f *FunctionBuilder) EmitAssert(cond, msgValue Value, msg string) *Assert
func (*FunctionBuilder) EmitBinOp ¶ added in v1.2.8
func (f *FunctionBuilder) EmitBinOp(op BinaryOpcode, x, y Value) Value
func (*FunctionBuilder) EmitCall ¶
func (f *FunctionBuilder) EmitCall(c *Call) *Call
func (*FunctionBuilder) EmitConstInst ¶ added in v1.2.8
func (f *FunctionBuilder) EmitConstInst(c *Const) *ConstInst
func (*FunctionBuilder) EmitErrorHandler ¶ added in v1.2.8
func (f *FunctionBuilder) EmitErrorHandler(try, catch *BasicBlock) *ErrorHandler
func (*FunctionBuilder) EmitFieldMust ¶ added in v1.2.8
func (f *FunctionBuilder) EmitFieldMust(i User, key Value) *Field
func (*FunctionBuilder) EmitIf ¶
func (f *FunctionBuilder) EmitIf(cond Value) *If
func (*FunctionBuilder) EmitJump ¶
func (f *FunctionBuilder) EmitJump(to *BasicBlock) *Jump
func (*FunctionBuilder) EmitLoop ¶ added in v1.2.8
func (f *FunctionBuilder) EmitLoop(body, exit *BasicBlock, cond Value) *Loop
func (*FunctionBuilder) EmitMakeBuildWithType ¶ added in v1.2.8
func (f *FunctionBuilder) EmitMakeBuildWithType(typ Type, Len, Cap Value) *Make
func (*FunctionBuilder) EmitMakeSlice ¶ added in v1.2.8
func (f *FunctionBuilder) EmitMakeSlice(i User, low, high, max Value) *Make
func (*FunctionBuilder) EmitMakeWithoutType ¶ added in v1.2.8
func (f *FunctionBuilder) EmitMakeWithoutType(Len, Cap Value) *Make
func (*FunctionBuilder) EmitNext ¶ added in v1.2.8
func (f *FunctionBuilder) EmitNext(iter Value) (key, field, ok Value)
func (*FunctionBuilder) EmitNextOnly ¶ added in v1.2.8
func (f *FunctionBuilder) EmitNextOnly(iter Value) *Next
func (*FunctionBuilder) EmitPanic ¶ added in v1.2.8
func (f *FunctionBuilder) EmitPanic(info Value) *Panic
func (*FunctionBuilder) EmitRecover ¶ added in v1.2.8
func (f *FunctionBuilder) EmitRecover() *Recover
func (*FunctionBuilder) EmitReturn ¶
func (f *FunctionBuilder) EmitReturn(vs []Value) *Return
func (*FunctionBuilder) EmitSwitch ¶
func (f *FunctionBuilder) EmitSwitch(cond Value, defaultb *BasicBlock, label []SwitchLabel) *Switch
func (*FunctionBuilder) EmitTypeCast ¶ added in v1.2.8
func (f *FunctionBuilder) EmitTypeCast(v Value, typ Type) *TypeCast
func (*FunctionBuilder) EmitUnOp ¶ added in v1.2.8
func (f *FunctionBuilder) EmitUnOp(op UnaryOpcode, v Value) Value
func (*FunctionBuilder) EmitUndefine ¶ added in v1.2.8
func (f *FunctionBuilder) EmitUndefine(name string) Value
func (*FunctionBuilder) EmitUpdate ¶ added in v1.2.8
func (f *FunctionBuilder) EmitUpdate(address User, v Value) *Update
func (*FunctionBuilder) GetBreak ¶
func (b *FunctionBuilder) GetBreak() *BasicBlock
get target feild
func (*FunctionBuilder) GetContinue ¶
func (b *FunctionBuilder) GetContinue() *BasicBlock
func (*FunctionBuilder) GetFallthrough ¶
func (b *FunctionBuilder) GetFallthrough() *BasicBlock
func (*FunctionBuilder) GetField ¶
func (b *FunctionBuilder) GetField(i User, key Value, create bool) *Field
func (*FunctionBuilder) GetIdByBlockSymbolTable ¶ added in v1.2.8
func (b *FunctionBuilder) GetIdByBlockSymbolTable(id string) string
func (FunctionBuilder) GetParentBuilder ¶
func (b FunctionBuilder) GetParentBuilder() *FunctionBuilder
get parent function
func (*FunctionBuilder) IfBuilder ¶
func (b *FunctionBuilder) IfBuilder() *IfBuilder
func (*FunctionBuilder) MapBlockSymbolTable ¶
func (b *FunctionBuilder) MapBlockSymbolTable(text string) string
use block symbol table map variable -> variable+blockid
func (*FunctionBuilder) NewCall ¶
func (f *FunctionBuilder) NewCall(target Value, args []Value, isDropError bool) *Call
func (*FunctionBuilder) NewCaptureField ¶ added in v1.2.8
func (b *FunctionBuilder) NewCaptureField(text string) *Field
func (*FunctionBuilder) NewError ¶
func (b *FunctionBuilder) NewError(kind ErrorKind, tag ErrorTag, format string, arg ...any)
func (*FunctionBuilder) NewField ¶
func (b *FunctionBuilder) NewField(key string) *Field
func (*FunctionBuilder) PopBlockSymbolTable ¶
func (b *FunctionBuilder) PopBlockSymbolTable()
func (*FunctionBuilder) PopFunction ¶
func (b *FunctionBuilder) PopFunction() *FunctionBuilder
func (*FunctionBuilder) PopTarget ¶
func (b *FunctionBuilder) PopTarget() bool
func (*FunctionBuilder) PushBlockSymbolTable ¶
func (b *FunctionBuilder) PushBlockSymbolTable()
block symboltable stack
func (*FunctionBuilder) PushFunction ¶
func (b *FunctionBuilder) PushFunction(newfunc *Function) *FunctionBuilder
function stack
func (*FunctionBuilder) PushTarget ¶
func (b *FunctionBuilder) PushTarget(_break, _continue, _fallthrough *BasicBlock)
target stack
func (*FunctionBuilder) ReadField ¶
func (b *FunctionBuilder) ReadField(key string) *Field
func (*FunctionBuilder) ReadVariable ¶
func (b *FunctionBuilder) ReadVariable(variable string, create bool) (ret Value)
func (*FunctionBuilder) ReplaceVariable ¶
func (b *FunctionBuilder) ReplaceVariable(variable string, v, to Value)
func (*FunctionBuilder) SetPosition ¶
func (b *FunctionBuilder) SetPosition(pos *Position) *Position
handler position: set new position and return original position for backup
func (*FunctionBuilder) TryBuildExternInstance ¶
func (b *FunctionBuilder) TryBuildExternInstance(id string) Value
func (*FunctionBuilder) WithExternInstance ¶
func (b *FunctionBuilder) WithExternInstance(vs map[string]any)
type FunctionType ¶ added in v1.2.8
func NewFunctionType ¶ added in v1.2.8
func NewFunctionType(name string, Parameter []Type, ReturnType []Type, IsVariadic bool) *FunctionType
func (*FunctionType) GetMethod ¶ added in v1.2.8
func (f *FunctionType) GetMethod(string) *FunctionType
func (*FunctionType) GetTypeKind ¶ added in v1.2.8
func (s *FunctionType) GetTypeKind() TypeKind
func (*FunctionType) RawString ¶ added in v1.2.8
func (s *FunctionType) RawString() string
func (*FunctionType) SetMethod ¶ added in v1.2.8
func (f *FunctionType) SetMethod(m map[string]*FunctionType)
func (*FunctionType) SetName ¶ added in v1.2.8
func (s *FunctionType) SetName(name string)
func (*FunctionType) String ¶ added in v1.2.8
func (s *FunctionType) String() string
type IdentifierLV ¶
type IdentifierLV struct {
// contains filtered or unexported fields
}
--------------- only point variable to value with `f.currentDef` --------------- is SSA value
func NewIndentifierLV ¶
func NewIndentifierLV(variable string) *IdentifierLV
func (*IdentifierLV) Assign ¶
func (i *IdentifierLV) Assign(v Value, f *FunctionBuilder)
func (*IdentifierLV) GetValue ¶
func (i *IdentifierLV) GetValue(f *FunctionBuilder) Value
type If ¶
type If struct { Cond Value True *BasicBlock False *BasicBlock // contains filtered or unexported fields }
----------- IF The If instruction transfers control to one of the two successors of its owning block, depending on the boolean Cond: the first if true, the second if false.
func NewIf ¶ added in v1.2.8
func NewIf(cond Value, block *BasicBlock) *If
func (*If) AddFalse ¶
func (i *If) AddFalse(f *BasicBlock)
func (*If) AddTrue ¶
func (i *If) AddTrue(t *BasicBlock)
func (*If) GetVariable ¶ added in v1.2.8
func (a *If) GetVariable() string
func (*If) RemoveValue ¶
func (*If) SetVariable ¶ added in v1.2.8
func (a *If) SetVariable(name string)
type IfBuilder ¶ added in v1.2.8
type IfBuilder struct {
// contains filtered or unexported fields
}
func (*IfBuilder) ElifBranch ¶
func (*IfBuilder) ElseBranch ¶
func (i *IfBuilder) ElseBranch(body func())
type InspectVariableResult ¶
type InspectVariableResult struct { VariableName string // values []Value ProbablyTypes []string ProbablyValues []string MustTypes []string MustValue []string }
func (*InspectVariableResult) Merge ¶
func (r *InspectVariableResult) Merge(other *InspectVariableResult)
type Instruction ¶
type InstructionValue ¶
type InstructionValue interface { Instruction Value // variable GetVariable() string SetVariable(string) }
both instruction and value
type InterfaceType ¶
type InterfaceType struct {
// contains filtered or unexported fields
}
====================== interface type
func NewInterfaceType ¶
func NewInterfaceType(name string) *InterfaceType
func (*InterfaceType) GetMethod ¶ added in v1.2.8
func (i *InterfaceType) GetMethod(id string) *FunctionType
func (*InterfaceType) GetTypeKind ¶ added in v1.2.8
func (i *InterfaceType) GetTypeKind() TypeKind
func (*InterfaceType) RawString ¶ added in v1.2.8
func (i *InterfaceType) RawString() string
func (*InterfaceType) SetMethod ¶ added in v1.2.8
func (i *InterfaceType) SetMethod(m map[string]*FunctionType)
func (*InterfaceType) String ¶
func (i *InterfaceType) String() string
type Jump ¶
type Jump struct { To *BasicBlock // contains filtered or unexported fields }
----------- Jump The Jump instruction transfers control to the sole successor of its owning block.
the block containing Jump instruction only have one successor block
func NewJump ¶ added in v1.2.8
func NewJump(to *BasicBlock, block *BasicBlock) *Jump
func (*Jump) GetVariable ¶ added in v1.2.8
func (a *Jump) GetVariable() string
func (*Jump) SetVariable ¶ added in v1.2.8
func (a *Jump) SetVariable(name string)
type LeftValue ¶
type LeftValue interface { Assign(Value, *FunctionBuilder) GetValue(*FunctionBuilder) Value }
--------------- for assign
type Loop ¶ added in v1.2.8
type Loop struct {
Body, Exit *BasicBlock
Init, Cond, Step Value
Key *Phi
// contains filtered or unexported fields
}
----------- For for loop
func NewLoop ¶ added in v1.2.8
func NewLoop(block *BasicBlock, cond Value) *Loop
func (*Loop) GetVariable ¶ added in v1.2.8
func (a *Loop) GetVariable() string
func (*Loop) RemoveValue ¶
func (*Loop) ReplaceValue ¶ added in v1.2.8
----------- Loop
func (*Loop) SetVariable ¶ added in v1.2.8
func (a *Loop) SetVariable(name string)
type LoopBuilder ¶ added in v1.2.8
type LoopBuilder struct {
// contains filtered or unexported fields
}
func (*LoopBuilder) BuildBody ¶ added in v1.2.8
func (lb *LoopBuilder) BuildBody(f func())
func (*LoopBuilder) BuildCondtion ¶
func (lb *LoopBuilder) BuildCondtion(f func() Value)
func (*LoopBuilder) BuildFirstExpr ¶ added in v1.2.8
func (lb *LoopBuilder) BuildFirstExpr(f func() []Value)
func (*LoopBuilder) BuildThird ¶ added in v1.2.8
func (lb *LoopBuilder) BuildThird(f func() []Value)
func (*LoopBuilder) Finish ¶ added in v1.2.8
func (lb *LoopBuilder) Finish()
type Make ¶ added in v1.2.8
type Make struct { IsNew bool // when slice or map Len, Cap Value // contains filtered or unexported fields }
----------- Make instruction + value + user use-chain: *interface(self) -> multiple field(value)
func NewMake ¶ added in v1.2.8
func NewMake(parentI User, typ Type, low, high, step, Len, Cap Value, block *BasicBlock) *Make
func (*Make) GetVariable ¶ added in v1.2.8
func (a *Make) GetVariable() string
func (*Make) RemoveUser ¶ added in v1.2.8
func (n *Make) RemoveUser(u User)
func (*Make) RemoveValue ¶
func (n *Make) RemoveValue(v Value)
func (*Make) ReplaceValue ¶ added in v1.2.8
// ----------- Interface
func (*Make) SetVariable ¶ added in v1.2.8
func (a *Make) SetVariable(name string)
type Next ¶ added in v1.2.8
type Next struct { Iter Value // contains filtered or unexported fields }
------------- Next
func NewNext ¶ added in v1.2.8
func NewNext(iter Value, block *BasicBlock) *Next
func (*Next) GetVariable ¶ added in v1.2.8
func (a *Next) GetVariable() string
func (*Next) RemoveUser ¶ added in v1.2.8
func (n *Next) RemoveUser(u User)
func (*Next) RemoveValue ¶
func (n *Next) RemoveValue(v Value)
func (*Next) ReplaceValue ¶ added in v1.2.8
// ----------- Next
func (*Next) SetVariable ¶ added in v1.2.8
func (a *Next) SetVariable(name string)
type ObjectKind ¶ added in v1.2.8
type ObjectKind int
==================== interface type
const ( None ObjectKind = iota Slice Map Struct )
type ObjectType ¶ added in v1.2.8
type ObjectType struct { Name string Kind ObjectKind Len int Key []Value FieldTypes []Type Combination bool // contains filtered or unexported fields }
func NewMapType ¶
func NewMapType(key, field Type) *ObjectType
func NewObjectType ¶ added in v1.2.8
func NewObjectType() *ObjectType
func (*ObjectType) AddField ¶ added in v1.2.8
func (s *ObjectType) AddField(key Value, field Type)
for struct build
func (*ObjectType) Finish ¶ added in v1.2.8
func (s *ObjectType) Finish()
===================== Finish simply
func (*ObjectType) GetField ¶ added in v1.2.8
func (s *ObjectType) GetField(key Value) (Type, Type)
return (field-type, key-type)
func (*ObjectType) GetMethod ¶ added in v1.2.8
func (i *ObjectType) GetMethod(id string) *FunctionType
func (*ObjectType) GetTypeKind ¶ added in v1.2.8
func (i *ObjectType) GetTypeKind() TypeKind
func (ObjectType) RawString ¶ added in v1.2.8
func (itype ObjectType) RawString() string
func (*ObjectType) SetMethod ¶ added in v1.2.8
func (i *ObjectType) SetMethod(m map[string]*FunctionType)
func (*ObjectType) SetName ¶ added in v1.2.8
func (i *ObjectType) SetName(name string)
func (ObjectType) String ¶ added in v1.2.8
func (itype ObjectType) String() string
type Package ¶
type Package struct { Name string // point to program Prog *Program // function list Funcs []*Function }
func NewPackage ¶ added in v1.2.8
func (*Package) NewFunction ¶
type Panic ¶ added in v1.2.8
type Panic struct { Info Value // contains filtered or unexported fields }
-------------- PANIC
func (*Panic) GetBlock ¶ added in v1.2.8
func (a *Panic) GetBlock() *BasicBlock
implement instruction
func (*Panic) GetVariable ¶ added in v1.2.8
func (a *Panic) GetVariable() string
func (*Panic) RemoveUser ¶ added in v1.2.8
func (n *Panic) RemoveUser(u User)
func (*Panic) RemoveValue ¶
func (n *Panic) RemoveValue(v Value)
func (*Panic) ReplaceValue ¶ added in v1.2.8
------------- PANIC
func (*Panic) SetVariable ¶ added in v1.2.8
func (a *Panic) SetVariable(name string)
type Parameter ¶
----------- Parameter
func (*Parameter) RemoveUser ¶
func (n *Parameter) RemoveUser(u User)
func (*Parameter) RemoveValue ¶
func (n *Parameter) RemoveValue(v Value)
func (*Parameter) ReplaceValue ¶ added in v1.3.1
// ----------- param
type Phi ¶
type Phi struct { Edge []Value // edge[i] from phi.Block.Preds[i] // contains filtered or unexported fields }
----------- Phi
func (*Phi) GetVariable ¶ added in v1.2.8
func (a *Phi) GetVariable() string
func (*Phi) RemoveUser ¶
func (n *Phi) RemoveUser(u User)
func (*Phi) RemoveValue ¶
func (n *Phi) RemoveValue(v Value)
func (*Phi) SetVariable ¶ added in v1.2.8
func (a *Phi) SetVariable(name string)
type Position ¶
type Program ¶
type Program struct { // package list Packages []*Package // contains filtered or unexported fields }
func NewProgram ¶
func NewProgram() *Program
func (*Program) AddPackage ¶ added in v1.2.8
func (*Program) InspectVariable ¶
func (p *Program) InspectVariable(varName string) *InspectVariableResult
func (*Program) InspectVariableLast ¶ added in v1.2.8
func (p *Program) InspectVariableLast(varName string) *InspectVariableResult
func (*Program) ShowWithSource ¶
func (p *Program) ShowWithSource()
type Recover ¶ added in v1.2.8
type Recover struct {
// contains filtered or unexported fields
}
--------------- RECOVER
func (*Recover) GetBlock ¶ added in v1.2.8
func (a *Recover) GetBlock() *BasicBlock
implement instruction
func (*Recover) GetVariable ¶ added in v1.2.8
func (a *Recover) GetVariable() string
func (*Recover) RemoveUser ¶ added in v1.2.8
func (n *Recover) RemoveUser(u User)
func (*Recover) RemoveValue ¶
func (n *Recover) RemoveValue(v Value)
func (*Recover) SetVariable ¶ added in v1.2.8
func (a *Recover) SetVariable(name string)
type Return ¶
type Return struct { Results []Value // contains filtered or unexported fields }
----------- Return The Return instruction returns values and control back to the calling function.
func NewReturn ¶ added in v1.2.8
func NewReturn(vs []Value, block *BasicBlock) *Return
func (*Return) GetVariable ¶ added in v1.2.8
func (a *Return) GetVariable() string
func (*Return) RemoveValue ¶
func (*Return) SetVariable ¶ added in v1.2.8
func (a *Return) SetVariable(name string)
type SSAError ¶
type Switch ¶
type Switch struct { Cond Value DefaultBlock *BasicBlock Label []SwitchLabel // contains filtered or unexported fields }
func NewSwitch ¶ added in v1.2.8
func NewSwitch(cond Value, defaultb *BasicBlock, label []SwitchLabel, block *BasicBlock) *Switch
func (*Switch) GetVariable ¶ added in v1.2.8
func (a *Switch) GetVariable() string
func (*Switch) RemoveValue ¶
func (*Switch) SetVariable ¶ added in v1.2.8
func (a *Switch) SetVariable(name string)
type SwitchLabel ¶
type SwitchLabel struct { Value Value Dest *BasicBlock }
----------- Switch
func NewSwitchLabel ¶
func NewSwitchLabel(v Value, dest *BasicBlock) SwitchLabel
type Type ¶
type Type interface { String() string RawString() string GetTypeKind() TypeKind // set/get method SetMethod(map[string]*FunctionType) GetMethod(id string) *FunctionType }
func CalculateType ¶ added in v1.2.8
func GetTypeByStr ¶
type TypeCast ¶ added in v1.2.8
type TypeCast struct { Value Value // contains filtered or unexported fields }
----------- Type-cast cast value -> type
func NewTypeCast ¶ added in v1.2.8
func NewTypeCast(typ Type, v Value, block *BasicBlock) *TypeCast
func (*TypeCast) GetBlock ¶ added in v1.2.8
func (a *TypeCast) GetBlock() *BasicBlock
implement instruction
func (*TypeCast) GetVariable ¶ added in v1.2.8
func (a *TypeCast) GetVariable() string
func (*TypeCast) RemoveUser ¶ added in v1.2.8
func (n *TypeCast) RemoveUser(u User)
func (*TypeCast) RemoveValue ¶
func (n *TypeCast) RemoveValue(v Value)
func (*TypeCast) ReplaceValue ¶ added in v1.2.8
// ----------- Typecast
func (*TypeCast) SetVariable ¶ added in v1.2.8
func (a *TypeCast) SetVariable(name string)
type Types ¶
type Types []Type // each value can have multiple type possible
type UnOp ¶
type UnOp struct { Op UnaryOpcode X Value // contains filtered or unexported fields }
func NewUnOpOnly ¶ added in v1.2.8
func NewUnOpOnly(op UnaryOpcode, x Value, block *BasicBlock) *UnOp
func (*UnOp) GetVariable ¶ added in v1.2.8
func (a *UnOp) GetVariable() string
func (*UnOp) RemoveUser ¶ added in v1.2.8
func (n *UnOp) RemoveUser(u User)
func (*UnOp) RemoveValue ¶
func (n *UnOp) RemoveValue(v Value)
func (*UnOp) ReplaceValue ¶ added in v1.2.8
func (*UnOp) SetVariable ¶ added in v1.2.8
func (a *UnOp) SetVariable(name string)
type UnaryOpcode ¶
type UnaryOpcode int
const ( OpNone UnaryOpcode = iota OpNot // ! OpPlus // + OpNeg // - OpChan // <- OpBitwiseNot // ^ )
type Undefine ¶
type Undefine struct {
// contains filtered or unexported fields
}
func NewUndefine ¶
func NewUndefine(name string, block *BasicBlock) *Undefine
func (*Undefine) GetVariable ¶
func (a *Undefine) GetVariable() string
func (*Undefine) RemoveUser ¶
func (n *Undefine) RemoveUser(u User)
func (*Undefine) RemoveValue ¶
func (n *Undefine) RemoveValue(v Value)
func (*Undefine) SetVariable ¶
func (a *Undefine) SetVariable(name string)
type Update ¶
----------- Update use-chain: field(user) -> *update -> value
func (*Update) GetVariable ¶ added in v1.2.8
func (a *Update) GetVariable() string
func (*Update) RemoveUser ¶
func (*Update) RemoveValue ¶
func (*Update) SetVariable ¶ added in v1.2.8
func (a *Update) SetVariable(name string)
type Value ¶
func CalcBianry ¶
func CalcConstBinarySide ¶ added in v1.2.8
func CalcConstBinarySide(c *Const, v Value, op BinaryOpcode) Value
func HandlerBinOp ¶ added in v1.2.8
func HandlerUnOp ¶ added in v1.2.8
func NewBinOp ¶ added in v1.2.8
func NewBinOp(op BinaryOpcode, x, y Value, block *BasicBlock) Value
func NewUnOp ¶ added in v1.2.8
func NewUnOp(op UnaryOpcode, x Value, block *BasicBlock) Value