Documentation ¶
Index ¶
- Constants
- Variables
- func BindingNotFound(v string, r *Range) string
- func BindingNotFoundInCall(v string) string
- func ContAssignExtern(name string) string
- func DeleteInst(i Instruction)
- func ExternFieldError(instance, name, key, want string) string
- func GetAllKey(t Type) []string
- func GetMethodsName(t Type) []string
- func GetTypeStr(n Value) string
- func InsertValueReplaceOriginal(name string, original Value, insert Value)
- func IsControlInstruction(i Instruction) bool
- func IsObjectType(t Type) bool
- func LineDisasm(v Instruction) string
- func NewInstruction() anInstruction
- func NewValue() anValue
- func NoCheckMustInFirst() string
- func ReplaceAllValue(v Value, to Value)
- func ReplaceValue(v Value, to Value, skip func(Instruction) bool)
- func ReplaceValueInSymbolTable(v, to Value)
- func RunOnCoverOr[T, U Instruction](insts []U, cover func(Instruction) (T, bool), f func(T), or func(U))
- func TryGetSimilarityKey(table []string, name string) string
- func TypeCompare(t1, t2 Type) bool
- func TypeCompareEx(t1, t2 Type, depth int) bool
- func ValueUndefined(v string) string
- type AliasType
- func (b *AliasType) AddMethod(id string, f *FunctionType)
- func (a *AliasType) GetMethod() map[string]*FunctionType
- func (a *AliasType) GetTypeKind() TypeKind
- func (b *AliasType) PkgPath() string
- func (a *AliasType) RawString() string
- func (a *AliasType) SetMethod(m map[string]*FunctionType)
- func (a *AliasType) String() string
- type Assert
- func (i *Assert) AddMask(v Value)
- func (a *Assert) AddVariable(v *Variable)
- func (a *Assert) GetAllVariables() map[string]*Variable
- func (a *Assert) GetBlock() *BasicBlock
- func (a *Assert) GetFunc() *Function
- func (a *Assert) GetId() int
- func (i *Assert) GetMask() []Value
- func (a *Assert) GetName() string
- func (i *Assert) GetOpcode() Opcode
- func (a *Assert) GetOperand(i int) Value
- func (a *Assert) GetOperandNum() int
- func (a *Assert) GetOperands() Values
- func (a *Assert) GetProgram() *Program
- func (c *Assert) GetRange() *Range
- func (a *Assert) GetScope() *Scope
- func (r *Assert) GetUsers() Users
- func (a *Assert) GetValues() Values
- func (a *Assert) GetVariable(name string) *Variable
- func (r *Assert) HasUsers() bool
- func (a *Assert) HasValues() bool
- func (c *Assert) IsExtern() bool
- func (a *Assert) LineDisasm() string
- func (i *Assert) Masked() bool
- func (c *Assert) NewError(kind ErrorKind, tag ErrorTag, msg string)
- func (a *Assert) ReplaceValue(v, to Value)
- func (a *Assert) SetBlock(block *BasicBlock)
- func (c *Assert) SetExtern(b bool)
- func (a *Assert) SetFunc(f *Function)
- func (a *Assert) SetId(id int)
- func (a *Assert) SetName(v string)
- func (c *Assert) SetRange(pos *Range)
- func (a *Assert) SetScope(s *Scope)
- func (a *Assert) String() string
- type BasicBlock
- func (i *BasicBlock) AddMask(v Value)
- func (b *BasicBlock) AddSucc(succ *BasicBlock)
- func (n *BasicBlock) AddUser(u User)
- func (a *BasicBlock) AddVariable(v *Variable)
- func (b *BasicBlock) EmitInst(i Instruction)
- func (a *BasicBlock) GetAllVariables() map[string]*Variable
- func (a *BasicBlock) GetBlock() *BasicBlock
- func (b *BasicBlock) GetBlockById(name string) *BasicBlock
- func (a *BasicBlock) GetFunc() *Function
- func (a *BasicBlock) GetId() int
- func (i *BasicBlock) GetMask() []Value
- func (a *BasicBlock) GetName() string
- func (i *BasicBlock) GetOpcode() Opcode
- func (a *BasicBlock) GetOperand(i int) Value
- func (a *BasicBlock) GetOperandNum() int
- func (a *BasicBlock) GetOperands() Values
- func (a *BasicBlock) GetProgram() *Program
- func (c *BasicBlock) GetRange() *Range
- func (a *BasicBlock) GetScope() *Scope
- func (b *BasicBlock) GetType() Type
- func (n *BasicBlock) GetUsers() Users
- func (b *BasicBlock) GetValues() Values
- func (block *BasicBlock) GetValuesByVariable(name string) []Value
- func (a *BasicBlock) GetVariable(name string) *Variable
- func (n *BasicBlock) HasUsers() bool
- func (b *BasicBlock) HasValues() bool
- func (b *BasicBlock) IsBlock(name string) bool
- func (c *BasicBlock) IsExtern() bool
- func (b *BasicBlock) LastInst() Instruction
- func (a *BasicBlock) LineDisasm() string
- func (i *BasicBlock) Masked() bool
- func (c *BasicBlock) NewError(kind ErrorKind, tag ErrorTag, msg string)
- func (b *BasicBlock) Reachable() int
- func (n *BasicBlock) RemoveUser(u User)
- func (b *BasicBlock) Sealed()
- func (a *BasicBlock) SetBlock(block *BasicBlock)
- func (c *BasicBlock) SetExtern(b bool)
- func (a *BasicBlock) SetFunc(f *Function)
- func (a *BasicBlock) SetId(id int)
- func (a *BasicBlock) SetName(v string)
- func (c *BasicBlock) SetRange(pos *Range)
- func (a *BasicBlock) SetScope(s *Scope)
- func (b *BasicBlock) SetType(ts Type)
- func (b *BasicBlock) String() string
- type BasicType
- func (b *BasicType) AddMethod(id string, f *FunctionType)
- func (b *BasicType) GetMethod() map[string]*FunctionType
- func (b *BasicType) GetTypeKind() TypeKind
- func (b *BasicType) PkgPath() string
- func (b *BasicType) RawString() string
- func (b *BasicType) SetMethod(method map[string]*FunctionType)
- func (b *BasicType) String() string
- type BinOp
- func (i *BinOp) AddMask(v Value)
- func (n *BinOp) AddUser(u User)
- func (a *BinOp) AddVariable(v *Variable)
- func (a *BinOp) GetAllVariables() map[string]*Variable
- func (a *BinOp) GetBlock() *BasicBlock
- func (a *BinOp) GetFunc() *Function
- func (a *BinOp) GetId() int
- func (i *BinOp) GetMask() []Value
- func (a *BinOp) GetName() string
- func (i *BinOp) GetOpcode() Opcode
- func (a *BinOp) GetOperand(i int) Value
- func (a *BinOp) GetOperandNum() int
- func (a *BinOp) GetOperands() Values
- func (a *BinOp) GetProgram() *Program
- func (c *BinOp) GetRange() *Range
- func (a *BinOp) GetScope() *Scope
- func (n *BinOp) GetType() Type
- func (n *BinOp) GetUsers() Users
- func (b *BinOp) GetValues() Values
- func (a *BinOp) GetVariable(name string) *Variable
- func (n *BinOp) HasUsers() bool
- func (b *BinOp) HasValues() bool
- func (c *BinOp) IsExtern() bool
- func (a *BinOp) LineDisasm() string
- func (i *BinOp) Masked() bool
- func (c *BinOp) NewError(kind ErrorKind, tag ErrorTag, msg string)
- func (n *BinOp) RemoveUser(u User)
- func (b *BinOp) ReplaceValue(v Value, to Value)
- func (a *BinOp) SetBlock(block *BasicBlock)
- func (c *BinOp) SetExtern(b bool)
- func (a *BinOp) SetFunc(f *Function)
- func (a *BinOp) SetId(id int)
- func (a *BinOp) SetName(v string)
- func (c *BinOp) SetRange(pos *Range)
- func (a *BinOp) SetScope(s *Scope)
- func (n *BinOp) SetType(typ Type)
- func (b *BinOp) String() string
- type BinaryOpcode
- type Call
- func (i *Call) AddMask(v Value)
- func (n *Call) AddUser(u User)
- func (a *Call) AddVariable(v *Variable)
- func (a *Call) GetAllVariables() map[string]*Variable
- func (a *Call) GetBlock() *BasicBlock
- func (a *Call) GetFunc() *Function
- func (a *Call) GetId() int
- func (i *Call) GetMask() []Value
- func (a *Call) GetName() string
- func (i *Call) GetOpcode() Opcode
- func (a *Call) GetOperand(i int) Value
- func (a *Call) GetOperandNum() int
- func (a *Call) GetOperands() Values
- func (a *Call) GetProgram() *Program
- func (c *Call) GetRange() *Range
- func (a *Call) GetScope() *Scope
- func (n *Call) GetType() Type
- func (n *Call) GetUsers() Users
- func (c *Call) GetValues() Values
- func (a *Call) GetVariable(name string) *Variable
- func (c *Call) HandleFreeValue(fvs []string, sideEffect []string)
- func (n *Call) HasUsers() bool
- func (c *Call) HasValues() bool
- func (c *Call) IsExtern() bool
- func (a *Call) LineDisasm() string
- func (i *Call) Masked() bool
- func (c *Call) NewError(kind ErrorKind, tag ErrorTag, msg string)
- func (n *Call) RemoveUser(u User)
- func (c *Call) ReplaceValue(v Value, to Value)
- func (a *Call) SetBlock(block *BasicBlock)
- func (c *Call) SetExtern(b bool)
- func (a *Call) SetFunc(f *Function)
- func (a *Call) SetId(id int)
- func (a *Call) SetName(v string)
- func (c *Call) SetRange(pos *Range)
- func (a *Call) SetScope(s *Scope)
- func (n *Call) SetType(typ Type)
- func (c *Call) String() string
- type ChanType
- func (b *ChanType) AddMethod(id string, f *FunctionType)
- func (c *ChanType) GetMethod() map[string]*FunctionType
- func (c *ChanType) GetTypeKind() TypeKind
- func (c ChanType) PkgPath() string
- func (c ChanType) RawString() string
- func (c *ChanType) SetMethod(m map[string]*FunctionType)
- func (c ChanType) String() string
- type Const
- func (c *Const) Boolean() bool
- func (c *Const) Float() float64
- func (c *Const) GetRawValue() any
- func (c *Const) GetType() Type
- func (c *Const) GetTypeKind() TypeKind
- 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 (c *Const) SetType(ts Type)
- func (c Const) String() string
- func (c *Const) VarString() string
- type ConstInst
- func CalcConstBinary(x, y *ConstInst, op BinaryOpcode) *ConstInst
- func CalcConstUnary(x *ConstInst, op UnaryOpcode) *ConstInst
- func NewAny() *ConstInst
- func NewConst(i any) *ConstInst
- func NewConstInst(c *Const) *ConstInst
- func NewConstWithUnary(i any, un int) *ConstInst
- func NewNil() *ConstInst
- func ToConst(v Instruction) (*ConstInst, bool)
- func (i *ConstInst) AddMask(v Value)
- func (n *ConstInst) AddUser(u User)
- func (a *ConstInst) AddVariable(v *Variable)
- func (a *ConstInst) GetAllVariables() map[string]*Variable
- func (a *ConstInst) GetBlock() *BasicBlock
- func (a *ConstInst) GetFunc() *Function
- func (a *ConstInst) GetId() int
- func (i *ConstInst) GetMask() []Value
- func (a *ConstInst) GetName() string
- func (i *ConstInst) GetOpcode() Opcode
- func (a *ConstInst) GetOperand(i int) Value
- func (a *ConstInst) GetOperandNum() int
- func (a *ConstInst) GetOperands() Values
- func (a *ConstInst) GetProgram() *Program
- func (c *ConstInst) GetRange() *Range
- func (a *ConstInst) GetScope() *Scope
- func (c *ConstInst) GetType() Type
- func (n *ConstInst) GetUsers() Users
- func (c *ConstInst) GetValues() Values
- func (a *ConstInst) GetVariable(name string) *Variable
- func (n *ConstInst) HasUsers() bool
- func (c *ConstInst) HasValues() bool
- func (c *ConstInst) IsExtern() bool
- func (a *ConstInst) LineDisasm() string
- func (i *ConstInst) Masked() bool
- func (c *ConstInst) NewError(kind ErrorKind, tag ErrorTag, msg string)
- func (n *ConstInst) RemoveUser(u User)
- func (c *ConstInst) ReplaceValue(v Value, to Value)
- func (a *ConstInst) SetBlock(block *BasicBlock)
- func (c *ConstInst) SetExtern(b bool)
- func (a *ConstInst) SetFunc(f *Function)
- func (a *ConstInst) SetId(id int)
- func (a *ConstInst) SetName(v string)
- func (c *ConstInst) SetRange(pos *Range)
- func (a *ConstInst) SetScope(s *Scope)
- func (c *ConstInst) SetType(ts Type)
- func (c *ConstInst) String() string
- type DisasmLiner
- type ErrorComment
- type ErrorCommentId
- type ErrorHandler
- func (e *ErrorHandler) AddDone(d *BasicBlock)
- func (e *ErrorHandler) AddFinal(f *BasicBlock)
- func (i *ErrorHandler) AddMask(v Value)
- func (a *ErrorHandler) AddVariable(v *Variable)
- func (a *ErrorHandler) GetAllVariables() map[string]*Variable
- func (a *ErrorHandler) GetBlock() *BasicBlock
- func (a *ErrorHandler) GetFunc() *Function
- func (a *ErrorHandler) GetId() int
- func (i *ErrorHandler) GetMask() []Value
- func (a *ErrorHandler) GetName() string
- func (i *ErrorHandler) GetOpcode() Opcode
- func (a *ErrorHandler) GetOperand(i int) Value
- func (a *ErrorHandler) GetOperandNum() int
- func (a *ErrorHandler) GetOperands() Values
- func (a *ErrorHandler) GetProgram() *Program
- func (c *ErrorHandler) GetRange() *Range
- func (a *ErrorHandler) GetScope() *Scope
- func (a *ErrorHandler) GetVariable(name string) *Variable
- func (c *ErrorHandler) IsExtern() bool
- func (a *ErrorHandler) LineDisasm() string
- func (i *ErrorHandler) Masked() bool
- func (c *ErrorHandler) NewError(kind ErrorKind, tag ErrorTag, msg string)
- func (a *ErrorHandler) SetBlock(block *BasicBlock)
- func (c *ErrorHandler) SetExtern(b bool)
- func (a *ErrorHandler) SetFunc(f *Function)
- func (a *ErrorHandler) SetId(id int)
- func (a *ErrorHandler) SetName(v string)
- func (c *ErrorHandler) SetRange(pos *Range)
- func (a *ErrorHandler) SetScope(s *Scope)
- func (e *ErrorHandler) String() string
- type ErrorKind
- type ErrorLogger
- type ErrorTag
- type ExternLib
- func (i *ExternLib) AddMask(v Value)
- func (n *ExternLib) AddUser(u User)
- func (a *ExternLib) AddVariable(v *Variable)
- func (a *ExternLib) GetAllVariables() map[string]*Variable
- func (a *ExternLib) GetBlock() *BasicBlock
- func (a *ExternLib) GetFunc() *Function
- func (a *ExternLib) GetId() int
- func (i *ExternLib) GetMask() []Value
- func (a *ExternLib) GetName() string
- func (i *ExternLib) GetOpcode() Opcode
- func (a *ExternLib) GetOperand(i int) Value
- func (a *ExternLib) GetOperandNum() int
- func (a *ExternLib) GetOperands() Values
- func (a *ExternLib) GetProgram() *Program
- func (c *ExternLib) GetRange() *Range
- func (a *ExternLib) GetScope() *Scope
- func (n *ExternLib) GetType() Type
- func (n *ExternLib) GetUsers() Users
- func (e *ExternLib) GetValues() Values
- func (a *ExternLib) GetVariable(name string) *Variable
- func (n *ExternLib) HasUsers() bool
- func (e *ExternLib) HasValues() bool
- func (c *ExternLib) IsExtern() bool
- func (a *ExternLib) LineDisasm() string
- func (i *ExternLib) Masked() bool
- func (c *ExternLib) NewError(kind ErrorKind, tag ErrorTag, msg string)
- func (n *ExternLib) RemoveUser(u User)
- func (e *ExternLib) ReplaceValue(v Value, to Value)
- func (a *ExternLib) SetBlock(block *BasicBlock)
- func (c *ExternLib) SetExtern(b bool)
- func (a *ExternLib) SetFunc(f *Function)
- func (a *ExternLib) SetId(id int)
- func (a *ExternLib) SetName(v string)
- func (c *ExternLib) SetRange(pos *Range)
- func (a *ExternLib) SetScope(s *Scope)
- func (n *ExternLib) SetType(typ Type)
- func (e *ExternLib) String() string
- type Field
- func (i *Field) AddMask(v Value)
- func (n *Field) AddUser(u User)
- func (a *Field) AddVariable(v *Variable)
- func (field *Field) Assign(v Value, f *FunctionBuilder)
- func (a *Field) GetAllVariables() map[string]*Variable
- func (a *Field) GetBlock() *BasicBlock
- func (a *Field) GetFunc() *Function
- func (a *Field) GetId() int
- func (i *Field) GetMask() []Value
- func (a *Field) GetName() string
- func (i *Field) GetOpcode() Opcode
- func (a *Field) GetOperand(i int) Value
- func (a *Field) GetOperandNum() int
- func (a *Field) GetOperands() Values
- func (a *Field) GetProgram() *Program
- func (c *Field) GetRange() *Range
- func (a *Field) GetScope() *Scope
- func (n *Field) GetType() Type
- func (n *Field) GetUsers() Users
- func (f *Field) GetValue(_ *FunctionBuilder) Value
- func (f *Field) GetValues() Values
- func (a *Field) GetVariable(name string) *Variable
- func (n *Field) HasUsers() bool
- func (f *Field) HasValues() bool
- func (c *Field) IsExtern() bool
- func (a *Field) LineDisasm() string
- func (i *Field) Masked() bool
- func (c *Field) NewError(kind ErrorKind, tag ErrorTag, msg string)
- func (n *Field) RemoveUser(u User)
- func (f *Field) ReplaceValue(v, to Value)
- func (a *Field) SetBlock(block *BasicBlock)
- func (c *Field) SetExtern(b bool)
- func (a *Field) SetFunc(f *Function)
- func (a *Field) SetId(id int)
- func (a *Field) SetName(v string)
- func (c *Field) SetRange(pos *Range)
- func (a *Field) SetScope(s *Scope)
- func (n *Field) SetType(typ Type)
- func (f *Field) String() string
- type Function
- func (f *Function) AddErrorComment(str string, line int) error
- func (i *Function) AddMask(v Value)
- func (f *Function) AddSideEffect(name string, v Value)
- func (n *Function) AddUser(u User)
- func (a *Function) AddVariable(v *Variable)
- func (f *Function) DisAsm(flag FunctionAsmFlag) string
- func (f *Function) EachScope(handler func(*Scope))
- func (f *Function) Finish()
- func (f *Function) FirstBlockInstruction() []Instruction
- func (f *Function) GetAllSymbols() map[string]Values
- func (a *Function) GetAllVariables() map[string]*Variable
- func (a *Function) GetBlock() *BasicBlock
- func (f *Function) GetDeferBlock() *BasicBlock
- func (a *Function) GetFunc() *Function
- func (a *Function) GetId() int
- func (i *Function) GetMask() []Value
- func (a *Function) GetName() string
- func (i *Function) GetOpcode() Opcode
- func (a *Function) GetOperand(i int) Value
- func (a *Function) GetOperandNum() int
- func (a *Function) GetOperands() Values
- func (f *Function) GetParent() *Function
- func (f *Function) GetProgram() *Program
- func (c *Function) GetRange() *Range
- func (a *Function) GetScope() *Scope
- func (n *Function) GetType() Type
- func (n *Function) GetUsers() Users
- func (f *Function) GetValues() Values
- func (f *Function) GetValuesByName(name string) InstructionNodes
- func (a *Function) GetVariable(name string) *Variable
- func (n *Function) HasUsers() bool
- func (f *Function) HasValues() bool
- func (c *Function) IsExtern() bool
- func (f *Function) IsMain() bool
- func (a *Function) LineDisasm() string
- func (i *Function) Masked() bool
- func (f *Function) NewBasicBlock(name string) *BasicBlock
- func (f *Function) NewBasicBlockNotAddBlocks(name string) *BasicBlock
- func (f *Function) NewBasicBlockNotAddUnSealed(name string) *BasicBlock
- func (f *Function) NewBasicBlockUnSealed(name string) *BasicBlock
- func (f *Function) NewError(kind ErrorKind, tag ErrorTag, format string)
- func (f *Function) NewErrorWithPos(kind ErrorKind, tag ErrorTag, Pos *Range, message string)
- func (n *Function) RemoveUser(u User)
- func (f *Function) ReplaceVariable(variable string, v, to Value)
- func (f *Function) ReturnValue() []Value
- func (a *Function) SetBlock(block *BasicBlock)
- func (c *Function) SetExtern(b bool)
- func (a *Function) SetFunc(f *Function)
- func (a *Function) SetId(id int)
- func (a *Function) SetName(v string)
- func (c *Function) SetRange(pos *Range)
- func (a *Function) SetScope(s *Scope)
- func (n *Function) SetType(typ Type)
- func (f *Function) String() string
- type FunctionAsmFlag
- type FunctionBuilder
- func (b *FunctionBuilder) AddDefer(call *Call)
- func (b *FunctionBuilder) AddLabel(name string, block *BasicBlock)
- func (i FunctionBuilder) AddMask(v Value)
- func (b *FunctionBuilder) AddToCmap(key string)
- func (b *FunctionBuilder) AddToLmap(key string)
- func (b *FunctionBuilder) AddUnsealedBlock(block *BasicBlock)
- func (n FunctionBuilder) AddUser(u User)
- func (a FunctionBuilder) AddVariable(v *Variable)
- func (b *FunctionBuilder) BuildFreeValue(variable string) Value
- func (b *FunctionBuilder) BuildIf() *IfBuilder
- func (b *FunctionBuilder) BuildLoop() *LoopBuilder
- func (b *FunctionBuilder) BuildSwitch() *SwitchBuilder
- func (b *FunctionBuilder) BuildTry() *TryBuilder
- func (b *FunctionBuilder) BuildValueFromAny(id string, v any) (value Value)
- func (b *FunctionBuilder) CanBuildFreeValue(name string) bool
- func (f *FunctionBuilder) CoverReflectFunctionType(itype reflect.Type, level int) *FunctionType
- func (b *FunctionBuilder) CreateInterfaceWithVs(keys []Value, vs []Value) *Make
- func (b *FunctionBuilder) DeleteLabel(name string)
- 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(i any) *ConstInst
- func (f *FunctionBuilder) EmitConstInstAny() *ConstInst
- func (f *FunctionBuilder) EmitConstInstNil() *ConstInst
- func (f *FunctionBuilder) EmitConstInstWithUnary(i any, un int) *ConstInst
- func (f *FunctionBuilder) EmitErrorHandler(try, catch *BasicBlock) *ErrorHandler
- func (f *FunctionBuilder) EmitField(i, key Value) Value
- func (f *FunctionBuilder) EmitFieldMust(i, key Value) *Field
- func (f *FunctionBuilder) EmitIf(cond Value) *If
- func (f *FunctionBuilder) EmitInstructionAfter(i, after Instruction)
- func (f *FunctionBuilder) EmitInstructionBefore(i, before Instruction)
- func (b *FunctionBuilder) EmitInterfaceMake(f func(feed func(key Value, val Value))) *Make
- 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 Value, low, high, max Value) *Make
- func (f *FunctionBuilder) EmitMakeWithoutType(Len, Cap Value) *Make
- func (f *FunctionBuilder) EmitNext(iter Value, isIn bool) (key, field, ok Value)
- func (f *FunctionBuilder) EmitNextOnly(iter Value, isIn bool) *Next
- func (f *FunctionBuilder) EmitOnly(i Instruction)
- 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) EmitToBlock(i Instruction, block *BasicBlock)
- func (f *FunctionBuilder) EmitTypeCast(v Value, typ Type) *TypeCast
- func (f *FunctionBuilder) EmitTypeValue(typ Type) *TypeValue
- func (f *FunctionBuilder) EmitUnOp(op UnaryOpcode, v Value) Value
- func (f *FunctionBuilder) EmitUndefine(name string) *Undefined
- func (f *FunctionBuilder) EmitUpdate(address, v Value) *Update
- func (b *FunctionBuilder) Finish()
- func (a FunctionBuilder) GetAllVariables() map[string]*Variable
- func (a FunctionBuilder) GetBlock() *BasicBlock
- func (b *FunctionBuilder) GetBreak() *BasicBlock
- func (b *FunctionBuilder) GetContinue() *BasicBlock
- func (b *FunctionBuilder) GetFallthrough() *BasicBlock
- func (b *FunctionBuilder) GetFromCmap(key string) bool
- func (b *FunctionBuilder) GetFromLmap(key string) bool
- func (a FunctionBuilder) GetFunc() *Function
- func (a FunctionBuilder) GetId() int
- func (b *FunctionBuilder) GetLabel(name string) *BasicBlock
- func (i FunctionBuilder) GetMask() []Value
- func (a FunctionBuilder) GetName() string
- func (a FunctionBuilder) GetOperand(i int) Value
- func (a FunctionBuilder) GetOperandNum() int
- func (a FunctionBuilder) GetOperands() Values
- func (b FunctionBuilder) GetParentBuilder() *FunctionBuilder
- func (c FunctionBuilder) GetRange() *Range
- func (a FunctionBuilder) GetScope() *Scope
- func (b *FunctionBuilder) GetScopeLocalVariable(id string) string
- func (n FunctionBuilder) GetType() Type
- func (n FunctionBuilder) GetUsers() Users
- func (a FunctionBuilder) GetVariable(name string) *Variable
- func (b FunctionBuilder) HandlerEllipsis()
- func (n FunctionBuilder) HasUsers() bool
- func (b *FunctionBuilder) IsBlockFinish() bool
- func (c FunctionBuilder) IsExtern() bool
- func (a FunctionBuilder) LineDisasm() string
- func (i FunctionBuilder) Masked() bool
- func (f *FunctionBuilder) NewCall(target Value, args []Value) *Call
- func (b *FunctionBuilder) NewError(kind ErrorKind, tag ErrorTag, massage string, arg ...interface{})
- func (b *FunctionBuilder) NewFunc(name string) (*Function, *Scope)
- func (f *FunctionBuilder) NewParam(name string) *Parameter
- func (b *FunctionBuilder) NewScopeId() int
- func (b *FunctionBuilder) PeekLexicalVariableByName(variable string) Value
- func (b *FunctionBuilder) PeekVariable(variable string, create bool) Value
- func (b *FunctionBuilder) PopFunction() *FunctionBuilder
- func (b *FunctionBuilder) PopTarget() bool
- func (b *FunctionBuilder) PushFunction(newFunc *Function, scope *Scope, block *BasicBlock) *FunctionBuilder
- func (b *FunctionBuilder) PushTarget(_break, _continue, _fallthrough *BasicBlock)
- func (b *FunctionBuilder) ReadVariable(variable string, create bool) Value
- func (b *FunctionBuilder) ReadVariableBefore(variable string, create bool, before Instruction) Value
- func (b *FunctionBuilder) ReadVariableEx(variable string, create bool, fun func([]Value))
- func (n FunctionBuilder) RemoveUser(u User)
- func (b *FunctionBuilder) ScopeEnd()
- func (b *FunctionBuilder) ScopeStart()
- func (a FunctionBuilder) SetBlock(block *BasicBlock)
- func (f *FunctionBuilder) SetCurrent(i Instruction) func()
- func (b *FunctionBuilder) SetDefineFunc()
- func (c FunctionBuilder) SetExtern(b bool)
- func (a FunctionBuilder) SetFunc(f *Function)
- func (a FunctionBuilder) SetId(id int)
- func (f *FunctionBuilder) SetInstructionPosition(i Instruction)
- func (a FunctionBuilder) SetName(v string)
- func (c FunctionBuilder) SetRange(pos *Range)
- func (a FunctionBuilder) SetScope(s *Scope)
- func (b *FunctionBuilder) SetScopeLocalVariable(text string) string
- func (n FunctionBuilder) SetType(typ Type)
- func (b *FunctionBuilder) TryBuildExternValue(id string) Value
- func (b *FunctionBuilder) TryGetSimilarityKey(name, key string) string
- func (b *FunctionBuilder) WithDefineFunction(defineFunc map[string]any)
- func (b *FunctionBuilder) WithExternLib(lib map[string]map[string]any)
- func (b *FunctionBuilder) WithExternMethod(builder MethodBuilder)
- func (b *FunctionBuilder) WithExternValue(vs map[string]any)
- func (f *FunctionBuilder) WriteVariable(variable string, value Value)
- type FunctionType
- func GetMethod(t Type, id string) *FunctionType
- func NewFunctionType(name string, Parameter []Type, ReturnType Type, IsVariadic bool) *FunctionType
- func NewFunctionTypeDefine(name string, Parameter []Type, ReturnType []Type, IsVariadic bool) *FunctionType
- func ToFunctionType(t Type) (*FunctionType, bool)
- func (b *FunctionType) AddMethod(id string, f *FunctionType)
- func (f *FunctionType) GetMethod() map[string]*FunctionType
- func (s *FunctionType) GetParamString() string
- func (s *FunctionType) GetTypeKind() TypeKind
- func (s *FunctionType) PkgPath() string
- func (s *FunctionType) RawString() string
- func (s *FunctionType) SetFreeValue(fv []string)
- func (f *FunctionType) SetMethod(m map[string]*FunctionType)
- func (f *FunctionType) SetModifySelf(b bool)
- func (s *FunctionType) SetName(name string)
- func (s *FunctionType) SetSideEffect(se []string)
- func (s *FunctionType) String() string
- type IdentifierLV
- type If
- func (i *If) AddFalse(f *BasicBlock)
- func (i *If) AddMask(v Value)
- func (i *If) AddTrue(t *BasicBlock)
- func (a *If) AddVariable(v *Variable)
- func (a *If) GetAllVariables() map[string]*Variable
- func (a *If) GetBlock() *BasicBlock
- func (a *If) GetFunc() *Function
- func (a *If) GetId() int
- func (i *If) GetMask() []Value
- func (a *If) GetName() string
- func (i *If) GetOpcode() Opcode
- func (a *If) GetOperand(i int) Value
- func (a *If) GetOperandNum() int
- func (a *If) GetOperands() Values
- func (a *If) GetProgram() *Program
- func (c *If) GetRange() *Range
- func (a *If) GetScope() *Scope
- func (r *If) GetUsers() Users
- func (i *If) GetValues() Values
- func (a *If) GetVariable(name string) *Variable
- func (r *If) HasUsers() bool
- func (i *If) HasValues() bool
- func (c *If) IsExtern() bool
- func (a *If) LineDisasm() string
- func (i *If) Masked() bool
- func (c *If) NewError(kind ErrorKind, tag ErrorTag, msg string)
- func (i *If) ReplaceValue(v Value, to Value)
- func (a *If) SetBlock(block *BasicBlock)
- func (c *If) SetExtern(b bool)
- func (a *If) SetFunc(f *Function)
- func (a *If) SetId(id int)
- func (a *If) SetName(v string)
- func (c *If) SetRange(pos *Range)
- func (a *If) SetScope(s *Scope)
- func (i *If) String() string
- type IfBuilder
- func (i *IfBuilder) BuildChild(child *IfBuilder)
- func (i *IfBuilder) BuildCondition(condition func() Value) *IfBuilder
- func (i *IfBuilder) BuildElif(condition func() Value, body func()) *IfBuilder
- func (i *IfBuilder) BuildFalse(body func()) *IfBuilder
- func (i *IfBuilder) BuildTrue(body func()) *IfBuilder
- func (i *IfBuilder) Finish()
- type Instruction
- type InstructionNode
- type InstructionNodes
- type InterfaceType
- func (b *InterfaceType) AddMethod(id string, f *FunctionType)
- func (i *InterfaceType) GetMethod() map[string]*FunctionType
- func (i *InterfaceType) GetTypeKind() TypeKind
- func (i *InterfaceType) PkgPath() string
- func (i *InterfaceType) RawString() string
- func (i *InterfaceType) SetMethod(m map[string]*FunctionType)
- func (i *InterfaceType) String() string
- type Jump
- func (i *Jump) AddMask(v Value)
- func (a *Jump) AddVariable(v *Variable)
- func (a *Jump) GetAllVariables() map[string]*Variable
- func (a *Jump) GetBlock() *BasicBlock
- func (a *Jump) GetFunc() *Function
- func (a *Jump) GetId() int
- func (i *Jump) GetMask() []Value
- func (a *Jump) GetName() string
- func (i *Jump) GetOpcode() Opcode
- func (a *Jump) GetOperand(i int) Value
- func (a *Jump) GetOperandNum() int
- func (a *Jump) GetOperands() Values
- func (a *Jump) GetProgram() *Program
- func (c *Jump) GetRange() *Range
- func (a *Jump) GetScope() *Scope
- func (a *Jump) GetVariable(name string) *Variable
- func (c *Jump) IsExtern() bool
- func (a *Jump) LineDisasm() string
- func (i *Jump) Masked() bool
- func (c *Jump) NewError(kind ErrorKind, tag ErrorTag, msg string)
- func (a *Jump) SetBlock(block *BasicBlock)
- func (c *Jump) SetExtern(b bool)
- func (a *Jump) SetFunc(f *Function)
- func (a *Jump) SetId(id int)
- func (a *Jump) SetName(v string)
- func (c *Jump) SetRange(pos *Range)
- func (a *Jump) SetScope(s *Scope)
- func (j *Jump) String() string
- type LeftValue
- type Loop
- func (i *Loop) AddMask(v Value)
- func (a *Loop) AddVariable(v *Variable)
- func (l *Loop) Finish(init, step []Value)
- func (a *Loop) GetAllVariables() map[string]*Variable
- func (a *Loop) GetBlock() *BasicBlock
- func (a *Loop) GetFunc() *Function
- func (a *Loop) GetId() int
- func (i *Loop) GetMask() []Value
- func (a *Loop) GetName() string
- func (i *Loop) GetOpcode() Opcode
- func (a *Loop) GetOperand(i int) Value
- func (a *Loop) GetOperandNum() int
- func (a *Loop) GetOperands() Values
- func (a *Loop) GetProgram() *Program
- func (c *Loop) GetRange() *Range
- func (a *Loop) GetScope() *Scope
- func (r *Loop) GetUsers() Users
- func (l *Loop) GetValues() Values
- func (a *Loop) GetVariable(name string) *Variable
- func (r *Loop) HasUsers() bool
- func (l *Loop) HasValues() bool
- func (c *Loop) IsExtern() bool
- func (a *Loop) LineDisasm() string
- func (i *Loop) Masked() bool
- func (c *Loop) NewError(kind ErrorKind, tag ErrorTag, msg string)
- func (l *Loop) ReplaceValue(v Value, to Value)
- func (a *Loop) SetBlock(block *BasicBlock)
- func (c *Loop) SetExtern(b bool)
- func (a *Loop) SetFunc(f *Function)
- func (a *Loop) SetId(id int)
- func (a *Loop) SetName(v string)
- func (c *Loop) SetRange(pos *Range)
- func (a *Loop) SetScope(s *Scope)
- func (l *Loop) String() string
- type LoopBuilder
- type Make
- func (i *Make) AddMask(v Value)
- func (n *Make) AddUser(u User)
- func (a *Make) AddVariable(v *Variable)
- func (a *Make) GetAllVariables() map[string]*Variable
- func (a *Make) GetBlock() *BasicBlock
- func (a *Make) GetFunc() *Function
- func (a *Make) GetId() int
- func (i *Make) GetMask() []Value
- func (a *Make) GetName() string
- func (i *Make) GetOpcode() Opcode
- func (a *Make) GetOperand(i int) Value
- func (a *Make) GetOperandNum() int
- func (a *Make) GetOperands() Values
- func (a *Make) GetProgram() *Program
- func (c *Make) GetRange() *Range
- func (a *Make) GetScope() *Scope
- func (n *Make) GetType() Type
- func (n *Make) GetUsers() Users
- func (i *Make) GetValues() Values
- func (a *Make) GetVariable(name string) *Variable
- func (n *Make) HasUsers() bool
- func (i *Make) HasValues() bool
- func (c *Make) IsExtern() bool
- func (a *Make) LineDisasm() string
- func (i *Make) Masked() bool
- func (c *Make) NewError(kind ErrorKind, tag ErrorTag, msg string)
- func (n *Make) RemoveUser(u User)
- func (i *Make) ReplaceValue(v, to Value)
- func (a *Make) SetBlock(block *BasicBlock)
- func (c *Make) SetExtern(b bool)
- func (a *Make) SetFunc(f *Function)
- func (a *Make) SetId(id int)
- func (a *Make) SetName(v string)
- func (c *Make) SetRange(pos *Range)
- func (a *Make) SetScope(s *Scope)
- func (n *Make) SetType(typ Type)
- func (i *Make) String() string
- type Maskable
- type MethodBuilder
- type Next
- func (i *Next) AddMask(v Value)
- func (n *Next) AddUser(u User)
- func (a *Next) AddVariable(v *Variable)
- func (a *Next) GetAllVariables() map[string]*Variable
- func (a *Next) GetBlock() *BasicBlock
- func (a *Next) GetFunc() *Function
- func (a *Next) GetId() int
- func (i *Next) GetMask() []Value
- func (a *Next) GetName() string
- func (i *Next) GetOpcode() Opcode
- func (a *Next) GetOperand(i int) Value
- func (a *Next) GetOperandNum() int
- func (a *Next) GetOperands() Values
- func (a *Next) GetProgram() *Program
- func (c *Next) GetRange() *Range
- func (a *Next) GetScope() *Scope
- func (n *Next) GetType() Type
- func (n *Next) GetUsers() Users
- func (n *Next) GetValues() Values
- func (a *Next) GetVariable(name string) *Variable
- func (n *Next) HasUsers() bool
- func (n *Next) HasValues() bool
- func (c *Next) IsExtern() bool
- func (a *Next) LineDisasm() string
- func (i *Next) Masked() bool
- func (c *Next) NewError(kind ErrorKind, tag ErrorTag, msg string)
- func (n *Next) RemoveUser(u User)
- func (n *Next) ReplaceValue(v, to Value)
- func (a *Next) SetBlock(block *BasicBlock)
- func (c *Next) SetExtern(b bool)
- func (a *Next) SetFunc(f *Function)
- func (a *Next) SetId(id int)
- func (a *Next) SetName(v string)
- func (c *Next) SetRange(pos *Range)
- func (a *Next) SetScope(s *Scope)
- func (n *Next) SetType(typ Type)
- func (n *Next) String() string
- type Node
- type ObjectType
- func (s *ObjectType) AddField(key Value, field Type)
- func (b *ObjectType) AddMethod(id string, f *FunctionType)
- func (s *ObjectType) Finish()
- func (s *ObjectType) GetField(key Value) Type
- func (i *ObjectType) GetMethod() map[string]*FunctionType
- func (i *ObjectType) GetTypeKind() TypeKind
- func (i ObjectType) PkgPath() string
- 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 Opcode
- type Package
- type Panic
- func (i *Panic) AddMask(v Value)
- func (n *Panic) AddUser(u User)
- func (a *Panic) AddVariable(v *Variable)
- func (a *Panic) GetAllVariables() map[string]*Variable
- func (a *Panic) GetBlock() *BasicBlock
- func (a *Panic) GetFunc() *Function
- func (a *Panic) GetId() int
- func (i *Panic) GetMask() []Value
- func (a *Panic) GetName() string
- func (i *Panic) GetOpcode() Opcode
- func (a *Panic) GetOperand(i int) Value
- func (a *Panic) GetOperandNum() int
- func (a *Panic) GetOperands() Values
- func (a *Panic) GetProgram() *Program
- func (c *Panic) GetRange() *Range
- func (a *Panic) GetScope() *Scope
- func (n *Panic) GetType() Type
- func (n *Panic) GetUsers() Users
- func (p *Panic) GetValues() Values
- func (a *Panic) GetVariable(name string) *Variable
- func (n *Panic) HasUsers() bool
- func (p *Panic) HasValues() bool
- func (c *Panic) IsExtern() bool
- func (a *Panic) LineDisasm() string
- func (i *Panic) Masked() bool
- func (c *Panic) NewError(kind ErrorKind, tag ErrorTag, msg string)
- func (n *Panic) RemoveUser(u User)
- func (p *Panic) ReplaceValue(v, to Value)
- func (a *Panic) SetBlock(block *BasicBlock)
- func (c *Panic) SetExtern(b bool)
- func (a *Panic) SetFunc(f *Function)
- func (a *Panic) SetId(id int)
- func (a *Panic) SetName(v string)
- func (c *Panic) SetRange(pos *Range)
- func (a *Panic) SetScope(s *Scope)
- func (n *Panic) SetType(typ Type)
- func (p *Panic) String() string
- type Parameter
- func (i *Parameter) AddMask(v Value)
- func (n *Parameter) AddUser(u User)
- func (a *Parameter) AddVariable(v *Variable)
- func (a *Parameter) GetAllVariables() map[string]*Variable
- func (a *Parameter) GetBlock() *BasicBlock
- func (a *Parameter) GetFunc() *Function
- func (a *Parameter) GetId() int
- func (i *Parameter) GetMask() []Value
- func (a *Parameter) GetName() string
- func (i *Parameter) GetOpcode() Opcode
- func (a *Parameter) GetOperand(i int) Value
- func (a *Parameter) GetOperandNum() int
- func (a *Parameter) GetOperands() Values
- func (a *Parameter) GetProgram() *Program
- func (c *Parameter) GetRange() *Range
- func (a *Parameter) GetScope() *Scope
- func (n *Parameter) GetType() Type
- func (n *Parameter) GetUsers() Users
- func (p *Parameter) GetValues() Values
- func (a *Parameter) GetVariable(name string) *Variable
- func (n *Parameter) HasUsers() bool
- func (p *Parameter) HasValues() bool
- func (c *Parameter) IsExtern() bool
- func (a *Parameter) LineDisasm() string
- func (i *Parameter) Masked() bool
- func (c *Parameter) NewError(kind ErrorKind, tag ErrorTag, msg string)
- func (n *Parameter) RemoveUser(u User)
- func (a *Parameter) SetBlock(block *BasicBlock)
- func (p *Parameter) SetDefault(v Value)
- func (c *Parameter) SetExtern(b bool)
- func (a *Parameter) SetFunc(f *Function)
- func (a *Parameter) SetId(id int)
- func (a *Parameter) SetName(v string)
- func (c *Parameter) SetRange(pos *Range)
- func (a *Parameter) SetScope(s *Scope)
- func (n *Parameter) SetType(typ Type)
- func (p *Parameter) String() string
- type Phi
- func (p *Phi) AddEdge(v Value)
- func (i *Phi) AddMask(v Value)
- func (n *Phi) AddUser(u User)
- func (a *Phi) AddVariable(v *Variable)
- func (phi *Phi) Build() Value
- func (a *Phi) GetAllVariables() map[string]*Variable
- func (a *Phi) GetBlock() *BasicBlock
- func (a *Phi) GetFunc() *Function
- func (a *Phi) GetId() int
- func (i *Phi) GetMask() []Value
- func (a *Phi) GetName() string
- func (i *Phi) GetOpcode() Opcode
- func (a *Phi) GetOperand(i int) Value
- func (a *Phi) GetOperandNum() int
- func (a *Phi) GetOperands() Values
- func (a *Phi) GetProgram() *Program
- func (c *Phi) GetRange() *Range
- func (a *Phi) GetScope() *Scope
- func (n *Phi) GetType() Type
- func (n *Phi) GetUsers() Users
- func (p *Phi) GetValues() Values
- func (a *Phi) GetVariable(name string) *Variable
- func (n *Phi) HasUsers() bool
- func (p *Phi) HasValues() bool
- func (c *Phi) IsExtern() bool
- func (a *Phi) LineDisasm() string
- func (i *Phi) Masked() bool
- func (phi *Phi) Name() string
- func (c *Phi) NewError(kind ErrorKind, tag ErrorTag, msg string)
- func (n *Phi) RemoveUser(u User)
- func (phi *Phi) Replace(to Value)
- func (p *Phi) ReplaceValue(v Value, to Value)
- func (a *Phi) SetBlock(block *BasicBlock)
- func (c *Phi) SetExtern(b bool)
- func (a *Phi) SetFunc(f *Function)
- func (a *Phi) SetId(id int)
- func (a *Phi) SetName(v string)
- func (c *Phi) SetRange(pos *Range)
- func (a *Phi) SetScope(s *Scope)
- func (n *Phi) SetType(typ Type)
- func (p *Phi) String() string
- type Position
- type Program
- func (prog *Program) AddError(err *SSAError)
- func (prog *Program) AddPackage(pkg *Package)
- func (p *Program) DeleteInstruction(i Instruction)
- func (prog *Program) EachFunction(handler func(*Function))
- func (prog *Program) GetAndCreateMainFunction() *Function
- func (prog *Program) GetAndCreateMainFunctionBuilder() *FunctionBuilder
- func (prog *Program) GetErrors() SSAErrors
- func (p *Program) GetFunctionFast(paths ...string) *Function
- func (p *Program) GetInstructionById(id int) Instruction
- func (p *Program) GetInstructionsByName(name string) []Instruction
- func (prog *Program) GetPackage(name string) *Package
- func (p *Program) RemoveInstructionWithName(name string, i Instruction)
- func (p *Program) SetInstructionWithName(name string, i Instruction)
- func (p *Program) SetVirtualRegister(i Instruction)
- func (p *Program) Show() *Program
- func (p *Program) ShowWithSource()
- type Range
- type Recover
- func (i *Recover) AddMask(v Value)
- func (n *Recover) AddUser(u User)
- func (a *Recover) AddVariable(v *Variable)
- func (a *Recover) GetAllVariables() map[string]*Variable
- func (a *Recover) GetBlock() *BasicBlock
- func (a *Recover) GetFunc() *Function
- func (a *Recover) GetId() int
- func (i *Recover) GetMask() []Value
- func (a *Recover) GetName() string
- func (i *Recover) GetOpcode() Opcode
- func (a *Recover) GetOperand(i int) Value
- func (a *Recover) GetOperandNum() int
- func (a *Recover) GetOperands() Values
- func (a *Recover) GetProgram() *Program
- func (c *Recover) GetRange() *Range
- func (a *Recover) GetScope() *Scope
- func (n *Recover) GetType() Type
- func (n *Recover) GetUsers() Users
- func (r *Recover) GetValues() Values
- func (a *Recover) GetVariable(name string) *Variable
- func (n *Recover) HasUsers() bool
- func (r *Recover) HasValues() bool
- func (c *Recover) IsExtern() bool
- func (a *Recover) LineDisasm() string
- func (i *Recover) Masked() bool
- func (c *Recover) NewError(kind ErrorKind, tag ErrorTag, msg string)
- func (n *Recover) RemoveUser(u User)
- func (a *Recover) SetBlock(block *BasicBlock)
- func (c *Recover) SetExtern(b bool)
- func (a *Recover) SetFunc(f *Function)
- func (a *Recover) SetId(id int)
- func (a *Recover) SetName(v string)
- func (c *Recover) SetRange(pos *Range)
- func (a *Recover) SetScope(s *Scope)
- func (n *Recover) SetType(typ Type)
- func (r *Recover) String() string
- type Return
- func (i *Return) AddMask(v Value)
- func (n *Return) AddUser(u User)
- func (a *Return) AddVariable(v *Variable)
- func (a *Return) GetAllVariables() map[string]*Variable
- func (a *Return) GetBlock() *BasicBlock
- func (a *Return) GetFunc() *Function
- func (a *Return) GetId() int
- func (i *Return) GetMask() []Value
- func (a *Return) GetName() string
- func (i *Return) GetOpcode() Opcode
- func (a *Return) GetOperand(i int) Value
- func (a *Return) GetOperandNum() int
- func (a *Return) GetOperands() Values
- func (a *Return) GetProgram() *Program
- func (c *Return) GetRange() *Range
- func (a *Return) GetScope() *Scope
- func (n *Return) GetType() Type
- func (r *Return) GetUsers() Users
- func (r *Return) GetValues() Values
- func (a *Return) GetVariable(name string) *Variable
- func (r *Return) HasUsers() bool
- func (r *Return) HasValues() bool
- func (c *Return) IsExtern() bool
- func (a *Return) LineDisasm() string
- func (i *Return) Masked() bool
- func (c *Return) NewError(kind ErrorKind, tag ErrorTag, msg string)
- func (n *Return) RemoveUser(u User)
- func (r *Return) ReplaceValue(v Value, to Value)
- func (a *Return) SetBlock(block *BasicBlock)
- func (c *Return) SetExtern(b bool)
- func (a *Return) SetFunc(f *Function)
- func (a *Return) SetId(id int)
- func (a *Return) SetName(v string)
- func (c *Return) SetRange(pos *Range)
- func (a *Return) SetScope(s *Scope)
- func (n *Return) SetType(typ Type)
- func (r *Return) String() string
- type SSAError
- type SSAErrors
- type Scope
- func (s *Scope) AddChild(child *Scope)
- func (s *Scope) AddVariable(v *Variable, R *Range)
- func (s *Scope) GetLocalVariable(text string) string
- func (s *Scope) InsertByRange(v *Variable, R *Range)
- func (s *Scope) PeekLexicalVariableByName(i string) (*Variable, error)
- func (s *Scope) SetLocalVariable(text string) string
- func (s *Scope) String() string
- type SideEffect
- func (i *SideEffect) AddMask(v Value)
- func (n *SideEffect) AddUser(u User)
- func (a *SideEffect) AddVariable(v *Variable)
- func (a *SideEffect) GetAllVariables() map[string]*Variable
- func (a *SideEffect) GetBlock() *BasicBlock
- func (a *SideEffect) GetFunc() *Function
- func (a *SideEffect) GetId() int
- func (i *SideEffect) GetMask() []Value
- func (a *SideEffect) GetName() string
- func (i *SideEffect) GetOpcode() Opcode
- func (a *SideEffect) GetOperand(i int) Value
- func (a *SideEffect) GetOperandNum() int
- func (a *SideEffect) GetOperands() Values
- func (a *SideEffect) GetProgram() *Program
- func (c *SideEffect) GetRange() *Range
- func (a *SideEffect) GetScope() *Scope
- func (n *SideEffect) GetType() Type
- func (n *SideEffect) GetUsers() Users
- func (s *SideEffect) GetValues() Values
- func (a *SideEffect) GetVariable(name string) *Variable
- func (n *SideEffect) HasUsers() bool
- func (s *SideEffect) HasValues() bool
- func (c *SideEffect) IsExtern() bool
- func (a *SideEffect) LineDisasm() string
- func (i *SideEffect) Masked() bool
- func (c *SideEffect) NewError(kind ErrorKind, tag ErrorTag, msg string)
- func (n *SideEffect) RemoveUser(u User)
- func (s *SideEffect) ReplaceValue(v Value, to Value)
- func (a *SideEffect) SetBlock(block *BasicBlock)
- func (c *SideEffect) SetExtern(b bool)
- func (a *SideEffect) SetFunc(f *Function)
- func (a *SideEffect) SetId(id int)
- func (a *SideEffect) SetName(v string)
- func (c *SideEffect) SetRange(pos *Range)
- func (a *SideEffect) SetScope(s *Scope)
- func (n *SideEffect) SetType(typ Type)
- func (s *SideEffect) String() string
- type Switch
- func (i *Switch) AddMask(v Value)
- func (a *Switch) AddVariable(v *Variable)
- func (a *Switch) GetAllVariables() map[string]*Variable
- func (a *Switch) GetBlock() *BasicBlock
- func (a *Switch) GetFunc() *Function
- func (a *Switch) GetId() int
- func (i *Switch) GetMask() []Value
- func (a *Switch) GetName() string
- func (i *Switch) GetOpcode() Opcode
- func (a *Switch) GetOperand(i int) Value
- func (a *Switch) GetOperandNum() int
- func (a *Switch) GetOperands() Values
- func (a *Switch) GetProgram() *Program
- func (c *Switch) GetRange() *Range
- func (a *Switch) GetScope() *Scope
- func (r *Switch) GetUsers() Users
- func (sw *Switch) GetValues() Values
- func (a *Switch) GetVariable(name string) *Variable
- func (r *Switch) HasUsers() bool
- func (sw *Switch) HasValues() bool
- func (c *Switch) IsExtern() bool
- func (a *Switch) LineDisasm() string
- func (i *Switch) Masked() bool
- func (c *Switch) NewError(kind ErrorKind, tag ErrorTag, msg string)
- func (sw *Switch) ReplaceValue(v Value, to Value)
- func (a *Switch) SetBlock(block *BasicBlock)
- func (c *Switch) SetExtern(b bool)
- func (a *Switch) SetFunc(f *Function)
- func (a *Switch) SetId(id int)
- func (a *Switch) SetName(v string)
- func (c *Switch) SetRange(pos *Range)
- func (a *Switch) SetScope(s *Scope)
- func (sw *Switch) String() string
- type SwitchBuilder
- type SwitchLabel
- type TryBuilder
- type Type
- type TypeCast
- func (i *TypeCast) AddMask(v Value)
- func (n *TypeCast) AddUser(u User)
- func (a *TypeCast) AddVariable(v *Variable)
- func (a *TypeCast) GetAllVariables() map[string]*Variable
- func (a *TypeCast) GetBlock() *BasicBlock
- func (a *TypeCast) GetFunc() *Function
- func (a *TypeCast) GetId() int
- func (i *TypeCast) GetMask() []Value
- func (a *TypeCast) GetName() string
- func (i *TypeCast) GetOpcode() Opcode
- func (a *TypeCast) GetOperand(i int) Value
- func (a *TypeCast) GetOperandNum() int
- func (a *TypeCast) GetOperands() Values
- func (a *TypeCast) GetProgram() *Program
- func (c *TypeCast) GetRange() *Range
- func (a *TypeCast) GetScope() *Scope
- func (n *TypeCast) GetType() Type
- func (n *TypeCast) GetUsers() Users
- func (t *TypeCast) GetValues() Values
- func (a *TypeCast) GetVariable(name string) *Variable
- func (n *TypeCast) HasUsers() bool
- func (t *TypeCast) HasValues() bool
- func (c *TypeCast) IsExtern() bool
- func (a *TypeCast) LineDisasm() string
- func (i *TypeCast) Masked() bool
- func (c *TypeCast) NewError(kind ErrorKind, tag ErrorTag, msg string)
- func (n *TypeCast) RemoveUser(u User)
- func (t *TypeCast) ReplaceValue(v, to Value)
- func (a *TypeCast) SetBlock(block *BasicBlock)
- func (c *TypeCast) SetExtern(b bool)
- func (a *TypeCast) SetFunc(f *Function)
- func (a *TypeCast) SetId(id int)
- func (a *TypeCast) SetName(v string)
- func (c *TypeCast) SetRange(pos *Range)
- func (a *TypeCast) SetScope(s *Scope)
- func (n *TypeCast) SetType(typ Type)
- func (t *TypeCast) String() string
- type TypeKind
- type TypeValue
- func (i *TypeValue) AddMask(v Value)
- func (n *TypeValue) AddUser(u User)
- func (a *TypeValue) AddVariable(v *Variable)
- func (a *TypeValue) GetAllVariables() map[string]*Variable
- func (a *TypeValue) GetBlock() *BasicBlock
- func (a *TypeValue) GetFunc() *Function
- func (a *TypeValue) GetId() int
- func (i *TypeValue) GetMask() []Value
- func (a *TypeValue) GetName() string
- func (i *TypeValue) GetOpcode() Opcode
- func (a *TypeValue) GetOperand(i int) Value
- func (a *TypeValue) GetOperandNum() int
- func (a *TypeValue) GetOperands() Values
- func (a *TypeValue) GetProgram() *Program
- func (c *TypeValue) GetRange() *Range
- func (a *TypeValue) GetScope() *Scope
- func (n *TypeValue) GetType() Type
- func (n *TypeValue) GetUsers() Users
- func (t *TypeValue) GetValues() Values
- func (a *TypeValue) GetVariable(name string) *Variable
- func (n *TypeValue) HasUsers() bool
- func (t *TypeValue) HasValues() bool
- func (c *TypeValue) IsExtern() bool
- func (a *TypeValue) LineDisasm() string
- func (i *TypeValue) Masked() bool
- func (c *TypeValue) NewError(kind ErrorKind, tag ErrorTag, msg string)
- func (n *TypeValue) RemoveUser(u User)
- func (a *TypeValue) SetBlock(block *BasicBlock)
- func (c *TypeValue) SetExtern(b bool)
- func (a *TypeValue) SetFunc(f *Function)
- func (a *TypeValue) SetId(id int)
- func (a *TypeValue) SetName(v string)
- func (c *TypeValue) SetRange(pos *Range)
- func (a *TypeValue) SetScope(s *Scope)
- func (n *TypeValue) SetType(typ Type)
- func (t *TypeValue) String() string
- type TypedNode
- type Types
- type UnOp
- func (i *UnOp) AddMask(v Value)
- func (n *UnOp) AddUser(u User)
- func (a *UnOp) AddVariable(v *Variable)
- func (a *UnOp) GetAllVariables() map[string]*Variable
- func (a *UnOp) GetBlock() *BasicBlock
- func (a *UnOp) GetFunc() *Function
- func (a *UnOp) GetId() int
- func (i *UnOp) GetMask() []Value
- func (a *UnOp) GetName() string
- func (i *UnOp) GetOpcode() Opcode
- func (a *UnOp) GetOperand(i int) Value
- func (a *UnOp) GetOperandNum() int
- func (a *UnOp) GetOperands() Values
- func (a *UnOp) GetProgram() *Program
- func (c *UnOp) GetRange() *Range
- func (a *UnOp) GetScope() *Scope
- func (n *UnOp) GetType() Type
- func (n *UnOp) GetUsers() Users
- func (n *UnOp) GetValues() Values
- func (a *UnOp) GetVariable(name string) *Variable
- func (n *UnOp) HasUsers() bool
- func (n *UnOp) HasValues() bool
- func (c *UnOp) IsExtern() bool
- func (a *UnOp) LineDisasm() string
- func (i *UnOp) Masked() bool
- func (c *UnOp) NewError(kind ErrorKind, tag ErrorTag, msg string)
- func (n *UnOp) RemoveUser(u User)
- func (u *UnOp) ReplaceValue(v Value, to Value)
- func (a *UnOp) SetBlock(block *BasicBlock)
- func (c *UnOp) SetExtern(b bool)
- func (a *UnOp) SetFunc(f *Function)
- func (a *UnOp) SetId(id int)
- func (a *UnOp) SetName(v string)
- func (c *UnOp) SetRange(pos *Range)
- func (a *UnOp) SetScope(s *Scope)
- func (n *UnOp) SetType(typ Type)
- func (u *UnOp) String() string
- type UnaryOpcode
- type Undefined
- func (i *Undefined) AddMask(v Value)
- func (n *Undefined) AddUser(u User)
- func (a *Undefined) AddVariable(v *Variable)
- func (a *Undefined) GetAllVariables() map[string]*Variable
- func (a *Undefined) GetBlock() *BasicBlock
- func (a *Undefined) GetFunc() *Function
- func (a *Undefined) GetId() int
- func (i *Undefined) GetMask() []Value
- func (a *Undefined) GetName() string
- func (i *Undefined) GetOpcode() Opcode
- func (a *Undefined) GetOperand(i int) Value
- func (a *Undefined) GetOperandNum() int
- func (a *Undefined) GetOperands() Values
- func (a *Undefined) GetProgram() *Program
- func (c *Undefined) GetRange() *Range
- func (a *Undefined) GetScope() *Scope
- func (n *Undefined) GetType() Type
- func (n *Undefined) GetUsers() Users
- func (u *Undefined) GetValues() Values
- func (a *Undefined) GetVariable(name string) *Variable
- func (n *Undefined) HasUsers() bool
- func (u *Undefined) HasValues() bool
- func (c *Undefined) IsExtern() bool
- func (a *Undefined) LineDisasm() string
- func (i *Undefined) Masked() bool
- func (c *Undefined) NewError(kind ErrorKind, tag ErrorTag, msg string)
- func (n *Undefined) RemoveUser(u User)
- func (a *Undefined) SetBlock(block *BasicBlock)
- func (c *Undefined) SetExtern(b bool)
- func (a *Undefined) SetFunc(f *Function)
- func (a *Undefined) SetId(id int)
- func (a *Undefined) SetName(v string)
- func (c *Undefined) SetRange(pos *Range)
- func (a *Undefined) SetScope(s *Scope)
- func (n *Undefined) SetType(typ Type)
- func (u *Undefined) String() string
- type Update
- func (i *Update) AddMask(v Value)
- func (a *Update) AddVariable(v *Variable)
- func (a *Update) GetAllVariables() map[string]*Variable
- func (a *Update) GetBlock() *BasicBlock
- func (a *Update) GetFunc() *Function
- func (a *Update) GetId() int
- func (i *Update) GetMask() []Value
- func (a *Update) GetName() string
- func (i *Update) GetOpcode() Opcode
- func (a *Update) GetOperand(i int) Value
- func (a *Update) GetOperandNum() int
- func (a *Update) GetOperands() Values
- func (a *Update) GetProgram() *Program
- func (c *Update) GetRange() *Range
- func (a *Update) GetScope() *Scope
- func (r *Update) GetUsers() Users
- func (s *Update) GetValues() Values
- func (a *Update) GetVariable(name string) *Variable
- func (r *Update) HasUsers() bool
- func (s *Update) HasValues() bool
- func (c *Update) IsExtern() bool
- func (a *Update) LineDisasm() string
- func (i *Update) Masked() bool
- func (c *Update) NewError(kind ErrorKind, tag ErrorTag, msg string)
- func (s *Update) ReplaceValue(v, to Value)
- func (a *Update) SetBlock(block *BasicBlock)
- func (c *Update) SetExtern(b bool)
- func (a *Update) SetFunc(f *Function)
- func (a *Update) SetId(id int)
- func (a *Update) SetName(v string)
- func (c *Update) SetRange(pos *Range)
- func (a *Update) SetScope(s *Scope)
- func (s *Update) String() string
- type User
- type Users
- func (u Users) RunOnCall(f func(*Call))
- func (u Users) RunOnCallOr(f func(*Call), or func(User))
- func (u Users) RunOnField(f func(*Field))
- func (u Users) RunOnFieldOr(f func(*Field), or func(User))
- func (u Users) RunOnUpdate(f func(*Update))
- func (u Users) RunOnUpdateOr(f func(*Update), or func(User))
- type Value
- func CalcBinary(b *BinOp) Value
- func CalcConstBinarySide(c *ConstInst, v Value, op BinaryOpcode) Value
- func HandlerBinOp(b *BinOp) (ret Value)
- func HandlerUnOp(u *UnOp) (ret Value)
- func NewBinOp(op BinaryOpcode, x, y Value) Value
- func NewUnOp(op UnaryOpcode, x Value) Value
- func ToValue(n any) (Value, bool)
- type Values
- type Variable
Constants ¶
const ( OpUnknown Opcode = "unknown" OpFunction = "Function" OpBasicBlock = "BasicBlock" OpParameter = "Parameter" OpExternLib = "ExternLib" OpPhi = "Phi" OpConstInst = "ConstInst" OpUndefined = "Undefined" OpBinOp = "BinOp" OpUnOp = "UnOp" OpCall = "Call" OpSideEffect = "SideEffect" OpReturn = "Return" OpMake = "Make" OpField = "Field" OpUpdate = "Update" OpNext = "Next" OpAssert = "Assert" OpTypeCast = "TypeCast" OpTypeValue = "TypeValue" OpErrorHandler = "ErrorHandler" OpPanic = "Panic" OpRecover = "Recover" OpJump = "Jump" OpIf = "If" OpLoop = "Loop" OpSwitch = "Switch" )
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" // try-catch TryStart = "error.try" TryCatch = "error.catch" TryFinally = "error.final" TryDone = "" // switch SwitchDone = "switch.done" SwitchDefault = "switch.default" SwitchHandler = "switch.handler" )
const (
MAXTYPELEVEL = 15
)
const MAXTypeCompareDepth = 10
Variables ¶
var BasicTypes = []*BasicType{ Number: NewBasicType(Number, "number"), String: NewBasicType(String, "string"), Bytes: NewBasicType(Bytes, "bytes"), Boolean: NewBasicType(Boolean, "boolean"), UndefinedType: NewBasicType(UndefinedType, "undefined"), Null: NewBasicType(Null, "null"), Any: NewBasicType(Any, "any"), ErrorType: NewBasicType(ErrorType, "error"), }
var BinaryOpcodeName = map[BinaryOpcode]string{ OpLogicAnd: `LogicAnd`, OpLogicOr: `LogicOr`, 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: `ltEq`, OpGtEq: `gtEq`, OpNotEq: `neq`, OpEq: `eq`, OpIn: `in`, OpSend: `send`, }
var UnaryOpcodeName = map[UnaryOpcode]string{ OpNone: ``, OpNot: `not`, OpPlus: `plus`, OpNeg: `neg`, OpChan: `chan`, OpBitwiseNot: `bitwise-not`, }
Functions ¶
func BindingNotFound ¶ added in v1.2.8
func BindingNotFoundInCall ¶ added in v1.3.1
func ContAssignExtern ¶ added in v1.2.8
func DeleteInst ¶ added in v1.2.8
func DeleteInst(i Instruction)
func ExternFieldError ¶ added in v1.2.8
func GetMethodsName ¶ added in v1.2.9
func GetTypeStr ¶
func InsertValueReplaceOriginal ¶ added in v1.2.9
func IsControlInstruction ¶ added in v1.2.9
func IsControlInstruction(i Instruction) bool
func IsObjectType ¶ added in v1.2.9
func LineDisasm ¶ added in v1.3.0
func LineDisasm(v Instruction) string
func NewInstruction ¶ added in v1.2.8
func NewInstruction() anInstruction
func NoCheckMustInFirst ¶ added in v1.2.8
func NoCheckMustInFirst() string
func ReplaceAllValue ¶ added in v1.2.9
func ReplaceValue ¶
func ReplaceValue(v Value, to Value, skip func(Instruction) bool)
func ReplaceValueInSymbolTable ¶ added in v1.2.9
func ReplaceValueInSymbolTable(v, to Value)
func RunOnCoverOr ¶ added in v1.2.8
func RunOnCoverOr[T, U Instruction](insts []U, cover func(Instruction) (T, bool), f func(T), or func(U))
func TryGetSimilarityKey ¶ added in v1.2.8
func TypeCompare ¶ added in v1.2.9
func TypeCompareEx ¶ added in v1.2.9
func ValueUndefined ¶ added in v1.3.1
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) AddMethod ¶ added in v1.2.9
func (b *AliasType) AddMethod(id string, f *FunctionType)
func (*AliasType) GetMethod ¶ added in v1.2.8
func (a *AliasType) GetMethod() map[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 (*Assert) AddVariable ¶ added in v1.3.0
func (a *Assert) AddVariable(v *Variable)
func (*Assert) GetAllVariables ¶ added in v1.3.0
func (*Assert) GetBlock ¶ added in v1.2.8
func (a *Assert) GetBlock() *BasicBlock
func (*Assert) GetOperand ¶ added in v1.2.8
func (*Assert) GetOperandNum ¶ added in v1.2.8
func (a *Assert) GetOperandNum() int
func (*Assert) GetOperands ¶ added in v1.2.8
func (a *Assert) GetOperands() Values
func (*Assert) GetProgram ¶ added in v1.3.0
func (a *Assert) GetProgram() *Program
func (*Assert) GetVariable ¶ added in v1.2.8
func (*Assert) LineDisasm ¶ added in v1.2.8
func (a *Assert) LineDisasm() string
func (*Assert) ReplaceValue ¶ added in v1.2.8
func (*Assert) SetBlock ¶ added in v1.2.8
func (a *Assert) SetBlock(block *BasicBlock)
type BasicBlock ¶
type BasicBlock struct { Index int // BasicBlock graph Preds, Succs []*BasicBlock /* if Condition == true: this block reach */ Condition Value // instruction list Insts []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) AddVariable ¶ added in v1.3.0
func (a *BasicBlock) AddVariable(v *Variable)
func (*BasicBlock) EmitInst ¶ added in v1.2.8
func (b *BasicBlock) EmitInst(i Instruction)
func (*BasicBlock) GetAllVariables ¶ added in v1.3.0
func (*BasicBlock) GetBlock ¶ added in v1.2.8
func (a *BasicBlock) GetBlock() *BasicBlock
func (*BasicBlock) GetBlockById ¶ added in v1.2.8
func (b *BasicBlock) GetBlockById(name string) *BasicBlock
func (*BasicBlock) GetOpcode ¶ added in v1.2.8
func (i *BasicBlock) GetOpcode() Opcode
func (*BasicBlock) GetOperand ¶ added in v1.2.8
func (*BasicBlock) GetOperandNum ¶ added in v1.2.8
func (a *BasicBlock) GetOperandNum() int
func (*BasicBlock) GetOperands ¶ added in v1.2.8
func (a *BasicBlock) GetOperands() Values
func (*BasicBlock) GetProgram ¶ added in v1.3.0
func (a *BasicBlock) GetProgram() *Program
func (*BasicBlock) GetRange ¶ added in v1.3.0
func (c *BasicBlock) GetRange() *Range
source code position
func (*BasicBlock) GetType ¶
func (b *BasicBlock) GetType() Type
func (*BasicBlock) GetValues ¶
func (b *BasicBlock) GetValues() Values
func (*BasicBlock) GetValuesByVariable ¶ added in v1.3.0
func (block *BasicBlock) GetValuesByVariable(name string) []Value
func (*BasicBlock) GetVariable ¶ added in v1.2.8
func (*BasicBlock) HasUsers ¶ added in v1.2.8
func (n *BasicBlock) HasUsers() bool
has/get user and value
func (*BasicBlock) HasValues ¶ added in v1.2.8
func (b *BasicBlock) HasValues() bool
----------- BasicBlock
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) LineDisasm ¶ added in v1.2.8
func (a *BasicBlock) LineDisasm() string
func (*BasicBlock) Reachable ¶ added in v1.2.8
func (b *BasicBlock) Reachable() int
func (*BasicBlock) RemoveUser ¶
func (n *BasicBlock) RemoveUser(u User)
func (*BasicBlock) Sealed ¶
func (b *BasicBlock) Sealed()
func (*BasicBlock) SetBlock ¶ added in v1.2.8
func (a *BasicBlock) SetBlock(block *BasicBlock)
func (*BasicBlock) SetFunc ¶ added in v1.2.8
func (a *BasicBlock) SetFunc(f *Function)
ssa function and block
func (*BasicBlock) SetType ¶
func (b *BasicBlock) SetType(ts Type)
type BasicType ¶
type BasicType struct { Kind TypeKind // contains filtered or unexported fields }
func NewBasicType ¶ added in v1.3.1
func (*BasicType) AddMethod ¶ added in v1.2.9
func (b *BasicType) AddMethod(id string, f *FunctionType)
func (*BasicType) GetMethod ¶ added in v1.2.8
func (b *BasicType) GetMethod() map[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) *BinOp
func ToBinOp ¶ added in v1.2.8
func ToBinOp(v Instruction) (*BinOp, bool)
func (*BinOp) AddVariable ¶ added in v1.3.0
func (a *BinOp) AddVariable(v *Variable)
func (*BinOp) GetAllVariables ¶ added in v1.3.0
func (*BinOp) GetBlock ¶
func (a *BinOp) GetBlock() *BasicBlock
func (*BinOp) GetOperand ¶ added in v1.2.8
func (*BinOp) GetOperandNum ¶ added in v1.2.8
func (a *BinOp) GetOperandNum() int
func (*BinOp) GetOperands ¶ added in v1.2.8
func (a *BinOp) GetOperands() Values
func (*BinOp) GetProgram ¶ added in v1.3.0
func (a *BinOp) GetProgram() *Program
func (*BinOp) GetVariable ¶ added in v1.2.8
func (*BinOp) LineDisasm ¶ added in v1.2.8
func (a *BinOp) LineDisasm() string
func (*BinOp) RemoveUser ¶
func (n *BinOp) RemoveUser(u User)
func (*BinOp) ReplaceValue ¶
func (*BinOp) SetBlock ¶ added in v1.2.8
func (a *BinOp) SetBlock(block *BasicBlock)
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 // <- OpPow // ** )
type Call ¶
type Call struct { // for call function Method Value Args []Value // go function Async bool Unpack bool // caller // caller Value // ~ drop error IsDropError bool IsEllipsis 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, block *BasicBlock) *Call
func ToCall ¶ added in v1.2.8
func ToCall(v Instruction) (*Call, bool)
func (*Call) AddVariable ¶ added in v1.3.0
func (a *Call) AddVariable(v *Variable)
func (*Call) GetAllVariables ¶ added in v1.3.0
func (*Call) GetBlock ¶
func (a *Call) GetBlock() *BasicBlock
func (*Call) GetOperand ¶ added in v1.2.8
func (*Call) GetOperandNum ¶ added in v1.2.8
func (a *Call) GetOperandNum() int
func (*Call) GetOperands ¶ added in v1.2.8
func (a *Call) GetOperands() Values
func (*Call) GetProgram ¶ added in v1.3.0
func (a *Call) GetProgram() *Program
func (*Call) GetVariable ¶ added in v1.2.8
func (*Call) HandleFreeValue ¶ added in v1.2.8
func (*Call) LineDisasm ¶ added in v1.2.8
func (a *Call) LineDisasm() string
func (*Call) RemoveUser ¶
func (n *Call) RemoveUser(u User)
func (*Call) ReplaceValue ¶
func (*Call) SetBlock ¶ added in v1.2.8
func (a *Call) SetBlock(block *BasicBlock)
type ChanType ¶
type ChanType struct { Elem Type // contains filtered or unexported fields }
====================== chan type
func NewChanType ¶
func (*ChanType) AddMethod ¶ added in v1.2.9
func (b *ChanType) AddMethod(id string, f *FunctionType)
func (*ChanType) GetMethod ¶ added in v1.2.8
func (c *ChanType) GetMethod() map[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 {
// contains filtered or unexported fields
}
func (*Const) GetRawValue ¶ added in v1.2.9
func (*Const) GetTypeKind ¶ added in v1.2.8
type ConstInst ¶ added in v1.2.8
----------- Const ConstInst also have block pointer, which block set this const to variable
func CalcConstBinary ¶ added in v1.2.8
func CalcConstBinary(x, y *ConstInst, op BinaryOpcode) *ConstInst
func CalcConstUnary ¶ added in v1.2.8
func CalcConstUnary(x *ConstInst, op UnaryOpcode) *ConstInst
OpNone UnaryOpcode = iota OpNot // ! OpPlus // + OpNeg // - OpChan // ->
func NewConstInst ¶ added in v1.2.8
func (*ConstInst) AddVariable ¶ added in v1.3.0
func (a *ConstInst) AddVariable(v *Variable)
func (*ConstInst) GetAllVariables ¶ added in v1.3.0
func (*ConstInst) GetBlock ¶ added in v1.2.8
func (a *ConstInst) GetBlock() *BasicBlock
func (*ConstInst) GetOperand ¶ added in v1.2.8
func (*ConstInst) GetOperandNum ¶ added in v1.2.8
func (a *ConstInst) GetOperandNum() int
func (*ConstInst) GetOperands ¶ added in v1.2.8
func (a *ConstInst) GetOperands() Values
func (*ConstInst) GetProgram ¶ added in v1.3.0
func (a *ConstInst) GetProgram() *Program
func (*ConstInst) GetRange ¶ added in v1.3.0
func (c *ConstInst) GetRange() *Range
source code position
func (*ConstInst) GetVariable ¶ added in v1.2.8
func (*ConstInst) HasUsers ¶ added in v1.2.8
func (n *ConstInst) HasUsers() bool
has/get user and value
func (*ConstInst) LineDisasm ¶ added in v1.2.8
func (a *ConstInst) LineDisasm() string
func (*ConstInst) RemoveUser ¶ added in v1.2.8
func (n *ConstInst) RemoveUser(u User)
func (*ConstInst) ReplaceValue ¶ added in v1.3.0
func (*ConstInst) SetBlock ¶ added in v1.2.8
func (a *ConstInst) SetBlock(block *BasicBlock)
type DisasmLiner ¶ added in v1.3.0
type DisasmLiner struct {
// contains filtered or unexported fields
}
func readSymbolVariable(v Value) string { symbolLock.RLock() defer symbolLock.RUnlock() if name, ok := symbol[v]; ok { return name } else { return "" } }
func NewDisasmLiner ¶ added in v1.3.0
func NewDisasmLiner() *DisasmLiner
type ErrorComment ¶ added in v1.2.8
type ErrorComment struct {
// contains filtered or unexported fields
}
func (ErrorComment) Skip ¶ added in v1.2.8
func (ec ErrorComment) Skip(pos *Range) bool
type ErrorCommentId ¶ added in v1.2.8
type ErrorCommentId string
const ( SSAIgnore ErrorCommentId = "// @ssa-ignore" SSANoCheck ErrorCommentId = "// @ssa-nocheck" )
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 *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) AddVariable ¶ added in v1.3.0
func (a *ErrorHandler) AddVariable(v *Variable)
func (*ErrorHandler) GetAllVariables ¶ added in v1.3.0
func (*ErrorHandler) GetBlock ¶ added in v1.2.8
func (a *ErrorHandler) GetBlock() *BasicBlock
func (*ErrorHandler) GetOpcode ¶ added in v1.2.8
func (i *ErrorHandler) GetOpcode() Opcode
func (*ErrorHandler) GetOperand ¶ added in v1.2.8
func (*ErrorHandler) GetOperandNum ¶ added in v1.2.8
func (a *ErrorHandler) GetOperandNum() int
func (*ErrorHandler) GetOperands ¶ added in v1.2.8
func (a *ErrorHandler) GetOperands() Values
func (*ErrorHandler) GetProgram ¶ added in v1.3.0
func (a *ErrorHandler) GetProgram() *Program
func (*ErrorHandler) GetRange ¶ added in v1.3.0
func (c *ErrorHandler) GetRange() *Range
source code position
func (*ErrorHandler) GetScope ¶ added in v1.3.0
func (a *ErrorHandler) GetScope() *Scope
symbol-table
func (*ErrorHandler) GetVariable ¶ added in v1.2.8
func (*ErrorHandler) LineDisasm ¶ added in v1.2.8
func (a *ErrorHandler) LineDisasm() string
func (*ErrorHandler) SetBlock ¶ added in v1.2.8
func (a *ErrorHandler) SetBlock(block *BasicBlock)
func (*ErrorHandler) SetFunc ¶ added in v1.2.8
func (a *ErrorHandler) SetFunc(f *Function)
ssa function and block
func (*ErrorHandler) String ¶ added in v1.2.8
func (e *ErrorHandler) String() string
type ErrorLogger ¶ added in v1.2.8
type ExternLib ¶ added in v1.3.0
type ExternLib struct { BuildField func(string) Value MemberMap map[string]Value Member []Value // contains filtered or unexported fields }
----------- externLib
func NewExternLib ¶ added in v1.3.0
func NewExternLib(variable string, builder *FunctionBuilder) *ExternLib
func ToExternLib ¶ added in v1.3.0
func ToExternLib(v Instruction) (*ExternLib, bool)
func (*ExternLib) AddVariable ¶ added in v1.3.0
func (a *ExternLib) AddVariable(v *Variable)
func (*ExternLib) GetAllVariables ¶ added in v1.3.0
func (*ExternLib) GetBlock ¶ added in v1.3.0
func (a *ExternLib) GetBlock() *BasicBlock
func (*ExternLib) GetOperand ¶ added in v1.3.0
func (*ExternLib) GetOperandNum ¶ added in v1.3.0
func (a *ExternLib) GetOperandNum() int
func (*ExternLib) GetOperands ¶ added in v1.3.0
func (a *ExternLib) GetOperands() Values
func (*ExternLib) GetProgram ¶ added in v1.3.0
func (a *ExternLib) GetProgram() *Program
func (*ExternLib) GetRange ¶ added in v1.3.0
func (c *ExternLib) GetRange() *Range
source code position
func (*ExternLib) GetVariable ¶ added in v1.3.0
func (*ExternLib) HasUsers ¶ added in v1.3.0
func (n *ExternLib) HasUsers() bool
has/get user and value
func (*ExternLib) LineDisasm ¶ added in v1.3.0
func (a *ExternLib) LineDisasm() string
func (*ExternLib) RemoveUser ¶ added in v1.3.0
func (n *ExternLib) RemoveUser(u User)
func (*ExternLib) ReplaceValue ¶ added in v1.3.0
func (*ExternLib) SetBlock ¶ added in v1.3.0
func (a *ExternLib) SetBlock(block *BasicBlock)
type Field ¶
type Field struct { // field Key Value Obj Value // Method or Field IsMethod bool // contains filtered or unexported fields }
instruction ----------- Field
func NewFieldOnly ¶ added in v1.2.8
func NewFieldOnly(key, obj Value, block *BasicBlock) *Field
func ToField ¶ added in v1.2.8
func ToField(v Instruction) (*Field, bool)
func (*Field) AddVariable ¶ added in v1.3.0
func (a *Field) AddVariable(v *Variable)
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) GetAllVariables ¶ added in v1.3.0
func (*Field) GetBlock ¶
func (a *Field) GetBlock() *BasicBlock
func (*Field) GetOperand ¶ added in v1.2.8
func (*Field) GetOperandNum ¶ added in v1.2.8
func (a *Field) GetOperandNum() int
func (*Field) GetOperands ¶ added in v1.2.8
func (a *Field) GetOperands() Values
func (*Field) GetProgram ¶ added in v1.3.0
func (a *Field) GetProgram() *Program
func (*Field) GetValue ¶
func (f *Field) GetValue(_ *FunctionBuilder) Value
func (*Field) GetVariable ¶ added in v1.2.8
func (*Field) LineDisasm ¶ added in v1.2.8
func (a *Field) LineDisasm() string
func (*Field) RemoveUser ¶
func (n *Field) RemoveUser(u User)
func (*Field) ReplaceValue ¶
func (*Field) SetBlock ¶ added in v1.2.8
func (a *Field) SetBlock(block *BasicBlock)
type Function ¶
type Function struct { // package, double link Package *Package // just function parameter and all return instruction Param []*Parameter Return []*Return // BasicBlock list Blocks []*BasicBlock // First and End block EnterBlock *BasicBlock ExitBlock *BasicBlock // For Defer semantic // this block will always execute when the function exits, // regardless of whether the function returns normally or exits due to a panic. DeferBlock *BasicBlock // for closure function FreeValues map[string]*Parameter // store the captured variable form parent-function, just contain name, and type is Parameter // closure function side effects // TODO: currently, this value is not being used, but it should be utilized in the future. SideEffects map[string]Value ChildFuncs []*Function // child function within this function // 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 ToFunction ¶ added in v1.2.8
func (*Function) AddErrorComment ¶ added in v1.2.8
func (*Function) AddSideEffect ¶ added in v1.2.9
func (*Function) AddVariable ¶ added in v1.3.0
func (a *Function) AddVariable(v *Variable)
func (*Function) DisAsm ¶
func (f *Function) DisAsm(flag FunctionAsmFlag) string
func (*Function) FirstBlockInstruction ¶ added in v1.3.0
func (f *Function) FirstBlockInstruction() []Instruction
func (*Function) GetAllSymbols ¶ added in v1.2.9
func (*Function) GetAllVariables ¶ added in v1.3.0
func (*Function) GetBlock ¶ added in v1.2.8
func (a *Function) GetBlock() *BasicBlock
func (*Function) GetDeferBlock ¶ added in v1.2.9
func (f *Function) GetDeferBlock() *BasicBlock
func (*Function) GetOperand ¶ added in v1.2.8
func (*Function) GetOperandNum ¶ added in v1.2.8
func (a *Function) GetOperandNum() int
func (*Function) GetOperands ¶ added in v1.2.8
func (a *Function) GetOperands() Values
func (*Function) GetProgram ¶ added in v1.3.0
func (*Function) GetRange ¶ added in v1.3.0
func (c *Function) GetRange() *Range
source code position
func (*Function) GetValuesByName ¶ added in v1.2.8
func (f *Function) GetValuesByName(name string) InstructionNodes
func (*Function) GetVariable ¶ added in v1.2.8
func (*Function) HasUsers ¶ added in v1.2.8
func (n *Function) HasUsers() bool
has/get user and value
func (*Function) LineDisasm ¶ added in v1.2.8
func (a *Function) LineDisasm() string
func (*Function) NewBasicBlock ¶
func (f *Function) NewBasicBlock(name string) *BasicBlock
func (*Function) NewBasicBlockNotAddBlocks ¶ added in v1.2.9
func (f *Function) NewBasicBlockNotAddBlocks(name string) *BasicBlock
func (*Function) NewBasicBlockNotAddUnSealed ¶ added in v1.2.9
func (f *Function) NewBasicBlockNotAddUnSealed(name string) *BasicBlock
func (*Function) NewBasicBlockUnSealed ¶
func (f *Function) NewBasicBlockUnSealed(name string) *BasicBlock
func (*Function) NewErrorWithPos ¶
func (*Function) RemoveUser ¶
func (n *Function) RemoveUser(u User)
func (*Function) ReplaceVariable ¶ added in v1.2.8
func (*Function) ReturnValue ¶
func (*Function) SetBlock ¶ added in v1.2.8
func (a *Function) SetBlock(block *BasicBlock)
type FunctionAsmFlag ¶
type FunctionAsmFlag int
const ( DisAsmDefault FunctionAsmFlag = 1 << iota DisAsmWithSource )
type FunctionBuilder ¶
type FunctionBuilder struct { *Function // for build CurrentBlock *BasicBlock // current block to build CurrentRange *Range // current position in source code CurrentScope *Scope ExternInstance map[string]any ExternLib map[string]map[string]any DefineFunc map[string]any // contains filtered or unexported fields }
Function builder API
func NewBuilder ¶
func NewBuilder(f *Function, parent *FunctionBuilder) *FunctionBuilder
func (*FunctionBuilder) AddDefer ¶
func (b *FunctionBuilder) AddDefer(call *Call)
add current function defer function
func (*FunctionBuilder) AddLabel ¶ added in v1.2.8
func (b *FunctionBuilder) AddLabel(name string, block *BasicBlock)
for goto and label
func (*FunctionBuilder) AddToCmap ¶ added in v1.2.8
func (b *FunctionBuilder) AddToCmap(key string)
func (*FunctionBuilder) AddToLmap ¶ added in v1.2.8
func (b *FunctionBuilder) AddToLmap(key string)
func (*FunctionBuilder) AddUnsealedBlock ¶ added in v1.2.8
func (b *FunctionBuilder) AddUnsealedBlock(block *BasicBlock)
func (FunctionBuilder) AddVariable ¶ added in v1.3.0
func (a FunctionBuilder) AddVariable(v *Variable)
func (*FunctionBuilder) BuildFreeValue ¶
func (b *FunctionBuilder) BuildFreeValue(variable string) Value
func (*FunctionBuilder) BuildIf ¶ added in v1.2.8
func (b *FunctionBuilder) BuildIf() *IfBuilder
func (*FunctionBuilder) BuildLoop ¶ added in v1.2.8
func (b *FunctionBuilder) BuildLoop() *LoopBuilder
func (*FunctionBuilder) BuildSwitch ¶ added in v1.2.8
func (b *FunctionBuilder) BuildSwitch() *SwitchBuilder
func (*FunctionBuilder) BuildTry ¶ added in v1.2.8
func (b *FunctionBuilder) BuildTry() *TryBuilder
func (*FunctionBuilder) BuildValueFromAny ¶ added in v1.2.8
func (b *FunctionBuilder) BuildValueFromAny(id string, v any) (value Value)
func (*FunctionBuilder) CanBuildFreeValue ¶
func (b *FunctionBuilder) CanBuildFreeValue(name string) bool
func (*FunctionBuilder) CoverReflectFunctionType ¶ added in v1.2.8
func (f *FunctionBuilder) CoverReflectFunctionType(itype reflect.Type, level int) *FunctionType
func (*FunctionBuilder) CreateInterfaceWithVs ¶
func (b *FunctionBuilder) CreateInterfaceWithVs(keys []Value, vs []Value) *Make
func (*FunctionBuilder) DeleteLabel ¶ added in v1.2.8
func (b *FunctionBuilder) DeleteLabel(name string)
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(i any) *ConstInst
func (*FunctionBuilder) EmitConstInstAny ¶ added in v1.2.8
func (f *FunctionBuilder) EmitConstInstAny() *ConstInst
func (*FunctionBuilder) EmitConstInstNil ¶ added in v1.2.8
func (f *FunctionBuilder) EmitConstInstNil() *ConstInst
func (*FunctionBuilder) EmitConstInstWithUnary ¶ added in v1.2.8
func (f *FunctionBuilder) EmitConstInstWithUnary(i any, un int) *ConstInst
func (*FunctionBuilder) EmitErrorHandler ¶ added in v1.2.8
func (f *FunctionBuilder) EmitErrorHandler(try, catch *BasicBlock) *ErrorHandler
func (*FunctionBuilder) EmitField ¶
func (f *FunctionBuilder) EmitField(i, key Value) Value
func (*FunctionBuilder) EmitFieldMust ¶ added in v1.2.8
func (f *FunctionBuilder) EmitFieldMust(i, key Value) *Field
func (*FunctionBuilder) EmitIf ¶
func (f *FunctionBuilder) EmitIf(cond Value) *If
func (*FunctionBuilder) EmitInstructionAfter ¶ added in v1.2.8
func (f *FunctionBuilder) EmitInstructionAfter(i, after Instruction)
func (*FunctionBuilder) EmitInstructionBefore ¶ added in v1.2.8
func (f *FunctionBuilder) EmitInstructionBefore(i, before Instruction)
func (*FunctionBuilder) EmitInterfaceMake ¶ added in v1.3.0
func (b *FunctionBuilder) EmitInterfaceMake(f func(feed func(key Value, val Value))) *Make
EmitInterfaceMake quick build key=>value based object
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 Value, 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, isIn bool) (key, field, ok Value)
func (*FunctionBuilder) EmitNextOnly ¶ added in v1.2.8
func (f *FunctionBuilder) EmitNextOnly(iter Value, isIn bool) *Next
func (*FunctionBuilder) EmitOnly ¶ added in v1.2.9
func (f *FunctionBuilder) EmitOnly(i Instruction)
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) EmitToBlock ¶ added in v1.2.8
func (f *FunctionBuilder) EmitToBlock(i Instruction, block *BasicBlock)
func (*FunctionBuilder) EmitTypeCast ¶ added in v1.2.8
func (f *FunctionBuilder) EmitTypeCast(v Value, typ Type) *TypeCast
func (*FunctionBuilder) EmitTypeValue ¶ added in v1.2.8
func (f *FunctionBuilder) EmitTypeValue(typ Type) *TypeValue
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) *Undefined
func (*FunctionBuilder) EmitUpdate ¶ added in v1.2.8
func (f *FunctionBuilder) EmitUpdate(address, v Value) *Update
func (FunctionBuilder) GetAllVariables ¶ added in v1.3.0
func (FunctionBuilder) GetBlock ¶ added in v1.2.8
func (a FunctionBuilder) GetBlock() *BasicBlock
func (*FunctionBuilder) GetBreak ¶
func (b *FunctionBuilder) GetBreak() *BasicBlock
func (*FunctionBuilder) GetContinue ¶
func (b *FunctionBuilder) GetContinue() *BasicBlock
func (*FunctionBuilder) GetFallthrough ¶
func (b *FunctionBuilder) GetFallthrough() *BasicBlock
func (*FunctionBuilder) GetFromCmap ¶ added in v1.2.8
func (b *FunctionBuilder) GetFromCmap(key string) bool
func (*FunctionBuilder) GetFromLmap ¶ added in v1.2.8
func (b *FunctionBuilder) GetFromLmap(key string) bool
func (*FunctionBuilder) GetLabel ¶ added in v1.2.8
func (b *FunctionBuilder) GetLabel(name string) *BasicBlock
func (FunctionBuilder) GetOperand ¶ added in v1.2.8
func (FunctionBuilder) GetOperandNum ¶ added in v1.2.8
func (a FunctionBuilder) GetOperandNum() int
func (FunctionBuilder) GetOperands ¶ added in v1.2.8
func (a FunctionBuilder) GetOperands() Values
func (FunctionBuilder) GetParentBuilder ¶
func (b FunctionBuilder) GetParentBuilder() *FunctionBuilder
get parent function
func (FunctionBuilder) GetRange ¶ added in v1.3.0
func (c FunctionBuilder) GetRange() *Range
source code position
func (FunctionBuilder) GetScope ¶ added in v1.3.0
func (a FunctionBuilder) GetScope() *Scope
symbol-table
func (*FunctionBuilder) GetScopeLocalVariable ¶ added in v1.3.0
func (b *FunctionBuilder) GetScopeLocalVariable(id string) string
func (FunctionBuilder) GetType ¶ added in v1.2.8
func (n FunctionBuilder) GetType() Type
for Value : type
func (FunctionBuilder) GetVariable ¶ added in v1.2.8
func (FunctionBuilder) HasUsers ¶ added in v1.2.8
func (n FunctionBuilder) HasUsers() bool
has/get user and value
func (*FunctionBuilder) IsBlockFinish ¶ added in v1.3.0
func (b *FunctionBuilder) IsBlockFinish() bool
current block is finish?
func (FunctionBuilder) LineDisasm ¶ added in v1.3.0
func (a FunctionBuilder) LineDisasm() string
func (*FunctionBuilder) NewCall ¶
func (f *FunctionBuilder) NewCall(target Value, args []Value) *Call
func (*FunctionBuilder) NewError ¶
func (b *FunctionBuilder) NewError(kind ErrorKind, tag ErrorTag, massage string, arg ...interface{})
func (*FunctionBuilder) NewFunc ¶
func (b *FunctionBuilder) NewFunc(name string) (*Function, *Scope)
new function
func (*FunctionBuilder) NewParam ¶ added in v1.3.1
func (f *FunctionBuilder) NewParam(name string) *Parameter
func (*FunctionBuilder) NewScopeId ¶ added in v1.3.0
func (b *FunctionBuilder) NewScopeId() int
func (*FunctionBuilder) PeekLexicalVariableByName ¶ added in v1.3.0
func (b *FunctionBuilder) PeekLexicalVariableByName(variable string) Value
PeekLexicalVariableByName find the static variable in lexical scope
func (*FunctionBuilder) PeekVariable ¶ added in v1.3.0
func (b *FunctionBuilder) PeekVariable(variable string, create bool) Value
PeekVariable just same like `ReadVariable` , but `PeekVariable` don't create `Variable` if your syntax read variable, please use `ReadVariable` if you just want see what Value this variable, just use `PeekVariable`
func (*FunctionBuilder) PopFunction ¶
func (b *FunctionBuilder) PopFunction() *FunctionBuilder
func (*FunctionBuilder) PopTarget ¶
func (b *FunctionBuilder) PopTarget() bool
func (*FunctionBuilder) PushFunction ¶
func (b *FunctionBuilder) PushFunction(newFunc *Function, scope *Scope, block *BasicBlock) *FunctionBuilder
function stack
func (*FunctionBuilder) PushTarget ¶
func (b *FunctionBuilder) PushTarget(_break, _continue, _fallthrough *BasicBlock)
target stack
func (*FunctionBuilder) ReadVariable ¶
func (b *FunctionBuilder) ReadVariable(variable string, create bool) Value
* first check builder.currentDef
* if block sealed; just create a phi * if len(block.preds) == 0: undefined * if len(block.preds) == 1: just recursive * if len(block.preds) > 1: create phi and builder
func (*FunctionBuilder) ReadVariableBefore ¶ added in v1.2.8
func (b *FunctionBuilder) ReadVariableBefore(variable string, create bool, before Instruction) Value
func (*FunctionBuilder) ReadVariableEx ¶ added in v1.2.8
func (b *FunctionBuilder) ReadVariableEx(variable string, create bool, fun func([]Value))
func (FunctionBuilder) RemoveUser ¶ added in v1.2.8
func (n FunctionBuilder) RemoveUser(u User)
func (*FunctionBuilder) ScopeEnd ¶ added in v1.3.0
func (b *FunctionBuilder) ScopeEnd()
func (*FunctionBuilder) ScopeStart ¶ added in v1.3.0
func (b *FunctionBuilder) ScopeStart()
block symbol-table stack
func (FunctionBuilder) SetBlock ¶ added in v1.2.8
func (a FunctionBuilder) SetBlock(block *BasicBlock)
func (*FunctionBuilder) SetCurrent ¶ added in v1.2.8
func (f *FunctionBuilder) SetCurrent(i Instruction) func()
func (*FunctionBuilder) SetDefineFunc ¶ added in v1.3.1
func (b *FunctionBuilder) SetDefineFunc()
func (FunctionBuilder) SetFunc ¶ added in v1.2.8
func (a FunctionBuilder) SetFunc(f *Function)
ssa function and block
func (*FunctionBuilder) SetInstructionPosition ¶ added in v1.2.9
func (f *FunctionBuilder) SetInstructionPosition(i Instruction)
func (FunctionBuilder) SetName ¶ added in v1.3.0
func (a FunctionBuilder) SetName(v string)
variable
func (*FunctionBuilder) SetScopeLocalVariable ¶ added in v1.3.0
func (b *FunctionBuilder) SetScopeLocalVariable(text string) string
func (*FunctionBuilder) TryBuildExternValue ¶ added in v1.2.8
func (b *FunctionBuilder) TryBuildExternValue(id string) Value
func (*FunctionBuilder) TryGetSimilarityKey ¶ added in v1.2.8
func (b *FunctionBuilder) TryGetSimilarityKey(name, key string) string
func (*FunctionBuilder) WithDefineFunction ¶ added in v1.3.1
func (b *FunctionBuilder) WithDefineFunction(defineFunc map[string]any)
func (*FunctionBuilder) WithExternLib ¶ added in v1.2.8
func (b *FunctionBuilder) WithExternLib(lib map[string]map[string]any)
func (*FunctionBuilder) WithExternMethod ¶ added in v1.2.9
func (b *FunctionBuilder) WithExternMethod(builder MethodBuilder)
func (*FunctionBuilder) WithExternValue ¶ added in v1.2.8
func (b *FunctionBuilder) WithExternValue(vs map[string]any)
func (*FunctionBuilder) WriteVariable ¶ added in v1.2.8
func (f *FunctionBuilder) WriteVariable(variable string, value Value)
--------------- `f.currentDef` handler, read && write
type FunctionType ¶ added in v1.2.8
type FunctionType struct { Name string ReturnType Type Parameter Types FreeValue []string SideEffects []string IsVariadic bool IsMethod bool IsModifySelf bool // if this is method function // contains filtered or unexported fields }
func GetMethod ¶ added in v1.2.9
func GetMethod(t Type, id string) *FunctionType
func NewFunctionType ¶ added in v1.2.8
func NewFunctionType(name string, Parameter []Type, ReturnType Type, IsVariadic bool) *FunctionType
func NewFunctionTypeDefine ¶ added in v1.2.9
func NewFunctionTypeDefine(name string, Parameter []Type, ReturnType []Type, IsVariadic bool) *FunctionType
func ToFunctionType ¶ added in v1.2.8
func ToFunctionType(t Type) (*FunctionType, bool)
func (*FunctionType) AddMethod ¶ added in v1.2.9
func (b *FunctionType) AddMethod(id string, f *FunctionType)
func (*FunctionType) GetMethod ¶ added in v1.2.8
func (f *FunctionType) GetMethod() map[string]*FunctionType
func (*FunctionType) GetParamString ¶ added in v1.2.8
func (s *FunctionType) GetParamString() string
func (*FunctionType) GetTypeKind ¶ added in v1.2.8
func (s *FunctionType) GetTypeKind() TypeKind
func (*FunctionType) PkgPath ¶
func (s *FunctionType) PkgPath() string
func (*FunctionType) RawString ¶ added in v1.2.8
func (s *FunctionType) RawString() string
func (*FunctionType) SetFreeValue ¶ added in v1.2.8
func (s *FunctionType) SetFreeValue(fv []string)
func (*FunctionType) SetMethod ¶ added in v1.2.8
func (f *FunctionType) SetMethod(m map[string]*FunctionType)
func (*FunctionType) SetModifySelf ¶ added in v1.2.9
func (f *FunctionType) SetModifySelf(b bool)
func (*FunctionType) SetName ¶ added in v1.2.8
func (s *FunctionType) SetName(name string)
func (*FunctionType) SetSideEffect ¶ added in v1.2.9
func (s *FunctionType) SetSideEffect(se []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 NewIdentifierLV ¶ added in v1.2.8
func NewIdentifierLV(variable string, pos *Range) *IdentifierLV
func (*IdentifierLV) Assign ¶
func (i *IdentifierLV) Assign(v Value, f *FunctionBuilder)
func (*IdentifierLV) GetRange ¶ added in v1.3.0
func (i *IdentifierLV) GetRange() *Range
func (*IdentifierLV) GetValue ¶
func (i *IdentifierLV) GetValue(f *FunctionBuilder) Value
func (*IdentifierLV) SetIsSideEffect ¶ added in v1.2.9
func (i *IdentifierLV) SetIsSideEffect(b bool)
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 (*If) AddFalse ¶
func (i *If) AddFalse(f *BasicBlock)
func (*If) AddTrue ¶
func (i *If) AddTrue(t *BasicBlock)
func (*If) AddVariable ¶ added in v1.3.0
func (a *If) AddVariable(v *Variable)
func (*If) GetAllVariables ¶ added in v1.3.0
func (*If) GetBlock ¶
func (a *If) GetBlock() *BasicBlock
func (*If) GetOperand ¶ added in v1.2.8
func (*If) GetOperandNum ¶ added in v1.2.8
func (a *If) GetOperandNum() int
func (*If) GetOperands ¶ added in v1.2.8
func (a *If) GetOperands() Values
func (*If) GetProgram ¶ added in v1.3.0
func (a *If) GetProgram() *Program
func (*If) GetVariable ¶ added in v1.2.8
func (*If) LineDisasm ¶ added in v1.2.8
func (a *If) LineDisasm() string
func (*If) ReplaceValue ¶
func (*If) SetBlock ¶ added in v1.2.8
func (a *If) SetBlock(block *BasicBlock)
type IfBuilder ¶ added in v1.2.8
type IfBuilder struct {
// contains filtered or unexported fields
}
func (*IfBuilder) BuildChild ¶ added in v1.2.8
func (*IfBuilder) BuildCondition ¶ added in v1.2.8
func (*IfBuilder) BuildFalse ¶ added in v1.2.8
type Instruction ¶
type Instruction interface { ErrorLogger GetOpcode() Opcode // function GetFunc() *Function SetFunc(*Function) // block GetBlock() *BasicBlock SetBlock(*BasicBlock) // program GetProgram() *Program GetName() string SetName(variable string) GetId() int // for identify SetId(int) // position GetRange() *Range SetRange(*Range) // Scope SetScope(*Scope) GetScope() *Scope // extern IsExtern() bool SetExtern(bool) GetVariable(string) *Variable GetAllVariables() map[string]*Variable AddVariable(*Variable) }
type InstructionNode ¶ added in v1.2.8
type InstructionNode interface { Node Instruction }
type InstructionNodes ¶ added in v1.2.8
type InstructionNodes []InstructionNode
type InterfaceType ¶
type InterfaceType struct {
// contains filtered or unexported fields
}
====================== interface type
func NewInterfaceType ¶
func NewInterfaceType(name, pkgPath string) *InterfaceType
func (*InterfaceType) AddMethod ¶ added in v1.2.9
func (b *InterfaceType) AddMethod(id string, f *FunctionType)
func (*InterfaceType) GetMethod ¶ added in v1.2.8
func (i *InterfaceType) GetMethod() map[string]*FunctionType
func (*InterfaceType) GetTypeKind ¶ added in v1.2.8
func (i *InterfaceType) GetTypeKind() TypeKind
func (*InterfaceType) PkgPath ¶
func (i *InterfaceType) PkgPath() string
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) *Jump
func (*Jump) AddVariable ¶ added in v1.3.0
func (a *Jump) AddVariable(v *Variable)
func (*Jump) GetAllVariables ¶ added in v1.3.0
func (*Jump) GetBlock ¶
func (a *Jump) GetBlock() *BasicBlock
func (*Jump) GetOperand ¶ added in v1.2.8
func (*Jump) GetOperandNum ¶ added in v1.2.8
func (a *Jump) GetOperandNum() int
func (*Jump) GetOperands ¶ added in v1.2.8
func (a *Jump) GetOperands() Values
func (*Jump) GetProgram ¶ added in v1.3.0
func (a *Jump) GetProgram() *Program
func (*Jump) GetVariable ¶ added in v1.2.8
func (*Jump) LineDisasm ¶ added in v1.2.8
func (a *Jump) LineDisasm() string
func (*Jump) SetBlock ¶ added in v1.2.8
func (a *Jump) SetBlock(block *BasicBlock)
type LeftValue ¶
type LeftValue interface { Assign(Value, *FunctionBuilder) GetRange() *Range GetValue(*FunctionBuilder) Value }
--------------- for assign
type Loop ¶ added in v1.2.8
type Loop struct {
Body, Exit *BasicBlock
Init, Cond, Step Value
Key Value
// contains filtered or unexported fields
}
----------- For for loop
func (*Loop) AddVariable ¶ added in v1.3.0
func (a *Loop) AddVariable(v *Variable)
func (*Loop) GetAllVariables ¶ added in v1.3.0
func (*Loop) GetBlock ¶ added in v1.2.8
func (a *Loop) GetBlock() *BasicBlock
func (*Loop) GetOperand ¶ added in v1.2.8
func (*Loop) GetOperandNum ¶ added in v1.2.8
func (a *Loop) GetOperandNum() int
func (*Loop) GetOperands ¶ added in v1.2.8
func (a *Loop) GetOperands() Values
func (*Loop) GetProgram ¶ added in v1.3.0
func (a *Loop) GetProgram() *Program
func (*Loop) GetVariable ¶ added in v1.2.8
func (*Loop) LineDisasm ¶ added in v1.2.8
func (a *Loop) LineDisasm() string
func (*Loop) ReplaceValue ¶ added in v1.2.8
func (*Loop) SetBlock ¶ added in v1.2.8
func (a *Loop) SetBlock(block *BasicBlock)
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) BuildCondition ¶ added in v1.2.8
func (lb *LoopBuilder) BuildCondition(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 {
// when slice or map
Len, Cap Value
// contains filtered or unexported fields
}
----------- Make
func ToMake ¶ added in v1.3.0
func ToMake(v Instruction) (*Make, bool)
func (*Make) AddVariable ¶ added in v1.3.0
func (a *Make) AddVariable(v *Variable)
func (*Make) GetAllVariables ¶ added in v1.3.0
func (*Make) GetBlock ¶ added in v1.2.8
func (a *Make) GetBlock() *BasicBlock
func (*Make) GetOperand ¶ added in v1.2.8
func (*Make) GetOperandNum ¶ added in v1.2.8
func (a *Make) GetOperandNum() int
func (*Make) GetOperands ¶ added in v1.2.8
func (a *Make) GetOperands() Values
func (*Make) GetProgram ¶ added in v1.3.0
func (a *Make) GetProgram() *Program
func (*Make) GetVariable ¶ added in v1.2.8
func (*Make) LineDisasm ¶ added in v1.2.8
func (a *Make) LineDisasm() string
func (*Make) RemoveUser ¶ added in v1.2.8
func (n *Make) RemoveUser(u User)
func (*Make) ReplaceValue ¶ added in v1.2.8
func (*Make) SetBlock ¶ added in v1.2.8
func (a *Make) SetBlock(block *BasicBlock)
type MethodBuilder ¶ added in v1.2.9
type MethodBuilder interface { Build(Type, string) *FunctionType GetMethodNames(Type) []string }
var ExternMethodBuilder MethodBuilder
type Next ¶ added in v1.2.8
type Next struct { Iter Value InNext bool // "in" grammar // contains filtered or unexported fields }
------------- Next
func (*Next) AddVariable ¶ added in v1.3.0
func (a *Next) AddVariable(v *Variable)
func (*Next) GetAllVariables ¶ added in v1.3.0
func (*Next) GetBlock ¶ added in v1.2.8
func (a *Next) GetBlock() *BasicBlock
func (*Next) GetOperand ¶ added in v1.2.8
func (*Next) GetOperandNum ¶ added in v1.2.8
func (a *Next) GetOperandNum() int
func (*Next) GetOperands ¶ added in v1.2.8
func (a *Next) GetOperands() Values
func (*Next) GetProgram ¶ added in v1.3.0
func (a *Next) GetProgram() *Program
func (*Next) GetVariable ¶ added in v1.2.8
func (*Next) LineDisasm ¶ added in v1.2.8
func (a *Next) LineDisasm() string
func (*Next) RemoveUser ¶ added in v1.2.8
func (n *Next) RemoveUser(u User)
func (*Next) ReplaceValue ¶ added in v1.2.8
func (*Next) SetBlock ¶ added in v1.2.8
func (a *Next) SetBlock(block *BasicBlock)
type Node ¶
type Node interface { // string String() string // for graph HasUsers() bool GetUsers() Users HasValues() bool GetValues() Values }
data-flow
type ObjectType ¶ added in v1.2.8
type ObjectType struct { Name string Kind TypeKind Len int Keys []Value FieldTypes []Type AnonymousField []*ObjectType Combination bool // function multiple return will combined to struct KeyTyp Type FieldType Type // contains filtered or unexported fields }
==================== interface type
var NextType *ObjectType = nil
func NewMapType ¶
func NewMapType(key, field Type) *ObjectType
func NewObjectType ¶ added in v1.2.8
func NewObjectType() *ObjectType
func NewStructType ¶ added in v1.2.8
func NewStructType() *ObjectType
func ToObjectType ¶ added in v1.2.8
func ToObjectType(t Type) (*ObjectType, bool)
func (*ObjectType) AddField ¶ added in v1.2.8
func (s *ObjectType) AddField(key Value, field Type)
for struct build
func (*ObjectType) AddMethod ¶ added in v1.2.9
func (b *ObjectType) AddMethod(id string, f *FunctionType)
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
return (field-type, key-type)
func (*ObjectType) GetMethod ¶ added in v1.2.8
func (i *ObjectType) GetMethod() map[string]*FunctionType
func (*ObjectType) GetTypeKind ¶ added in v1.2.8
func (i *ObjectType) GetTypeKind() TypeKind
func (ObjectType) PkgPath ¶
func (i ObjectType) PkgPath() string
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 map[string]*Function }
func NewPackage ¶ added in v1.2.8
func (*Package) GetFunction ¶ added in v1.3.0
func (*Package) NewFunction ¶
type Panic ¶ added in v1.2.8
type Panic struct { Info Value // contains filtered or unexported fields }
-------------- PANIC
func (*Panic) AddVariable ¶ added in v1.3.0
func (a *Panic) AddVariable(v *Variable)
func (*Panic) GetAllVariables ¶ added in v1.3.0
func (*Panic) GetBlock ¶ added in v1.2.8
func (a *Panic) GetBlock() *BasicBlock
func (*Panic) GetOperand ¶ added in v1.2.8
func (*Panic) GetOperandNum ¶ added in v1.2.8
func (a *Panic) GetOperandNum() int
func (*Panic) GetOperands ¶ added in v1.2.8
func (a *Panic) GetOperands() Values
func (*Panic) GetProgram ¶ added in v1.3.0
func (a *Panic) GetProgram() *Program
func (*Panic) GetVariable ¶ added in v1.2.8
func (*Panic) LineDisasm ¶ added in v1.2.8
func (a *Panic) LineDisasm() string
func (*Panic) RemoveUser ¶ added in v1.2.8
func (n *Panic) RemoveUser(u User)
func (*Panic) ReplaceValue ¶ added in v1.2.8
func (*Panic) SetBlock ¶ added in v1.2.8
func (a *Panic) SetBlock(block *BasicBlock)
type Parameter ¶
type Parameter struct { IsFreeValue bool Function *Function FormalParameterIndex int FormalParameterName string FormalParameterVariadic bool // contains filtered or unexported fields }
----------- Parameter
func NewParam ¶ added in v1.2.8
func NewParam(variable string, isFreeValue bool, builder *FunctionBuilder) *Parameter
func ToParameter ¶ added in v1.2.8
func ToParameter(v Instruction) (*Parameter, bool)
func (*Parameter) AddVariable ¶ added in v1.3.0
func (a *Parameter) AddVariable(v *Variable)
func (*Parameter) GetAllVariables ¶ added in v1.3.0
func (*Parameter) GetBlock ¶ added in v1.2.8
func (a *Parameter) GetBlock() *BasicBlock
func (*Parameter) GetOperand ¶ added in v1.2.8
func (*Parameter) GetOperandNum ¶ added in v1.2.8
func (a *Parameter) GetOperandNum() int
func (*Parameter) GetOperands ¶ added in v1.2.8
func (a *Parameter) GetOperands() Values
func (*Parameter) GetProgram ¶ added in v1.3.0
func (a *Parameter) GetProgram() *Program
func (*Parameter) GetRange ¶ added in v1.3.0
func (c *Parameter) GetRange() *Range
source code position
func (*Parameter) GetVariable ¶ added in v1.2.8
func (*Parameter) HasUsers ¶ added in v1.2.8
func (n *Parameter) HasUsers() bool
has/get user and value
func (*Parameter) LineDisasm ¶ added in v1.2.8
func (a *Parameter) LineDisasm() string
func (*Parameter) RemoveUser ¶
func (n *Parameter) RemoveUser(u User)
func (*Parameter) SetBlock ¶ added in v1.2.8
func (a *Parameter) SetBlock(block *BasicBlock)
func (*Parameter) SetDefault ¶ added in v1.2.8
type Phi ¶
type Phi struct { Edge []Value // edge[i] from phi.Block.Preds[i] // contains filtered or unexported fields }
----------- Phi
func ToPhi ¶ added in v1.2.8
func ToPhi(v Instruction) (*Phi, bool)
func (*Phi) AddVariable ¶ added in v1.3.0
func (a *Phi) AddVariable(v *Variable)
func (*Phi) GetAllVariables ¶ added in v1.3.0
func (*Phi) GetBlock ¶
func (a *Phi) GetBlock() *BasicBlock
func (*Phi) GetOperand ¶ added in v1.2.8
func (*Phi) GetOperandNum ¶ added in v1.2.8
func (a *Phi) GetOperandNum() int
func (*Phi) GetOperands ¶ added in v1.2.8
func (a *Phi) GetOperands() Values
func (*Phi) GetProgram ¶ added in v1.3.0
func (a *Phi) GetProgram() *Program
func (*Phi) GetVariable ¶ added in v1.2.8
func (*Phi) LineDisasm ¶ added in v1.2.8
func (a *Phi) LineDisasm() string
func (*Phi) RemoveUser ¶
func (n *Phi) RemoveUser(u User)
func (*Phi) ReplaceValue ¶
func (*Phi) SetBlock ¶ added in v1.2.8
func (a *Phi) SetBlock(block *BasicBlock)
type Position ¶
func NewPosition ¶ added in v1.3.0
type Program ¶
type Program struct { // package list Packages map[string]*Package ConstInstruction *omap.OrderedMap[int, *ConstInst] NameToInstructions *omap.OrderedMap[string, []Instruction] IdToInstructionMap *omap.OrderedMap[int, Instruction] // contains filtered or unexported fields }
both instruction and value
func NewProgram ¶
func NewProgram() *Program
func (*Program) AddPackage ¶ added in v1.2.8
func (*Program) DeleteInstruction ¶ added in v1.3.0
func (p *Program) DeleteInstruction(i Instruction)
func (*Program) EachFunction ¶ added in v1.3.0
func (*Program) GetAndCreateMainFunction ¶ added in v1.3.0
func (*Program) GetAndCreateMainFunctionBuilder ¶ added in v1.3.0
func (prog *Program) GetAndCreateMainFunctionBuilder() *FunctionBuilder
create or get main function builder
func (*Program) GetFunctionFast ¶ added in v1.3.0
func (*Program) GetInstructionById ¶ added in v1.3.0
func (p *Program) GetInstructionById(id int) Instruction
func (*Program) GetInstructionsByName ¶ added in v1.3.0
func (p *Program) GetInstructionsByName(name string) []Instruction
func (*Program) GetPackage ¶ added in v1.3.0
func (*Program) RemoveInstructionWithName ¶ added in v1.3.1
func (p *Program) RemoveInstructionWithName(name string, i Instruction)
func (*Program) SetInstructionWithName ¶ added in v1.3.0
func (p *Program) SetInstructionWithName(name string, i Instruction)
func (*Program) SetVirtualRegister ¶ added in v1.3.0
func (p *Program) SetVirtualRegister(i Instruction)
set virtual register, and this virtual-register will be instruction-id and set to the instruction
func (*Program) ShowWithSource ¶
func (p *Program) ShowWithSource()
type Range ¶ added in v1.3.0
func (*Range) CompareEnd ¶ added in v1.3.0
func (*Range) CompareStart ¶ added in v1.3.0
if ret < 0: p before other if ret == 0: p = other if ret > 0: p after other
type Recover ¶ added in v1.2.8
type Recover struct {
// contains filtered or unexported fields
}
--------------- RECOVER
func (*Recover) AddVariable ¶ added in v1.3.0
func (a *Recover) AddVariable(v *Variable)
func (*Recover) GetAllVariables ¶ added in v1.3.0
func (*Recover) GetBlock ¶ added in v1.2.8
func (a *Recover) GetBlock() *BasicBlock
func (*Recover) GetOperand ¶ added in v1.2.8
func (*Recover) GetOperandNum ¶ added in v1.2.8
func (a *Recover) GetOperandNum() int
func (*Recover) GetOperands ¶ added in v1.2.8
func (a *Recover) GetOperands() Values
func (*Recover) GetProgram ¶ added in v1.3.0
func (a *Recover) GetProgram() *Program
func (*Recover) GetVariable ¶ added in v1.2.8
func (*Recover) LineDisasm ¶ added in v1.2.8
func (a *Recover) LineDisasm() string
func (*Recover) RemoveUser ¶ added in v1.2.8
func (n *Recover) RemoveUser(u User)
func (*Recover) SetBlock ¶ added in v1.2.8
func (a *Recover) SetBlock(block *BasicBlock)
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 (*Return) AddVariable ¶ added in v1.3.0
func (a *Return) AddVariable(v *Variable)
func (*Return) GetAllVariables ¶ added in v1.3.0
func (*Return) GetBlock ¶
func (a *Return) GetBlock() *BasicBlock
func (*Return) GetOperand ¶ added in v1.2.8
func (*Return) GetOperandNum ¶ added in v1.2.8
func (a *Return) GetOperandNum() int
func (*Return) GetOperands ¶ added in v1.2.8
func (a *Return) GetOperands() Values
func (*Return) GetProgram ¶ added in v1.3.0
func (a *Return) GetProgram() *Program
func (*Return) GetVariable ¶ added in v1.2.8
func (*Return) LineDisasm ¶ added in v1.2.8
func (a *Return) LineDisasm() string
func (*Return) RemoveUser ¶ added in v1.2.9
func (n *Return) RemoveUser(u User)
func (*Return) ReplaceValue ¶
func (*Return) SetBlock ¶ added in v1.2.8
func (a *Return) SetBlock(block *BasicBlock)
type Scope ¶ added in v1.3.0
type Scope struct { Id int // scope id in a function VarMap map[string][]*Variable Var []item // sort by Position SymbolTable map[string]string // variable -> variable-ID(variable-scopeID) SymbolTableReverse map[string]string // variable -> variable-ID(variable-scopeID) Range *Range Function *Function Parent *Scope Children []*Scope }
func (*Scope) AddVariable ¶ added in v1.3.0
func (*Scope) GetLocalVariable ¶ added in v1.3.0
func (*Scope) InsertByRange ¶ added in v1.3.0
func (*Scope) PeekLexicalVariableByName ¶ added in v1.3.0
func (*Scope) SetLocalVariable ¶ added in v1.3.0
type SideEffect ¶ added in v1.2.9
type SideEffect struct {
// contains filtered or unexported fields
}
----------- SideEffect
func NewSideEffect ¶ added in v1.2.9
func NewSideEffect(variable string, target Value) *SideEffect
func (*SideEffect) AddVariable ¶ added in v1.3.0
func (a *SideEffect) AddVariable(v *Variable)
func (*SideEffect) GetAllVariables ¶ added in v1.3.0
func (*SideEffect) GetBlock ¶ added in v1.2.9
func (a *SideEffect) GetBlock() *BasicBlock
func (*SideEffect) GetOpcode ¶ added in v1.2.9
func (i *SideEffect) GetOpcode() Opcode
func (*SideEffect) GetOperand ¶ added in v1.2.9
func (*SideEffect) GetOperandNum ¶ added in v1.2.9
func (a *SideEffect) GetOperandNum() int
func (*SideEffect) GetOperands ¶ added in v1.2.9
func (a *SideEffect) GetOperands() Values
func (*SideEffect) GetProgram ¶ added in v1.3.0
func (a *SideEffect) GetProgram() *Program
func (*SideEffect) GetRange ¶ added in v1.3.0
func (c *SideEffect) GetRange() *Range
source code position
func (*SideEffect) GetValues ¶ added in v1.2.9
func (s *SideEffect) GetValues() Values
func (*SideEffect) GetVariable ¶ added in v1.2.9
func (*SideEffect) HasUsers ¶ added in v1.2.9
func (n *SideEffect) HasUsers() bool
has/get user and value
func (*SideEffect) HasValues ¶ added in v1.2.9
func (s *SideEffect) HasValues() bool
------------ SideEffect
func (*SideEffect) LineDisasm ¶ added in v1.2.9
func (a *SideEffect) LineDisasm() string
func (*SideEffect) RemoveUser ¶ added in v1.2.9
func (n *SideEffect) RemoveUser(u User)
func (*SideEffect) ReplaceValue ¶ added in v1.2.9
func (s *SideEffect) ReplaceValue(v Value, to Value)
func (*SideEffect) SetBlock ¶ added in v1.2.9
func (a *SideEffect) SetBlock(block *BasicBlock)
func (*SideEffect) SetFunc ¶ added in v1.2.9
func (a *SideEffect) SetFunc(f *Function)
ssa function and block
func (*SideEffect) String ¶ added in v1.2.9
func (s *SideEffect) String() string
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) *Switch
func (*Switch) AddVariable ¶ added in v1.3.0
func (a *Switch) AddVariable(v *Variable)
func (*Switch) GetAllVariables ¶ added in v1.3.0
func (*Switch) GetBlock ¶
func (a *Switch) GetBlock() *BasicBlock
func (*Switch) GetOperand ¶ added in v1.2.8
func (*Switch) GetOperandNum ¶ added in v1.2.8
func (a *Switch) GetOperandNum() int
func (*Switch) GetOperands ¶ added in v1.2.8
func (a *Switch) GetOperands() Values
func (*Switch) GetProgram ¶ added in v1.3.0
func (a *Switch) GetProgram() *Program
func (*Switch) GetVariable ¶ added in v1.2.8
func (*Switch) LineDisasm ¶ added in v1.2.8
func (a *Switch) LineDisasm() string
func (*Switch) ReplaceValue ¶
func (*Switch) SetBlock ¶ added in v1.2.8
func (a *Switch) SetBlock(block *BasicBlock)
type SwitchBuilder ¶ added in v1.2.8
type SwitchBuilder struct { DefaultBreak bool // contains filtered or unexported fields }
func (*SwitchBuilder) BuildBody ¶ added in v1.2.8
func (t *SwitchBuilder) BuildBody(f func(int))
func (*SwitchBuilder) BuildCondition ¶ added in v1.2.8
func (t *SwitchBuilder) BuildCondition(f func() Value)
func (*SwitchBuilder) BuildDefault ¶ added in v1.2.8
func (t *SwitchBuilder) BuildDefault(f func())
func (*SwitchBuilder) BuildHandler ¶ added in v1.2.9
func (t *SwitchBuilder) BuildHandler(f func() (int, []Value))
func (*SwitchBuilder) Finish ¶ added in v1.2.9
func (t *SwitchBuilder) Finish()
type SwitchLabel ¶
type SwitchLabel struct { Value Value Dest *BasicBlock }
----------- Switch
func NewSwitchLabel ¶
func NewSwitchLabel(v Value, dest *BasicBlock) SwitchLabel
type TryBuilder ¶ added in v1.2.8
type TryBuilder struct {
// contains filtered or unexported fields
}
func (*TryBuilder) BuildCatch ¶ added in v1.2.8
func (t *TryBuilder) BuildCatch(f func())
func (*TryBuilder) BuildError ¶ added in v1.2.9
func (t *TryBuilder) BuildError(f func() string)
func (*TryBuilder) BuildFinally ¶ added in v1.2.8
func (t *TryBuilder) BuildFinally(f func())
func (*TryBuilder) BuildTryBlock ¶ added in v1.2.8
func (t *TryBuilder) BuildTryBlock(f func())
func (*TryBuilder) Finish ¶ added in v1.2.8
func (t *TryBuilder) Finish()
type Type ¶
type Type interface { String() string // only string PkgPath() string // package path string RawString() string GetTypeKind() TypeKind // set/get method SetMethod(map[string]*FunctionType) AddMethod(string, *FunctionType) GetMethod() map[string]*FunctionType }
func CalculateType ¶ added in v1.2.8
func GetAnyType ¶ added in v1.3.0
func GetAnyType() Type
func GetBooleanType ¶ added in v1.3.0
func GetBooleanType() Type
func GetBytesType ¶ added in v1.3.0
func GetBytesType() Type
func GetErrorType ¶ added in v1.3.0
func GetErrorType() Type
func GetNullType ¶ added in v1.3.0
func GetNullType() Type
func GetNumberType ¶ added in v1.3.0
func GetNumberType() Type
func GetStringType ¶ added in v1.3.0
func GetStringType() Type
func GetTypeByStr ¶
func GetUndefinedType ¶ added in v1.3.0
func GetUndefinedType() Type
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 (*TypeCast) AddVariable ¶ added in v1.3.0
func (a *TypeCast) AddVariable(v *Variable)
func (*TypeCast) GetAllVariables ¶ added in v1.3.0
func (*TypeCast) GetBlock ¶ added in v1.2.8
func (a *TypeCast) GetBlock() *BasicBlock
func (*TypeCast) GetOperand ¶ added in v1.2.8
func (*TypeCast) GetOperandNum ¶ added in v1.2.8
func (a *TypeCast) GetOperandNum() int
func (*TypeCast) GetOperands ¶ added in v1.2.8
func (a *TypeCast) GetOperands() Values
func (*TypeCast) GetProgram ¶ added in v1.3.0
func (a *TypeCast) GetProgram() *Program
func (*TypeCast) GetRange ¶ added in v1.3.0
func (c *TypeCast) GetRange() *Range
source code position
func (*TypeCast) GetVariable ¶ added in v1.2.8
func (*TypeCast) HasUsers ¶ added in v1.2.8
func (n *TypeCast) HasUsers() bool
has/get user and value
func (*TypeCast) LineDisasm ¶ added in v1.2.8
func (a *TypeCast) LineDisasm() string
func (*TypeCast) RemoveUser ¶ added in v1.2.8
func (n *TypeCast) RemoveUser(u User)
func (*TypeCast) ReplaceValue ¶ added in v1.2.8
func (*TypeCast) SetBlock ¶ added in v1.2.8
func (a *TypeCast) SetBlock(block *BasicBlock)
type TypeValue ¶ added in v1.2.8
type TypeValue struct {
// contains filtered or unexported fields
}
------------- type value
func NewTypeValue ¶ added in v1.2.8
func (*TypeValue) AddVariable ¶ added in v1.3.0
func (a *TypeValue) AddVariable(v *Variable)
func (*TypeValue) GetAllVariables ¶ added in v1.3.0
func (*TypeValue) GetBlock ¶ added in v1.2.8
func (a *TypeValue) GetBlock() *BasicBlock
func (*TypeValue) GetOperand ¶ added in v1.2.8
func (*TypeValue) GetOperandNum ¶ added in v1.2.8
func (a *TypeValue) GetOperandNum() int
func (*TypeValue) GetOperands ¶ added in v1.2.8
func (a *TypeValue) GetOperands() Values
func (*TypeValue) GetProgram ¶ added in v1.3.0
func (a *TypeValue) GetProgram() *Program
func (*TypeValue) GetRange ¶ added in v1.3.0
func (c *TypeValue) GetRange() *Range
source code position
func (*TypeValue) GetVariable ¶ added in v1.2.8
func (*TypeValue) HasUsers ¶ added in v1.2.8
func (n *TypeValue) HasUsers() bool
has/get user and value
func (*TypeValue) LineDisasm ¶ added in v1.2.8
func (a *TypeValue) LineDisasm() string
func (*TypeValue) RemoveUser ¶ added in v1.2.8
func (n *TypeValue) RemoveUser(u User)
func (*TypeValue) SetBlock ¶ added in v1.2.8
func (a *TypeValue) SetBlock(block *BasicBlock)
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) *UnOp
func ToUnOp ¶ added in v1.2.8
func ToUnOp(v Instruction) (*UnOp, bool)
func (*UnOp) AddVariable ¶ added in v1.3.0
func (a *UnOp) AddVariable(v *Variable)
func (*UnOp) GetAllVariables ¶ added in v1.3.0
func (*UnOp) GetBlock ¶
func (a *UnOp) GetBlock() *BasicBlock
func (*UnOp) GetOperand ¶ added in v1.2.8
func (*UnOp) GetOperandNum ¶ added in v1.2.8
func (a *UnOp) GetOperandNum() int
func (*UnOp) GetOperands ¶ added in v1.2.8
func (a *UnOp) GetOperands() Values
func (*UnOp) GetProgram ¶ added in v1.3.0
func (a *UnOp) GetProgram() *Program
func (*UnOp) GetVariable ¶ added in v1.2.8
func (*UnOp) LineDisasm ¶ added in v1.2.8
func (a *UnOp) LineDisasm() string
func (*UnOp) RemoveUser ¶ added in v1.2.8
func (n *UnOp) RemoveUser(u User)
func (*UnOp) ReplaceValue ¶ added in v1.2.8
func (*UnOp) SetBlock ¶ added in v1.2.8
func (a *UnOp) SetBlock(block *BasicBlock)
type UnaryOpcode ¶
type UnaryOpcode int
const ( OpNone UnaryOpcode = iota OpNot // ! OpPlus // + OpNeg // - OpChan // <- OpBitwiseNot // ^ )
type Undefined ¶ added in v1.2.8
type Undefined struct {
// contains filtered or unexported fields
}
----------- Undefined
func NewUndefined ¶ added in v1.2.8
func ToUndefined ¶ added in v1.2.8
func ToUndefined(v Instruction) (*Undefined, bool)
func (*Undefined) AddVariable ¶ added in v1.3.0
func (a *Undefined) AddVariable(v *Variable)
func (*Undefined) GetAllVariables ¶ added in v1.3.0
func (*Undefined) GetBlock ¶ added in v1.2.8
func (a *Undefined) GetBlock() *BasicBlock
func (*Undefined) GetOperand ¶ added in v1.2.8
func (*Undefined) GetOperandNum ¶ added in v1.2.8
func (a *Undefined) GetOperandNum() int
func (*Undefined) GetOperands ¶ added in v1.2.8
func (a *Undefined) GetOperands() Values
func (*Undefined) GetProgram ¶ added in v1.3.0
func (a *Undefined) GetProgram() *Program
func (*Undefined) GetRange ¶ added in v1.3.0
func (c *Undefined) GetRange() *Range
source code position
func (*Undefined) GetVariable ¶ added in v1.2.8
func (*Undefined) HasUsers ¶ added in v1.2.8
func (n *Undefined) HasUsers() bool
has/get user and value
func (*Undefined) LineDisasm ¶ added in v1.2.8
func (a *Undefined) LineDisasm() string
func (*Undefined) RemoveUser ¶ added in v1.2.8
func (n *Undefined) RemoveUser(u User)
func (*Undefined) SetBlock ¶ added in v1.2.8
func (a *Undefined) SetBlock(block *BasicBlock)
type Update ¶
type Update struct { Value Value Address Value // this point to field // contains filtered or unexported fields }
----------- Update
func ToUpdate ¶ added in v1.2.8
func ToUpdate(v Instruction) (*Update, bool)
func (*Update) AddVariable ¶ added in v1.3.0
func (a *Update) AddVariable(v *Variable)
func (*Update) GetAllVariables ¶ added in v1.3.0
func (*Update) GetBlock ¶
func (a *Update) GetBlock() *BasicBlock
func (*Update) GetOperand ¶ added in v1.2.8
func (*Update) GetOperandNum ¶ added in v1.2.8
func (a *Update) GetOperandNum() int
func (*Update) GetOperands ¶ added in v1.2.8
func (a *Update) GetOperands() Values
func (*Update) GetProgram ¶ added in v1.3.0
func (a *Update) GetProgram() *Program
func (*Update) GetVariable ¶ added in v1.2.8
func (*Update) LineDisasm ¶ added in v1.2.8
func (a *Update) LineDisasm() string
func (*Update) ReplaceValue ¶
func (*Update) SetBlock ¶ added in v1.2.8
func (a *Update) SetBlock(block *BasicBlock)
type User ¶
type User interface { InstructionNode ReplaceValue(Value, Value) }
type Users ¶ added in v1.2.8
type Users []User
func (Users) RunOnCallOr ¶ added in v1.2.8
func (Users) RunOnField ¶ added in v1.2.8
func (Users) RunOnFieldOr ¶ added in v1.2.8
func (Users) RunOnUpdate ¶ added in v1.2.8
func (Users) RunOnUpdateOr ¶ added in v1.2.8
type Value ¶
type Value interface { InstructionNode TypedNode Maskable AddUser(User) RemoveUser(User) }
basic handle item (interface)
func CalcBinary ¶ added in v1.2.8
func CalcConstBinarySide ¶ added in v1.2.8
func CalcConstBinarySide(c *ConstInst, 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) Value
func NewUnOp ¶ added in v1.2.8
func NewUnOp(op UnaryOpcode, x Value) Value
Source Files ¶
- InstructionCover.go
- InstructionEmit.go
- InstructionHandler.go
- InstructionOpcode.go
- block.go
- builder.go
- call.go
- cfg.go
- const.go
- const_calc.go
- disasm.go
- disasmLine.go
- error.go
- error_message.go
- extern_instance.go
- func.go
- id.go
- instruction.go
- object.go
- phi.go
- position.go
- program.go
- scope.go
- ssa.go
- ssa_inspect.go
- ssa_vars.go
- type.go
- use.go
- variable.go