Documentation ¶
Index ¶
- Constants
- Variables
- func Compile(f *Func)
- func PhaseOption(phase, flag string, val int) string
- type ArgSymbol
- type AutoSymbol
- type Block
- func (b *Block) AddEdgeTo(c *Block)
- func (b *Block) Fatalf(msg string, args ...interface{})
- func (b *Block) HTML() string
- func (b *Block) Log() bool
- func (b *Block) Logf(msg string, args ...interface{})
- func (b *Block) LongHTML() string
- func (b *Block) LongString() string
- func (b *Block) NewValue0(line int32, op Op, t Type) *Value
- func (b *Block) NewValue0A(line int32, op Op, t Type, aux interface{}) *Value
- func (b *Block) NewValue0I(line int32, op Op, t Type, auxint int64) *Value
- func (b *Block) NewValue0IA(line int32, op Op, t Type, auxint int64, aux interface{}) *Value
- func (b *Block) NewValue1(line int32, op Op, t Type, arg *Value) *Value
- func (b *Block) NewValue1A(line int32, op Op, t Type, aux interface{}, arg *Value) *Value
- func (b *Block) NewValue1I(line int32, op Op, t Type, auxint int64, arg *Value) *Value
- func (b *Block) NewValue1IA(line int32, op Op, t Type, auxint int64, aux interface{}, arg *Value) *Value
- func (b *Block) NewValue2(line int32, op Op, t Type, arg0, arg1 *Value) *Value
- func (b *Block) NewValue2I(line int32, op Op, t Type, auxint int64, arg0, arg1 *Value) *Value
- func (b *Block) NewValue3(line int32, op Op, t Type, arg0, arg1, arg2 *Value) *Value
- func (b *Block) NewValue3I(line int32, op Op, t Type, auxint int64, arg0, arg1, arg2 *Value) *Value
- func (b *Block) SetControl(v *Value)
- func (b *Block) String() string
- func (b *Block) Unimplementedf(msg string, args ...interface{})
- type BlockKind
- type BranchPrediction
- type Cmp
- type CompilerType
- func (t *CompilerType) Alignment() int64
- func (t *CompilerType) Compare(u Type) Cmp
- func (t *CompilerType) ElemType() Type
- func (t *CompilerType) Equal(u Type) bool
- func (t *CompilerType) FieldName(i int) string
- func (t *CompilerType) FieldOff(i int) int64
- func (t *CompilerType) FieldType(i int) Type
- func (t *CompilerType) IsArray() bool
- func (t *CompilerType) IsBoolean() bool
- func (t *CompilerType) IsComplex() bool
- func (t *CompilerType) IsFlags() bool
- func (t *CompilerType) IsFloat() bool
- func (t *CompilerType) IsInteger() bool
- func (t *CompilerType) IsInterface() bool
- func (t *CompilerType) IsMemory() bool
- func (t *CompilerType) IsPtrShaped() bool
- func (t *CompilerType) IsSigned() bool
- func (t *CompilerType) IsSlice() bool
- func (t *CompilerType) IsString() bool
- func (t *CompilerType) IsStruct() bool
- func (t *CompilerType) IsVoid() bool
- func (t *CompilerType) NumElem() int64
- func (t *CompilerType) NumFields() int
- func (t *CompilerType) PtrTo() Type
- func (t *CompilerType) SimpleString() string
- func (t *CompilerType) Size() int64
- func (t *CompilerType) String() string
- type Config
- func (c *Config) DebugHashMatch(evname, name string) bool
- func (c *Config) Debug_checknil() bool
- func (c *Config) Fatalf(line int32, msg string, args ...interface{})
- func (c *Config) Frontend() Frontend
- func (c *Config) Log() bool
- func (c *Config) Logf(msg string, args ...interface{})
- func (c *Config) NewFunc() *Func
- func (c *Config) Unimplementedf(line int32, msg string, args ...interface{})
- func (c *Config) Warnl(line int32, msg string, args ...interface{})
- type ExternSymbol
- type Frontend
- type Func
- func (f *Func) ConstBool(line int32, t Type, c bool) *Value
- func (f *Func) ConstEmptyString(line int32, t Type) *Value
- func (f *Func) ConstFloat32(line int32, t Type, c float64) *Value
- func (f *Func) ConstFloat64(line int32, t Type, c float64) *Value
- func (f *Func) ConstInt16(line int32, t Type, c int16) *Value
- func (f *Func) ConstInt32(line int32, t Type, c int32) *Value
- func (f *Func) ConstInt64(line int32, t Type, c int64) *Value
- func (f *Func) ConstInt8(line int32, t Type, c int8) *Value
- func (f *Func) ConstInterface(line int32, t Type) *Value
- func (f *Func) ConstNil(line int32, t Type) *Value
- func (f *Func) ConstSlice(line int32, t Type) *Value
- func (f *Func) Fatalf(msg string, args ...interface{})
- func (f *Func) Free()
- func (f *Func) HTML() string
- func (f *Func) Log() bool
- func (f *Func) Logf(msg string, args ...interface{})
- func (f *Func) NewBlock(kind BlockKind) *Block
- func (f *Func) NumBlocks() int
- func (f *Func) NumValues() int
- func (f *Func) String() string
- func (f *Func) Unimplementedf(msg string, args ...interface{})
- type GCNode
- type GCSym
- type HTMLWriter
- type ID
- type LocalSlot
- type Location
- type Logger
- type Op
- type Register
- type Type
- type TypeSource
- type ValAndOff
- type ValHeap
- type Value
- func (v *Value) AddArg(w *Value)
- func (v *Value) AddArgs(a ...*Value)
- func (v *Value) AuxFloat() float64
- func (v *Value) AuxInt16() int16
- func (v *Value) AuxInt32() int32
- func (v *Value) AuxInt8() int8
- func (v *Value) AuxValAndOff() ValAndOff
- func (v *Value) Fatalf(msg string, args ...interface{})
- func (v *Value) HTML() string
- func (v *Value) Log() bool
- func (v *Value) Logf(msg string, args ...interface{})
- func (v *Value) LongHTML() string
- func (v *Value) LongString() string
- func (v *Value) RemoveArg(i int)
- func (v *Value) SetArg(i int, w *Value)
- func (v *Value) SetArgs1(a *Value)
- func (v *Value) SetArgs2(a *Value, b *Value)
- func (v *Value) String() string
- func (v *Value) Unimplementedf(msg string, args ...interface{})
Constants ¶
const ( BranchUnlikely = BranchPrediction(-1) BranchUnknown = BranchPrediction(0) BranchLikely = BranchPrediction(+1) )
const ( ScorePhi = iota // towards top of block ScoreVarDef ScoreMemory ScoreDefault ScoreFlags ScoreControl // towards bottom of block )
const ( // When used to lookup up definitions in a sparse tree, // these adjustments to a block's entry (+adjust) and // exit (-adjust) numbers allow a distinction to be made // between assignments (typically branch-dependent // conditionals) occurring "before" phi functions, the // phi functions, and at the bottom of a block. ADJUST_BEFORE = -1 // defined before phi ADJUST_TOP = 0 // defined by phi ADJUST_BOTTOM = 1 // defined within block )
const ( CMPlt = Cmp(-1) CMPeq = Cmp(0) CMPgt = Cmp(1) )
const MaxStruct = 4
MaxStruct is the maximum number of fields a struct can have and still be SSAable.
Variables ¶
var ( TypeInvalid = &CompilerType{Name: "invalid"} TypeMem = &CompilerType{Name: "mem", Memory: true} TypeFlags = &CompilerType{Name: "flags", Flags: true} TypeVoid = &CompilerType{Name: "void", Void: true} TypeInt128 = &CompilerType{Name: "int128", size: 16, Int128: true} )
var IntrinsicsDebug int
Debug output
var IntrinsicsDisable bool
Functions ¶
func Compile ¶
func Compile(f *Func)
Compile is the main entry point for this package. Compile modifies f so that on return:
· all Values in f map to 0 or 1 assembly instructions of the target architecture · the order of f.Blocks is the order to emit the Blocks · the order of b.Values is the order to emit the Values in each Block · f has a non-nil regAlloc field
func PhaseOption ¶
PhaseOption sets the specified flag in the specified ssa phase, returning empty string if this was successful or a string explaining the error if it was not. A version of the phase name with "_" replaced by " " is also checked for a match. If the phase name begins a '~' then the rest of the underscores-replaced-with-blanks version is used as a regular expression to match the phase name(s).
Special cases that have turned out to be useful:
ssa/check/on enables checking after each phase ssa/all/time enables time reporting for all phases
See gc/lex.go for dissection of the option string. Example uses:
GO_GCFLAGS=-d=ssa/generic_cse/time,ssa/generic_cse/stats,ssa/generic_cse/debug=3 ./make.bash
BOOT_GO_GCFLAGS=-d='ssa/~^.*scc$/off' GO_GCFLAGS='-d=ssa/~^.*scc$/off' ./make.bash
Types ¶
type ArgSymbol ¶
type ArgSymbol struct { Typ Type // Go type Node GCNode // A *gc.Node referring to the argument/result variable. }
ArgSymbol is an aux value that encodes an argument or result variable's constant offset from FP (FP = SP + framesize).
type AutoSymbol ¶
type AutoSymbol struct { Typ Type // Go type Node GCNode // A *gc.Node referring to a local (auto) variable. }
AutoSymbol is an aux value that encodes a local variable's constant offset from SP.
func (*AutoSymbol) String ¶
func (s *AutoSymbol) String() string
type Block ¶
type Block struct { // A unique identifier for the block. The system will attempt to allocate // these IDs densely, but no guarantees. ID ID // The kind of block this is. Kind BlockKind // Subsequent blocks, if any. The number and order depend on the block kind. // All successors must be distinct (to make phi values in successors unambiguous). Succs []*Block // Inverse of successors. // The order is significant to Phi nodes in the block. Preds []*Block // A value that determines how the block is exited. Its value depends on the kind // of the block. For instance, a BlockIf has a boolean control value and BlockExit // has a memory control value. Control *Value // Auxiliary info for the block. Its value depends on the Kind. Aux interface{} // The unordered set of Values that define the operation of this block. // The list must include the control value, if any. (TODO: need this last condition?) // After the scheduling pass, this list is ordered. Values []*Value // The containing function Func *Func // Line number for block's control operation Line int32 // Likely direction for branches. // If BranchLikely, Succs[0] is the most likely branch taken. // If BranchUnlikely, Succs[1] is the most likely branch taken. // Ignored if len(Succs) < 2. // Fatal if not BranchUnknown and len(Succs) > 2. Likely BranchPrediction // After flagalloc, records whether flags are live at the end of the block. FlagsLiveAtEnd bool // contains filtered or unexported fields }
Block represents a basic block in the control flow graph of a function.
func (*Block) AddEdgeTo ¶
AddEdgeTo adds an edge from block b to block c. Used during building of the SSA graph; do not use on an already-completed SSA graph.
func (*Block) NewValue0 ¶
NewValue0 returns a new value in the block with no arguments and zero aux values.
func (*Block) NewValue0A ¶
NewValue returns a new value in the block with no arguments and an aux value.
func (*Block) NewValue0I ¶
NewValue returns a new value in the block with no arguments and an auxint value.
func (*Block) NewValue0IA ¶
NewValue returns a new value in the block with no arguments and both an auxint and aux values.
func (*Block) NewValue1 ¶
NewValue1 returns a new value in the block with one argument and zero aux values.
func (*Block) NewValue1A ¶
NewValue1A returns a new value in the block with one argument and an aux value.
func (*Block) NewValue1I ¶
NewValue1I returns a new value in the block with one argument and an auxint value.
func (*Block) NewValue1IA ¶
func (b *Block) NewValue1IA(line int32, op Op, t Type, auxint int64, aux interface{}, arg *Value) *Value
NewValue1IA returns a new value in the block with one argument and both an auxint and aux values.
func (*Block) NewValue2 ¶
NewValue2 returns a new value in the block with two arguments and zero aux values.
func (*Block) NewValue2I ¶
NewValue2I returns a new value in the block with two arguments and an auxint value.
func (*Block) NewValue3 ¶
NewValue3 returns a new value in the block with three arguments and zero aux values.
func (*Block) NewValue3I ¶
NewValue3I returns a new value in the block with three arguments and an auxint value.
func (*Block) SetControl ¶
func (*Block) Unimplementedf ¶
type BlockKind ¶
type BlockKind int32
kind control successors
------------------------------------------
Exit return mem [] Plain nil [next] If a boolean Value [then, else] Call mem [nopanic, panic] (control opcode should be OpCall or OpStaticCall)
const ( BlockInvalid BlockKind = iota BlockAMD64EQ BlockAMD64NE BlockAMD64LT BlockAMD64LE BlockAMD64GT BlockAMD64GE BlockAMD64ULT BlockAMD64ULE BlockAMD64UGT BlockAMD64UGE BlockAMD64EQF BlockAMD64NEF BlockAMD64ORD BlockAMD64NAN BlockARMEQ BlockARMNE BlockARMLT BlockARMLE BlockARMGT BlockARMGE BlockARMULT BlockARMULE BlockARMUGT BlockARMUGE BlockPlain BlockIf BlockCall BlockDefer BlockCheck BlockRet BlockRetJmp BlockExit BlockFirst BlockDead )
type BranchPrediction ¶
type BranchPrediction int8
type Cmp ¶
type Cmp int8
Cmp is a comparison between values a and b. -1 if a < b
0 if a == b 1 if a > b
type CompilerType ¶
type CompilerType struct { Name string Memory bool Flags bool Void bool Int128 bool // contains filtered or unexported fields }
Special compiler-only types.
func (*CompilerType) Alignment ¶
func (t *CompilerType) Alignment() int64
func (*CompilerType) Compare ¶
func (t *CompilerType) Compare(u Type) Cmp
func (*CompilerType) ElemType ¶
func (t *CompilerType) ElemType() Type
func (*CompilerType) Equal ¶
func (t *CompilerType) Equal(u Type) bool
func (*CompilerType) FieldName ¶
func (t *CompilerType) FieldName(i int) string
func (*CompilerType) FieldOff ¶
func (t *CompilerType) FieldOff(i int) int64
func (*CompilerType) FieldType ¶
func (t *CompilerType) FieldType(i int) Type
func (*CompilerType) IsArray ¶
func (t *CompilerType) IsArray() bool
func (*CompilerType) IsBoolean ¶
func (t *CompilerType) IsBoolean() bool
func (*CompilerType) IsComplex ¶
func (t *CompilerType) IsComplex() bool
func (*CompilerType) IsFlags ¶
func (t *CompilerType) IsFlags() bool
func (*CompilerType) IsFloat ¶
func (t *CompilerType) IsFloat() bool
func (*CompilerType) IsInteger ¶
func (t *CompilerType) IsInteger() bool
func (*CompilerType) IsInterface ¶
func (t *CompilerType) IsInterface() bool
func (*CompilerType) IsMemory ¶
func (t *CompilerType) IsMemory() bool
func (*CompilerType) IsPtrShaped ¶
func (t *CompilerType) IsPtrShaped() bool
func (*CompilerType) IsSigned ¶
func (t *CompilerType) IsSigned() bool
func (*CompilerType) IsSlice ¶
func (t *CompilerType) IsSlice() bool
func (*CompilerType) IsString ¶
func (t *CompilerType) IsString() bool
func (*CompilerType) IsStruct ¶
func (t *CompilerType) IsStruct() bool
func (*CompilerType) IsVoid ¶
func (t *CompilerType) IsVoid() bool
func (*CompilerType) NumElem ¶
func (t *CompilerType) NumElem() int64
func (*CompilerType) NumFields ¶
func (t *CompilerType) NumFields() int
func (*CompilerType) PtrTo ¶
func (t *CompilerType) PtrTo() Type
func (*CompilerType) SimpleString ¶
func (t *CompilerType) SimpleString() string
func (*CompilerType) Size ¶
func (t *CompilerType) Size() int64
func (*CompilerType) String ¶
func (t *CompilerType) String() string
type Config ¶
type Config struct { IntSize int64 // 4 or 8 PtrSize int64 // 4 or 8 HTML *HTMLWriter // html writer, for debugging // contains filtered or unexported fields }
func (*Config) DebugHashMatch ¶
func (*Config) Debug_checknil ¶
func (*Config) NewFunc ¶
NewFunc returns a new, empty function object. Caller must call f.Free() before calling NewFunc again.
func (*Config) Unimplementedf ¶
type ExternSymbol ¶
type ExternSymbol struct { Typ Type // Go type Sym fmt.Stringer // A *gc.Sym referring to a global variable }
ExternSymbol is an aux value that encodes a variable's constant offset from the static base pointer.
func (*ExternSymbol) String ¶
func (s *ExternSymbol) String() string
type Frontend ¶
type Frontend interface { TypeSource Logger // StringData returns a symbol pointing to the given string's contents. StringData(string) interface{} // returns *gc.Sym // Auto returns a Node for an auto variable of the given type. // The SSA compiler uses this function to allocate space for spills. Auto(Type) GCNode // Given the name for a compound type, returns the name we should use // for the parts of that compound type. SplitString(LocalSlot) (LocalSlot, LocalSlot) SplitInterface(LocalSlot) (LocalSlot, LocalSlot) SplitSlice(LocalSlot) (LocalSlot, LocalSlot, LocalSlot) SplitComplex(LocalSlot) (LocalSlot, LocalSlot) SplitStruct(LocalSlot, int) LocalSlot // Line returns a string describing the given line number. Line(int32) string }
type Func ¶
type Func struct { Config *Config // architecture information Name string // e.g. bytes·Compare Type Type // type signature of the function. StaticData interface{} // associated static data, untouched by the ssa package Blocks []*Block // unordered set of all basic blocks (note: not indexable by ID) Entry *Block // the entry basic block // when register allocation is done, maps value ids to locations RegAlloc []Location // map from LocalSlot to set of Values that we want to store in that slot. NamedValues map[LocalSlot][]*Value // Names is a copy of NamedValues.Keys. We keep a separate list // of keys to make iteration order deterministic. Names []LocalSlot // contains filtered or unexported fields }
A Func represents a Go func declaration (or function literal) and its body. This package compiles each Func independently.
func (*Func) NewBlock ¶
newBlock allocates a new Block of the given kind and places it at the end of f.Blocks.
func (*Func) Unimplementedf ¶
type GCNode ¶
interface used to hold *gc.Node. We'd use *gc.Node directly but that would lead to an import cycle.
type GCSym ¶
GCSym is an interface that *gc.Sym implements. Using *gc.Sym directly would lead to import cycles.
type HTMLWriter ¶
func NewHTMLWriter ¶
func NewHTMLWriter(path string, logger Logger, funcname string) *HTMLWriter
func (*HTMLWriter) Close ¶
func (w *HTMLWriter) Close()
func (*HTMLWriter) Printf ¶
func (w *HTMLWriter) Printf(msg string, v ...interface{})
func (*HTMLWriter) WriteColumn ¶
func (w *HTMLWriter) WriteColumn(title string, html string)
WriteColumn writes raw HTML in a column headed by title. It is intended for pre- and post-compilation log output.
func (*HTMLWriter) WriteFunc ¶
func (w *HTMLWriter) WriteFunc(title string, f *Func)
WriteFunc writes f in a column headed by title.
func (*HTMLWriter) WriteString ¶
func (w *HTMLWriter) WriteString(s string)
type LocalSlot ¶
type LocalSlot struct { N GCNode // an ONAME *gc.Node representing a variable on the stack Type Type // type of slot Off int64 // offset of slot in N }
A LocalSlot is a location in the stack frame. It is (possibly a subpiece of) a PPARAM, PPARAMOUT, or PAUTO ONAME node.
type Location ¶
type Location interface {
Name() string // name to use in assembly templates: %rax, 16(%rsp), ...
}
A place that an ssa variable can reside.
type Logger ¶
type Logger interface { // Logf logs a message from the compiler. Logf(string, ...interface{}) // Log returns true if logging is not a no-op // some logging calls account for more than a few heap allocations. Log() bool // Fatal reports a compiler error and exits. Fatalf(line int32, msg string, args ...interface{}) // Unimplemented reports that the function cannot be compiled. // It will be removed once SSA work is complete. Unimplementedf(line int32, msg string, args ...interface{}) // Warnl writes compiler messages in the form expected by "errorcheck" tests Warnl(line int32, fmt_ string, args ...interface{}) // Fowards the Debug_checknil flag from gc Debug_checknil() bool }
type Op ¶
type Op int32
An Op encodes the specific operation that a Value performs. Opcodes' semantics can be modified by the type and aux fields of the Value. For instance, OpAdd can be 32 or 64 bit, signed or unsigned, float or complex, depending on Value.Type. Semantics of each op are described in the opcode files in gen/*Ops.go. There is one file for generic (architecture-independent) ops and one file for each architecture.
const ( OpInvalid Op = iota OpAMD64ADDSS OpAMD64ADDSD OpAMD64SUBSS OpAMD64SUBSD OpAMD64MULSS OpAMD64MULSD OpAMD64DIVSS OpAMD64DIVSD OpAMD64MOVSSload OpAMD64MOVSDload OpAMD64MOVSSconst OpAMD64MOVSDconst OpAMD64MOVSSloadidx1 OpAMD64MOVSSloadidx4 OpAMD64MOVSDloadidx1 OpAMD64MOVSDloadidx8 OpAMD64MOVSSstore OpAMD64MOVSDstore OpAMD64MOVSSstoreidx1 OpAMD64MOVSSstoreidx4 OpAMD64MOVSDstoreidx1 OpAMD64MOVSDstoreidx8 OpAMD64ADDQ OpAMD64ADDL OpAMD64ADDW OpAMD64ADDB OpAMD64ADDQconst OpAMD64ADDLconst OpAMD64ADDWconst OpAMD64ADDBconst OpAMD64SUBQ OpAMD64SUBL OpAMD64SUBW OpAMD64SUBB OpAMD64SUBQconst OpAMD64SUBLconst OpAMD64SUBWconst OpAMD64SUBBconst OpAMD64MULQ OpAMD64MULL OpAMD64MULW OpAMD64MULB OpAMD64MULQconst OpAMD64MULLconst OpAMD64MULWconst OpAMD64MULBconst OpAMD64HMULQ OpAMD64HMULL OpAMD64HMULW OpAMD64HMULB OpAMD64HMULQU OpAMD64HMULLU OpAMD64HMULWU OpAMD64HMULBU OpAMD64AVGQU OpAMD64DIVQ OpAMD64DIVL OpAMD64DIVW OpAMD64DIVQU OpAMD64DIVLU OpAMD64DIVWU OpAMD64MODQ OpAMD64MODL OpAMD64MODW OpAMD64MODQU OpAMD64MODLU OpAMD64MODWU OpAMD64ANDQ OpAMD64ANDL OpAMD64ANDW OpAMD64ANDB OpAMD64ANDQconst OpAMD64ANDLconst OpAMD64ANDWconst OpAMD64ANDBconst OpAMD64ORQ OpAMD64ORL OpAMD64ORW OpAMD64ORB OpAMD64ORQconst OpAMD64ORLconst OpAMD64ORWconst OpAMD64ORBconst OpAMD64XORQ OpAMD64XORL OpAMD64XORW OpAMD64XORB OpAMD64XORQconst OpAMD64XORLconst OpAMD64XORWconst OpAMD64XORBconst OpAMD64CMPQ OpAMD64CMPL OpAMD64CMPW OpAMD64CMPB OpAMD64CMPQconst OpAMD64CMPLconst OpAMD64CMPWconst OpAMD64CMPBconst OpAMD64UCOMISS OpAMD64UCOMISD OpAMD64TESTQ OpAMD64TESTL OpAMD64TESTW OpAMD64TESTB OpAMD64TESTQconst OpAMD64TESTLconst OpAMD64TESTWconst OpAMD64TESTBconst OpAMD64SHLQ OpAMD64SHLL OpAMD64SHLW OpAMD64SHLB OpAMD64SHLQconst OpAMD64SHLLconst OpAMD64SHLWconst OpAMD64SHLBconst OpAMD64SHRQ OpAMD64SHRL OpAMD64SHRW OpAMD64SHRB OpAMD64SHRQconst OpAMD64SHRLconst OpAMD64SHRWconst OpAMD64SHRBconst OpAMD64SARQ OpAMD64SARL OpAMD64SARW OpAMD64SARB OpAMD64SARQconst OpAMD64SARLconst OpAMD64SARWconst OpAMD64SARBconst OpAMD64ROLQconst OpAMD64ROLLconst OpAMD64ROLWconst OpAMD64ROLBconst OpAMD64NEGQ OpAMD64NEGL OpAMD64NEGW OpAMD64NEGB OpAMD64NOTQ OpAMD64NOTL OpAMD64NOTW OpAMD64NOTB OpAMD64BSFQ OpAMD64BSFL OpAMD64BSFW OpAMD64BSRQ OpAMD64BSRL OpAMD64BSRW OpAMD64CMOVQEQconst OpAMD64CMOVLEQconst OpAMD64CMOVWEQconst OpAMD64CMOVQNEconst OpAMD64CMOVLNEconst OpAMD64CMOVWNEconst OpAMD64BSWAPQ OpAMD64BSWAPL OpAMD64SQRTSD OpAMD64SBBQcarrymask OpAMD64SBBLcarrymask OpAMD64SETEQ OpAMD64SETNE OpAMD64SETL OpAMD64SETLE OpAMD64SETG OpAMD64SETGE OpAMD64SETB OpAMD64SETBE OpAMD64SETA OpAMD64SETAE OpAMD64SETEQF OpAMD64SETNEF OpAMD64SETORD OpAMD64SETNAN OpAMD64SETGF OpAMD64SETGEF OpAMD64MOVBQSX OpAMD64MOVBQZX OpAMD64MOVWQSX OpAMD64MOVWQZX OpAMD64MOVLQSX OpAMD64MOVLQZX OpAMD64MOVBconst OpAMD64MOVWconst OpAMD64MOVLconst OpAMD64MOVQconst OpAMD64CVTTSD2SL OpAMD64CVTTSD2SQ OpAMD64CVTTSS2SL OpAMD64CVTTSS2SQ OpAMD64CVTSL2SS OpAMD64CVTSL2SD OpAMD64CVTSQ2SS OpAMD64CVTSQ2SD OpAMD64CVTSD2SS OpAMD64CVTSS2SD OpAMD64PXOR OpAMD64LEAQ OpAMD64LEAQ1 OpAMD64LEAQ2 OpAMD64LEAQ4 OpAMD64LEAQ8 OpAMD64MOVBload OpAMD64MOVBQSXload OpAMD64MOVWload OpAMD64MOVWQSXload OpAMD64MOVLload OpAMD64MOVLQSXload OpAMD64MOVQload OpAMD64MOVBstore OpAMD64MOVWstore OpAMD64MOVLstore OpAMD64MOVQstore OpAMD64MOVOload OpAMD64MOVOstore OpAMD64MOVBloadidx1 OpAMD64MOVWloadidx1 OpAMD64MOVWloadidx2 OpAMD64MOVLloadidx1 OpAMD64MOVLloadidx4 OpAMD64MOVQloadidx1 OpAMD64MOVQloadidx8 OpAMD64MOVBstoreidx1 OpAMD64MOVWstoreidx1 OpAMD64MOVWstoreidx2 OpAMD64MOVLstoreidx1 OpAMD64MOVLstoreidx4 OpAMD64MOVQstoreidx1 OpAMD64MOVQstoreidx8 OpAMD64MOVBstoreconst OpAMD64MOVWstoreconst OpAMD64MOVLstoreconst OpAMD64MOVQstoreconst OpAMD64MOVBstoreconstidx1 OpAMD64MOVWstoreconstidx1 OpAMD64MOVWstoreconstidx2 OpAMD64MOVLstoreconstidx1 OpAMD64MOVLstoreconstidx4 OpAMD64MOVQstoreconstidx1 OpAMD64MOVQstoreconstidx8 OpAMD64DUFFZERO OpAMD64MOVOconst OpAMD64REPSTOSQ OpAMD64CALLstatic OpAMD64CALLclosure OpAMD64CALLdefer OpAMD64CALLgo OpAMD64CALLinter OpAMD64DUFFCOPY OpAMD64REPMOVSQ OpAMD64InvertFlags OpAMD64LoweredGetG OpAMD64LoweredGetClosurePtr OpAMD64LoweredNilCheck OpAMD64MOVQconvert OpAMD64FlagEQ OpAMD64FlagLT_ULT OpAMD64FlagLT_UGT OpAMD64FlagGT_UGT OpAMD64FlagGT_ULT OpARMADD OpARMADDconst OpARMMOVWconst OpARMCMP OpARMMOVWload OpARMMOVWstore OpARMCALLstatic OpARMLessThan OpAdd8 OpAdd16 OpAdd32 OpAdd64 OpAddPtr OpAdd32F OpAdd64F OpSub8 OpSub16 OpSub32 OpSub64 OpSubPtr OpSub32F OpSub64F OpMul8 OpMul16 OpMul32 OpMul64 OpMul32F OpMul64F OpDiv32F OpDiv64F OpHmul8 OpHmul8u OpHmul16 OpHmul16u OpHmul32 OpHmul32u OpHmul64 OpHmul64u OpAvg64u OpDiv8 OpDiv8u OpDiv16 OpDiv16u OpDiv32 OpDiv32u OpDiv64 OpDiv64u OpMod8 OpMod8u OpMod16 OpMod16u OpMod32 OpMod32u OpMod64 OpMod64u OpAnd8 OpAnd16 OpAnd32 OpAnd64 OpOr8 OpOr16 OpOr32 OpOr64 OpXor8 OpXor16 OpXor32 OpXor64 OpLsh8x8 OpLsh8x16 OpLsh8x32 OpLsh8x64 OpLsh16x8 OpLsh16x16 OpLsh16x32 OpLsh16x64 OpLsh32x8 OpLsh32x16 OpLsh32x32 OpLsh32x64 OpLsh64x8 OpLsh64x16 OpLsh64x32 OpLsh64x64 OpRsh8x8 OpRsh8x16 OpRsh8x32 OpRsh8x64 OpRsh16x8 OpRsh16x16 OpRsh16x32 OpRsh16x64 OpRsh32x8 OpRsh32x16 OpRsh32x32 OpRsh32x64 OpRsh64x8 OpRsh64x16 OpRsh64x32 OpRsh64x64 OpRsh8Ux8 OpRsh8Ux16 OpRsh8Ux32 OpRsh8Ux64 OpRsh16Ux8 OpRsh16Ux16 OpRsh16Ux32 OpRsh16Ux64 OpRsh32Ux8 OpRsh32Ux16 OpRsh32Ux32 OpRsh32Ux64 OpRsh64Ux8 OpRsh64Ux16 OpRsh64Ux32 OpRsh64Ux64 OpLrot8 OpLrot16 OpLrot32 OpLrot64 OpEq8 OpEq16 OpEq32 OpEq64 OpEqPtr OpEqInter OpEqSlice OpEq32F OpEq64F OpNeq8 OpNeq16 OpNeq32 OpNeq64 OpNeqPtr OpNeqInter OpNeqSlice OpNeq32F OpNeq64F OpLess8 OpLess8U OpLess16 OpLess16U OpLess32 OpLess32U OpLess64 OpLess64U OpLess32F OpLess64F OpLeq8 OpLeq8U OpLeq16 OpLeq16U OpLeq32 OpLeq32U OpLeq64 OpLeq64U OpLeq32F OpLeq64F OpGreater8 OpGreater8U OpGreater16 OpGreater16U OpGreater32 OpGreater32U OpGreater64 OpGreater64U OpGreater32F OpGreater64F OpGeq8 OpGeq8U OpGeq16 OpGeq16U OpGeq32 OpGeq32U OpGeq64 OpGeq64U OpGeq32F OpGeq64F OpNot OpNeg8 OpNeg16 OpNeg32 OpNeg64 OpNeg32F OpNeg64F OpCom8 OpCom16 OpCom32 OpCom64 OpCtz16 OpCtz32 OpCtz64 OpClz16 OpClz32 OpClz64 OpBswap32 OpBswap64 OpSqrt OpPhi OpCopy OpConvert OpConstBool OpConstString OpConstNil OpConst8 OpConst16 OpConst32 OpConst64 OpConst32F OpConst64F OpConstInterface OpConstSlice OpInitMem OpArg OpAddr OpSP OpSB OpFunc OpLoad OpStore OpMove OpZero OpClosureCall OpStaticCall OpDeferCall OpGoCall OpInterCall OpSignExt8to16 OpSignExt8to32 OpSignExt8to64 OpSignExt16to32 OpSignExt16to64 OpSignExt32to64 OpZeroExt8to16 OpZeroExt8to32 OpZeroExt8to64 OpZeroExt16to32 OpZeroExt16to64 OpZeroExt32to64 OpTrunc16to8 OpTrunc32to8 OpTrunc32to16 OpTrunc64to8 OpTrunc64to16 OpTrunc64to32 OpCvt32to32F OpCvt32to64F OpCvt64to32F OpCvt64to64F OpCvt32Fto32 OpCvt32Fto64 OpCvt64Fto32 OpCvt64Fto64 OpCvt32Fto64F OpCvt64Fto32F OpIsNonNil OpIsInBounds OpIsSliceInBounds OpNilCheck OpGetG OpGetClosurePtr OpArrayIndex OpPtrIndex OpOffPtr OpSliceMake OpSlicePtr OpSliceLen OpSliceCap OpComplexMake OpComplexReal OpComplexImag OpStringMake OpStringPtr OpStringLen OpIMake OpITab OpIData OpStructMake0 OpStructMake1 OpStructMake2 OpStructMake3 OpStructMake4 OpStructSelect OpStoreReg OpLoadReg OpFwdRef OpUnknown OpVarDef OpVarKill OpVarLive )
func StructMakeOp ¶
StructMakeOp returns the opcode to construct a struct with the given number of fields.
type Register ¶
type Register struct { Num int32 // contains filtered or unexported fields }
A Register is a machine register, like %rax. They are numbered densely from 0 (for each architecture).
type Type ¶
type Type interface { Size() int64 // return the size in bytes Alignment() int64 IsBoolean() bool // is a named or unnamed boolean type IsInteger() bool // ... ditto for the others IsSigned() bool IsFloat() bool IsComplex() bool IsPtrShaped() bool IsString() bool IsSlice() bool IsArray() bool IsStruct() bool IsInterface() bool IsMemory() bool // special ssa-package-only types IsFlags() bool IsVoid() bool ElemType() Type // given []T or *T or [n]T, return T PtrTo() Type // given T, return *T NumFields() int // # of fields of a struct FieldType(i int) Type // type of ith field of the struct FieldOff(i int) int64 // offset of ith field of the struct FieldName(i int) string // name of ith field of the struct NumElem() int64 // # of elements of an array String() string SimpleString() string // a coarser generic description of T, e.g. T's underlying type Equal(Type) bool Compare(Type) Cmp // compare types, returning one of CMPlt, CMPeq, CMPgt. }
A type interface used to import cmd/internal/gc:Type Type instances are not guaranteed to be canonical.
type TypeSource ¶
type TypeSource interface { TypeBool() Type TypeInt8() Type TypeInt16() Type TypeInt32() Type TypeInt64() Type TypeUInt8() Type TypeUInt16() Type TypeUInt32() Type TypeUInt64() Type TypeInt() Type TypeFloat32() Type TypeFloat64() Type TypeUintptr() Type TypeString() Type TypeBytePtr() Type // TODO: use unsafe.Pointer instead? CanSSA(t Type) bool }
type ValAndOff ¶
type ValAndOff int64
A ValAndOff is used by the several opcodes. It holds both a value and a pointer offset. A ValAndOff is intended to be encoded into an AuxInt field. The zero ValAndOff encodes a value of 0 and an offset of 0. The high 32 bits hold a value. The low 32 bits hold a pointer offset.
type Value ¶
type Value struct { // A unique identifier for the value. For performance we allocate these IDs // densely starting at 1. There is no guarantee that there won't be occasional holes, though. ID ID // The operation that computes this value. See op.go. Op Op // The type of this value. Normally this will be a Go type, but there // are a few other pseudo-types, see type.go. Type Type // Auxiliary info for this value. The type of this information depends on the opcode and type. // AuxInt is used for integer values, Aux is used for other values. AuxInt int64 Aux interface{} // Arguments of this value Args []*Value // Containing basic block Block *Block // Source line number Line int32 // Use count. Each appearance in Value.Args and Block.Control counts once. Uses int32 // contains filtered or unexported fields }
A Value represents a value in the SSA representation of the program. The ID and Type fields must not be modified. The remainder may be modified if they preserve the value of the Value (e.g. changing a (mul 2 x) to an (add x x)).
func (*Value) AuxValAndOff ¶
func (*Value) LongString ¶
long form print. v# = opcode <type> [aux] args [: reg]
func (*Value) Unimplementedf ¶
Source Files ¶
- block.go
- check.go
- checkbce.go
- compile.go
- config.go
- copyelim.go
- critical.go
- cse.go
- deadcode.go
- deadstore.go
- decompose.go
- dom.go
- flagalloc.go
- func.go
- fuse.go
- html.go
- id.go
- layout.go
- likelyadjust.go
- location.go
- loopbce.go
- lower.go
- magic.go
- nilcheck.go
- op.go
- opGen.go
- opt.go
- phielim.go
- phiopt.go
- print.go
- prove.go
- regalloc.go
- rewrite.go
- rewriteAMD64.go
- rewriteARM.go
- rewritedec.go
- rewritegeneric.go
- schedule.go
- shortcircuit.go
- sparsemap.go
- sparseset.go
- sparsetree.go
- stackalloc.go
- tighten.go
- trim.go
- type.go
- value.go
- zcse.go