Documentation ¶
Overview ¶
Package qbe deals with the QBE intermediate language
QBE intermediate language introduction:
https://c9x.me/compile/
QBE reference:
https://c9x.me/compile/doc/il.html
QBE vs LLVM:
https://c9x.me/compile/doc/llvm.html
Build status ¶
Available at https://modern-c.appspot.com/-/builder/?importpath=modernc.org%2fqbe
Limitations ¶
The environmental function parameter/argument, as defined at
https://c9x.me/compile/doc/il.html#Functions
is not supported.
Index ¶
- Constants
- Variables
- func Version() string
- type AST
- type Add
- type Alloc16
- type Alloc4
- type Alloc8
- type And
- type ArrayField
- type Binary
- type Block
- type CFGNode
- type CST
- type CSTAdd
- type CSTAlloc
- type CSTAnd
- type CSTBinaryOperands
- type CSTBlock
- type CSTCall
- type CSTCast
- type CSTCmp
- type CSTCopy
- type CSTDataDef
- type CSTDataItemConst
- type CSTDataItemGlobal
- type CSTDataItemString
- type CSTDataItemZero
- type CSTDataItems
- type CSTDeclare
- type CSTDiv
- type CSTDtosi
- type CSTDtoui
- type CSTEnvArg
- type CSTEnvParam
- type CSTExt
- type CSTField
- type CSTFields
- type CSTFloat32Lit
- type CSTFloat64Lit
- type CSTFuncDef
- type CSTInstPreamble
- type CSTIntConst
- type CSTJmp
- type CSTJnz
- type CSTLdtosi
- type CSTLdtoui
- type CSTLoad
- type CSTLongDoubleLit
- type CSTMul
- type CSTOr
- type CSTPhi
- type CSTPhiArg
- type CSTRegularArg
- type CSTRegularParam
- type CSTRem
- type CSTRet
- type CSTSar
- type CSTShl
- type CSTShr
- type CSTSltof
- type CSTStore
- type CSTStosi
- type CSTStoui
- type CSTSub
- type CSTSwtof
- type CSTToken
- type CSTTruncd
- type CSTTruncld
- type CSTTypeDef
- type CSTUdiv
- type CSTUltof
- type CSTUrem
- type CSTUwtof
- type CSTVaArg
- type CSTVaStart
- type CSTVariadicMarker
- type CSTXor
- type Call
- type Cast
- type Ceqd
- type Ceql
- type Ceqld
- type Ceqs
- type Ceqw
- type Cged
- type Cgeld
- type Cges
- type Cgtd
- type Cgtld
- type Cgts
- type Ch
- type CharPointer
- type Cled
- type Cleld
- type Cles
- type Cltd
- type Cltld
- type Clts
- type Cned
- type Cnel
- type Cneld
- type Cnes
- type Cnew
- type Cod
- type Copy
- type Cos
- type Csgel
- type Csgew
- type Csgtl
- type Csgtw
- type Cslel
- type Cslew
- type Csltl
- type Csltw
- type Cugel
- type Cugew
- type Cugtl
- type Cugtw
- type Culel
- type Culew
- type Cultl
- type Cultw
- type Cuod
- type Cuos
- type DataDef
- type Declare
- type Div
- type Dtosi
- type Dtoui
- type EnvArg
- type EnvParameter
- type Extd
- type Exts
- type Extsb
- type Extsh
- type Extsw
- type Extub
- type Extuh
- type Extuw
- type Field
- type Float32
- type Float32Initializer
- type Float32Lit
- type Float64
- type Float64Initializer
- type Float64Lit
- type FuncDef
- type Global
- type GlobalInitializer
- type InstPreamble
- type Int16
- type Int32
- type Int64
- type Int8
- type IntInitializer
- type IntLit
- type Jmp
- type Jnz
- type Label
- type Ldtosi
- type Ldtoui
- type Loadd
- type Loadl
- type Loadld
- type Loads
- type Loadsb
- type Loadsh
- type Loadsw
- type Loadub
- type Loaduh
- type Loaduw
- type Local
- type LocalInfo
- type LongDouble
- type LongDoubleLit
- type LongDoubleLitInitializer
- type MapInfo
- type Mul
- type Name
- type Node
- type Or
- type Phi
- type PhiArg
- type RegularArg
- type RegularParameter
- type Rem
- type Ret
- type Sar
- type Scanner
- type Scope
- type Shl
- type Shr
- type Sltof
- type Storeb
- type Stored
- type Storeh
- type Storel
- type Storeld
- type Stores
- type Storew
- type Stosi
- type Stoui
- type StringInitializer
- type StringLit
- type StructField
- type Sub
- type Swtof
- type Task
- type Token
- type Truncd
- type Truncld
- type Type
- type TypeDef
- type TypeName
- type Udiv
- type Ultof
- type UnionField
- type Urem
- type Uwtof
- type VaArg
- type VaInfo
- type VaStart
- type VoidCall
- type VoidPointer
- type Xor
- type ZeroInitializer
Constants ¶
const ( // Reserved ABI type name that maps to C va_list. For example // // A C function // // int vprintf(const char *format, va_list ap); // // can become a QBE function // // export function w vprintf(l format, :__qbe_va_list ap) { ... } VaList = "__qbe_va_list" // Reserved ABI type name that maps to C *va_list. For example // // A C function // // void foo(va_list *ap); // // can become a QBE function // // export function foo(:__qbe_va_listp ap) { ... } VaListPtr = "__qbe_va_listp" )
Variables ¶
var Keywords = map[string]Ch{}/* 124 elements not displayed */
Keywords represents the mapping of identifiers to QBE's reserved names.
var ( // TraceC enables printing the generated C code to stdout. TraceC bool // testing )
Functions ¶
Types ¶
type AST ¶
type AST struct { Defs []Node // A FuncDef, DataDef of a TypeDef. EOF Token ExternData map[string]struct{} // Referenced but not defined. ExternFuncs map[string]Type // Called but not defined. The value is the result type or nil if void. Funcs map[string]Type // Defined functions. The value is the result type or nil if void. Scope Scope // contains filtered or unexported fields }
AST represents the abstract syntax tree.
func (*AST) C ¶ added in v0.0.2
C renders an AST as the body of compilable C code prepended with includes.
func (*AST) FirstSeparator ¶ added in v0.0.4
FirstSeparator reports the white space and comments preceding first token. The result must not be modified.
type Add ¶ added in v0.0.2
type Add struct { InstPreamble Binary }
Add represents the 'add' instruction.
type Alloc16 ¶ added in v0.0.2
type Alloc16 struct { InstPreamble Value Node }
Alloc16 represents the 'alloc16' instruction.
type Alloc4 ¶ added in v0.0.2
type Alloc4 struct { InstPreamble Value Node }
Alloc4 represents the 'alloc4' instruction.
type Alloc8 ¶ added in v0.0.2
type Alloc8 struct { InstPreamble Value Node }
Alloc8 represents the 'alloc8' instruction.
type And ¶ added in v0.0.2
type And struct { InstPreamble Binary }
And represents the 'and' instruction.
type ArrayField ¶ added in v0.0.2
ArrayField represents an array-shaped field.
type Block ¶
type Block struct { Label // @name Phis []*Phi Insts []Node // Jmp, Jnz, Ret or nil indicating fallthrough into the lexically following block. Jump Node // contains filtered or unexported fields }
Block is a linear piece of QBE code with a single entry point and a single exit point.
type CFGNode ¶ added in v0.0.8
type CFGNode struct { *Block In []*CFGNode // In[x] -> this node. Empty for entry block. Out1 *CFGNode // This node -> Out1. Can be nil. Out2 *CFGNode // This node -> Out2. Can be non-nil only if Out1 is non-nil. }
CFGNode is a node of a control-flow graph.
type CST ¶ added in v0.0.2
CST represents the complete syntax tree. It contains all the tokens of the input. The original source, or any part of it can be reconstructed from the CST or some part of it, including the original whitespace/comments.
func Parse ¶
Parse produces a CST or an error, of any. Positions are reported as if buf is coming from a file named name. The buffer becomes owned by the CST and must not be modified after calling Parse.
func (*CST) FirstSeparator ¶ added in v0.0.4
FirstSeparator reports the white space and comments preceding first token. The result must not be modified.
type CSTAdd ¶ added in v0.0.2
type CSTAdd struct { CSTInstPreamble CSTBinaryOperands }
CSTAdd is a CST node for the add instruction.
type CSTAlloc ¶ added in v0.0.2
type CSTAlloc struct { CSTInstPreamble Val Node }
CSTAlloc is a CST node for the various alloc* instructions.
type CSTAnd ¶ added in v0.0.2
type CSTAnd struct { CSTInstPreamble CSTBinaryOperands }
CSTAnd is a CST node for the and instruction.
type CSTBinaryOperands ¶ added in v0.0.2
CSTBinaryOperands represents the operands of a binary operation.
type CSTBlock ¶ added in v0.0.2
CSTBlock is a CST node for:
BLOCK := @IDENT # Block label PHI* # Phi instructions INST* # Regular instructions JUMP # Jump or return
type CSTCall ¶ added in v0.0.2
type CSTCall struct { CSTInstPreamble Val Node LParen CSTToken Args []Node RParen CSTToken }
CSTCall is a CST node for the call instruction.
CALL := [%IDENT '=' ABITY] 'call' VAL '(' (ARG), ')'
type CSTCast ¶ added in v0.0.2
type CSTCast struct { CSTInstPreamble Val Node }
CSTCast is a CST node for the cast instruction.
type CSTCmp ¶ added in v0.0.2
type CSTCmp struct { CSTInstPreamble CSTBinaryOperands }
CSTCmp is a CST node for the various cmp* instructions.
type CSTCopy ¶ added in v0.0.2
type CSTCopy struct { CSTInstPreamble Val Node }
CSTCopy is a CST node for the copy instruction.
type CSTDataDef ¶ added in v0.0.2
type CSTDataDef struct { Export CSTToken RO CSTToken Data CSTToken Global CSTToken Eq CSTToken Align CSTToken Number CSTToken LBrace CSTToken Items []Node RBrace CSTToken Attributes []string }
CSTDataDef is a CST node for:
DATADEF := ['export'] ['ro'] 'data' $IDENT '=' ['align' NUMBER] '{' ( EXTTY DATAITEM+ | 'z' NUMBER ), '}';
func (*CSTDataDef) Position ¶ added in v0.0.2
func (n *CSTDataDef) Position() token.Position
Position implements Node.
type CSTDataItemConst ¶ added in v0.0.2
CSTDataItemConst represents a CST node for a numeric/pointer initializer.
func (*CSTDataItemConst) Position ¶ added in v0.0.2
func (n *CSTDataItemConst) Position() token.Position
Position implements Node.
type CSTDataItemGlobal ¶ added in v0.0.2
CSTDataItemGlobal is a CST node for an address of a global with optional offset.
func (*CSTDataItemGlobal) Position ¶ added in v0.0.2
func (n *CSTDataItemGlobal) Position() token.Position
Position implements Node.
type CSTDataItemString ¶ added in v0.0.2
CSTDataItemString represents a CST node for a string literal data initializer.
func (*CSTDataItemString) Position ¶ added in v0.0.2
func (n *CSTDataItemString) Position() token.Position
Position implements Node.
type CSTDataItemZero ¶ added in v0.0.2
CSTDataItemZero is a CST node for zero data item of a data definition.
func (*CSTDataItemZero) Position ¶ added in v0.0.2
func (n *CSTDataItemZero) Position() token.Position
Position implements Node.
type CSTDataItems ¶ added in v0.0.2
type CSTDataItems struct {
Items []Node
}
CSTDataItems is a CST node for the data items of a data definition.
func (CSTDataItems) Position ¶ added in v0.0.2
func (n CSTDataItems) Position() token.Position
Position implements Node.
type CSTDeclare ¶ added in v0.0.7
type CSTDeclare struct {
CSTInstPreamble
}
CSTDeclare is a CST node for the declare instruction.
type CSTDiv ¶ added in v0.0.2
type CSTDiv struct { CSTInstPreamble CSTBinaryOperands }
CSTDiv is a CST node for the div instruction.
type CSTDtosi ¶ added in v0.0.2
type CSTDtosi struct { CSTInstPreamble Val Node }
CSTDtosi is a CST node for the dtosi instruction.
type CSTDtoui ¶ added in v0.0.6
type CSTDtoui struct { CSTInstPreamble Val Node }
CSTDtoui is a CST node for the dtoui instruction.
type CSTEnvArg ¶ added in v0.0.2
CSTEnvArg is a CST node for a environment argument of a call instruction.
| 'env' VAL # Environment argument (first)
type CSTEnvParam ¶ added in v0.0.2
CSTEnvParam is a CST node for the environment parameter of a function definition.
| 'env' %IDENT # Environment parameter (first)
func (*CSTEnvParam) Position ¶ added in v0.0.2
func (n *CSTEnvParam) Position() token.Position
Position implements Node.
type CSTExt ¶ added in v0.0.2
type CSTExt struct { CSTInstPreamble Val Node }
CSTExt is a CST node for the various ext* instructions.
type CSTFloat32Lit ¶ added in v0.0.2
type CSTFloat32Lit CSTToken
CSTFloat32Lit is a CST node for a float32 literal.
func (CSTFloat32Lit) Position ¶ added in v0.0.2
func (n CSTFloat32Lit) Position() token.Position
Position implements Node.
type CSTFloat64Lit ¶ added in v0.0.2
type CSTFloat64Lit CSTToken
CSTFloat64Lit is a CST node for a float64 literal.
func (CSTFloat64Lit) Position ¶ added in v0.0.2
func (n CSTFloat64Lit) Position() token.Position
Position implements Node.
type CSTFuncDef ¶ added in v0.0.2
type CSTFuncDef struct { Export CSTToken Function CSTToken ABIType CSTToken Global CSTToken LParen CSTToken Params []Node RParen CSTToken LBrace CSTToken Blocks []*CSTBlock RBrace CSTToken Map map[string]*MapInfo Attributes []string }
CSTFuncDef is a CST node for:
FUNCDEF := ['export'] 'function' [ABITY] $IDENT '(' (PARAM), ')' '{' BLOCK+ '}'
func (*CSTFuncDef) Position ¶ added in v0.0.2
func (n *CSTFuncDef) Position() token.Position
Position implements Node.
type CSTInstPreamble ¶ added in v0.0.2
CSTInstPreamble represents the common part of a 3-address instruction.
func (*CSTInstPreamble) Position ¶ added in v0.0.2
func (n *CSTInstPreamble) Position() token.Position
Position implements Node.
type CSTIntConst ¶ added in v0.0.2
CSTIntConst is a CST node for a integer literal with an optional negative sign.
func (*CSTIntConst) Position ¶ added in v0.0.2
func (n *CSTIntConst) Position() token.Position
Position implements Node.
type CSTJnz ¶ added in v0.0.2
type CSTJnz struct { Inst CSTToken Val Node Comma CSTToken LabelNZ CSTToken Comma2 CSTToken LabelZ CSTToken }
CSTJnz is a CST node for the jnz instruction.
type CSTLdtosi ¶ added in v0.0.6
type CSTLdtosi struct { CSTInstPreamble Val Node }
CSTLdtosi is a CST node for the ldtosi instruction.
type CSTLdtoui ¶ added in v0.0.6
type CSTLdtoui struct { CSTInstPreamble Val Node }
CSTLdtoui is a CST node for the ldtoui instruction.
type CSTLoad ¶ added in v0.0.2
type CSTLoad struct { CSTInstPreamble Val Node }
CSTLoad is a CST node for the various load* instructions.
type CSTLongDoubleLit ¶ added in v0.0.6
type CSTLongDoubleLit CSTToken
CSTLongDoubleLit is a CST node for a long double literal.
func (CSTLongDoubleLit) Position ¶ added in v0.0.6
func (n CSTLongDoubleLit) Position() token.Position
Position implements Node.
type CSTMul ¶ added in v0.0.4
type CSTMul struct { CSTInstPreamble CSTBinaryOperands }
CSTMul is a CST node for the mul instruction.
type CSTOr ¶ added in v0.0.2
type CSTOr struct { CSTInstPreamble CSTBinaryOperands }
CSTOr is a CST node for the or instruction.
type CSTPhi ¶ added in v0.0.2
type CSTPhi struct { CSTInstPreamble Args []CSTPhiArg }
CSTPhi is a CST node for the CSTPhi instruction.
PHI := %IDENT '=' BASETY 'phi' ( @IDENT VAL ),
type CSTRegularArg ¶ added in v0.0.2
CSTRegularArg is a CST node for a regular argument of a call instruction.
ABITY VAL # Regular argument
func (*CSTRegularArg) Position ¶ added in v0.0.2
func (n *CSTRegularArg) Position() token.Position
Position implements Node.
type CSTRegularParam ¶ added in v0.0.2
CSTRegularParam is a CST node for a regular parameter of a function definition.
ABITY %IDENT # Regular parameter
func (*CSTRegularParam) Position ¶ added in v0.0.2
func (n *CSTRegularParam) Position() token.Position
Position implements Node.
type CSTRem ¶ added in v0.0.2
type CSTRem struct { CSTInstPreamble CSTBinaryOperands }
CSTRem is a CST node for the rem instruction.
type CSTRet ¶ added in v0.0.2
CSTRet is a CST node for the ret instruction with an optional return value.
type CSTSar ¶ added in v0.0.2
type CSTSar struct { CSTInstPreamble CSTBinaryOperands }
CSTSar is a CST node for the sar instruction.
type CSTShl ¶ added in v0.0.2
type CSTShl struct { CSTInstPreamble CSTBinaryOperands }
CSTShl is a CST node for the shl instruction.
type CSTShr ¶ added in v0.0.2
type CSTShr struct { CSTInstPreamble CSTBinaryOperands }
CSTShr is a CST node for the shr instruction.
type CSTSltof ¶ added in v0.0.2
type CSTSltof struct { CSTInstPreamble Val Node }
CSTSltof is a CST node for the sltof instruction.
type CSTStosi ¶ added in v0.0.2
type CSTStosi struct { CSTInstPreamble Val Node }
CSTStosi is a CST node for the stosi instruction.
type CSTStoui ¶ added in v0.0.6
type CSTStoui struct { CSTInstPreamble Val Node }
CSTStoui is a CST node for the stoui instruction.
type CSTSub ¶ added in v0.0.2
type CSTSub struct { CSTInstPreamble CSTBinaryOperands }
CSTSub is a CST node for the sub instruction.
type CSTSwtof ¶ added in v0.0.2
type CSTSwtof struct { CSTInstPreamble Val Node }
CSTSwtof is a CST node for the swtof instruction.
type CSTToken ¶ added in v0.0.2
type CSTToken struct { Ch // contains filtered or unexported fields }
CSTToken is the product of Scanner.Scan and a terminal node of the complete syntax tree.
func (*CSTToken) IsValid ¶ added in v0.0.2
IsValid reports the validity of n. Tokens not present in some nodes will report false.
func (*CSTToken) Offset ¶ added in v0.0.2
Offset reports the offset of n, in bytes, within the source buffer.
func (*CSTToken) Sep ¶ added in v0.0.2
Sep reports the whitespace preceding n, if any. The result is read only.
func (*CSTToken) SepOffset ¶ added in v0.0.2
SepOffset reports the offset of n's preceding white space, if any, in bytes, within the source buffer.
type CSTTruncd ¶ added in v0.0.2
type CSTTruncd struct { CSTInstPreamble Val Node }
CSTTruncd is a CST node for the truncd instruction.
type CSTTruncld ¶ added in v0.0.6
type CSTTruncld struct { CSTInstPreamble Val Node }
CSTTruncld is a CST node for the truncld instruction.
type CSTTypeDef ¶ added in v0.0.2
type CSTTypeDef struct { Type CSTToken Name CSTToken Eq CSTToken Align CSTToken Number CSTToken Fields *CSTFields }
CSTTypeDef is a CST node for:
TYPEDEF := # Regular type 'type' :IDENT '=' ['align' NUMBER] '{' ( SUBTY [NUMBER] ), '}' | # Opaque type 'type' :IDENT '=' 'align' NUMBER '{' NUMBER '}' SUBTY := EXTTY | :IDENT
func (*CSTTypeDef) Position ¶ added in v0.0.2
func (n *CSTTypeDef) Position() token.Position
Position implements Node.
type CSTUdiv ¶ added in v0.0.2
type CSTUdiv struct { CSTInstPreamble CSTBinaryOperands }
CSTUdiv is a CST node for the udiv instruction.
type CSTUltof ¶ added in v0.0.4
type CSTUltof struct { CSTInstPreamble Val Node }
CSTUltof is a CST node for the ultof instruction.
type CSTUrem ¶ added in v0.0.2
type CSTUrem struct { CSTInstPreamble CSTBinaryOperands }
CSTUrem is a CST node for the urem instruction.
type CSTUwtof ¶ added in v0.0.4
type CSTUwtof struct { CSTInstPreamble Val Node }
CSTUwtof is a CST node for the uwtof instruction.
type CSTVaArg ¶ added in v0.0.2
type CSTVaArg struct { CSTInstPreamble Val Node }
CSTVaArg is a CST node for the vaarg instruction.
type CSTVaStart ¶ added in v0.0.2
CSTVaStart is a CST node for the vastart instruction.
func (*CSTVaStart) Position ¶ added in v0.0.2
func (n *CSTVaStart) Position() token.Position
Position implements Node.
type CSTVariadicMarker ¶ added in v0.0.2
CSTVariadicMarker is a CST node for a variadic argument of a call instruction.
| '...' # Variadic marker (last)
func (*CSTVariadicMarker) Position ¶ added in v0.0.2
func (n *CSTVariadicMarker) Position() token.Position
Position implements Node.
type CSTXor ¶ added in v0.0.2
type CSTXor struct { CSTInstPreamble CSTBinaryOperands }
CSTXor is a CST node for the xor instruction.
type Call ¶ added in v0.0.2
type Call struct { InstPreamble VoidCall }
Call represents a call of a non-void function.
type Cast ¶ added in v0.0.2
type Cast struct { InstPreamble Value Node }
Cast represents the 'cast' instruction.
type Ceqd ¶ added in v0.0.2
type Ceqd struct { InstPreamble Binary }
Ceqd represents the 'ceqd' instruction.
type Ceql ¶ added in v0.0.2
type Ceql struct { InstPreamble Binary }
Ceql represents the 'ceql' instruction.
type Ceqld ¶ added in v0.0.6
type Ceqld struct { InstPreamble Binary }
Ceqld represents the 'ceqld' instruction.
type Ceqs ¶ added in v0.0.2
type Ceqs struct { InstPreamble Binary }
Ceqs represents the 'ceqs' instruction.
type Ceqw ¶ added in v0.0.2
type Ceqw struct { InstPreamble Binary }
Ceqw represents the 'ceqw' instruction.
type Cged ¶ added in v0.0.2
type Cged struct { InstPreamble Binary }
Cged represents the 'cged' instruction.
type Cgeld ¶ added in v0.0.6
type Cgeld struct { InstPreamble Binary }
Cgeld represents the 'cgeld' instruction.
type Cges ¶ added in v0.0.2
type Cges struct { InstPreamble Binary }
Cges represents the 'cges' instruction.
type Cgtd ¶ added in v0.0.2
type Cgtd struct { InstPreamble Binary }
Cgtd represents the 'cgtd' instruction.
type Cgtld ¶ added in v0.0.6
type Cgtld struct { InstPreamble Binary }
Cgtld represents the 'cgtld' instruction.
type Cgts ¶ added in v0.0.2
type Cgts struct { InstPreamble Binary }
Cgts represents the 'cgts' instruction.
type Ch ¶ added in v0.0.2
type Ch rune
Ch represents the lexical value of a CSTToken.
const ( ADD Ch = iota + 0xe000 // add ALIGN // align ALLOC16 // alloc16 ALLOC4 // alloc4 ALLOC8 // alloc8 AND // and B // b C // c CALL // call CAST // cast CEQD // ceqd CEQL // ceql CEQLD // ceqld CEQS // ceqs CEQW // ceqw CGED // cged CGELD // cgeld CGES // cges CGTD // cgtd CGTLD // cgtld CGTS // cgts CLED // cled CLELD // cleld CLES // cles CLTD // cltd CLTLD // cltld CLTS // clts CNED // cned CNEL // cnel CNELD // cneld CNES // cnes CNEW // cnew COD // cod COPY // copy COS // cos CSGEL // csgel CSGEW // csgew CSGTL // csgtl CSGTW // csgtw CSLEL // cslel CSLEW // cslew CSLTL // csltl CSLTW // csltw CUGEL // cugel CUGEW // cugew CUGTL // cugtl CUGTW // cugtw CULEL // culel CULEW // culew CULTL // cultl CULTW // cultw CUOD // cuod CUOS // cuos D // d DATA // data DECLARE // declare DIV // div DTOSI // dtosi DTOUI // dtoui ELLIPSIS // ... ENV // env EXPORT // export EXTD // exts EXTS // exts EXTSB // extsb EXTSH // extsh EXTSW // extsw EXTUB // extub EXTUH // extuh EXTUW // extuw FLOAT32_LIT // float32 literal FLOAT64_LIT // float64 literal FUNCTION // function GLOBAL // global name H // h INT_LIT // integer literal JMP // jmp JNZ // jnz L // l LABEL // label name LD // ld LDTOSI // ldtosi LDTOUI // ldtoui LOAD // load LOADD // loadd LOADL // loadl LOADLD // loadld LOADS // loads LOADSB // loadsb LOADSH // loadsh LOADSW // loadsw LOADUB // loadub LOADUH // loaduh LOADUW // loaduw LOADW // loadw LOCAL // local name LONG_DOUBLE_LIT // long double literal MUL // mul OR // or P // p PHI // phi REM // rem RET // ret RO // ro S // s SAR // sar SHL // shl SHR // shr SLTOF // sltof STOREB // storeb STORED // stored STOREH // storeh STOREL // storel STORELD // storeld STORES // stores STOREW // storew STOSI // stosi STOUI // stoui STRING_LIT // string literal SUB // sub SWTOF // swtof TRUNCD // truncd TRUNCLD // truncld TYPE // type TYPENAME // type name UDIV // udiv ULTOF // ultof UREM // urem UWTOF // uwtof VAARG // vaarg VASTART // vastart W // w XOR // xor Z // z )
Named values of Ch.
type CharPointer ¶ added in v0.0.7
type CharPointer struct {
Type
}
func (CharPointer) String ¶ added in v0.0.7
func (t CharPointer) String() string
type Cled ¶ added in v0.0.2
type Cled struct { InstPreamble Binary }
Cled represents the 'cled' instruction.
type Cleld ¶ added in v0.0.6
type Cleld struct { InstPreamble Binary }
Cleld represents the 'cleld' instruction.
type Cles ¶ added in v0.0.2
type Cles struct { InstPreamble Binary }
Cles represents the 'cles' instruction.
type Cltd ¶ added in v0.0.2
type Cltd struct { InstPreamble Binary }
Cltd represents the 'cltd' instruction.
type Cltld ¶ added in v0.0.6
type Cltld struct { InstPreamble Binary }
Cltld represents the 'cltld' instruction.
type Clts ¶ added in v0.0.2
type Clts struct { InstPreamble Binary }
Clts represents the 'clts' instruction.
type Cned ¶ added in v0.0.2
type Cned struct { InstPreamble Binary }
Cned represents the 'cned' instruction.
type Cnel ¶ added in v0.0.2
type Cnel struct { InstPreamble Binary }
Cnel represents the 'cnel' instruction.
type Cneld ¶ added in v0.0.6
type Cneld struct { InstPreamble Binary }
Cneld represents the 'cneld' instruction.
type Cnes ¶ added in v0.0.2
type Cnes struct { InstPreamble Binary }
Cnes represents the 'cnes' instruction.
type Cnew ¶ added in v0.0.2
type Cnew struct { InstPreamble Binary }
Cnew represents the 'cnew' instruction.
type Cod ¶ added in v0.0.2
type Cod struct { InstPreamble Binary }
Cod represents the 'cod' instruction.
type Copy ¶ added in v0.0.2
type Copy struct { InstPreamble Value Node }
Copy represents the 'copy' instruction.
type Cos ¶ added in v0.0.2
type Cos struct { InstPreamble Binary }
Cos represents the 'cos' instruction.
type Csgel ¶ added in v0.0.2
type Csgel struct { InstPreamble Binary }
Csgel represents the 'csgel' instruction.
type Csgew ¶ added in v0.0.2
type Csgew struct { InstPreamble Binary }
Csgew represents the 'csgew' instruction.
type Csgtl ¶ added in v0.0.2
type Csgtl struct { InstPreamble Binary }
Csgtl represents the 'csgtl' instruction.
type Csgtw ¶ added in v0.0.2
type Csgtw struct { InstPreamble Binary }
Csgtw represents the 'csgtw' instruction.
type Cslel ¶ added in v0.0.2
type Cslel struct { InstPreamble Binary }
Cslel represents the 'cslel' instruction.
type Cslew ¶ added in v0.0.2
type Cslew struct { InstPreamble Binary }
Cslew represents the 'cslew' instruction.
type Csltl ¶ added in v0.0.2
type Csltl struct { InstPreamble Binary }
Csltl represents the 'csltl' instruction.
type Csltw ¶ added in v0.0.2
type Csltw struct { InstPreamble Binary }
Csltw represents the 'csltw' instruction.
type Cugel ¶ added in v0.0.2
type Cugel struct { InstPreamble Binary }
Cugel represents the 'cugel' instruction.
type Cugew ¶ added in v0.0.2
type Cugew struct { InstPreamble Binary }
Cugew represents the 'cugew' instruction.
type Cugtl ¶ added in v0.0.2
type Cugtl struct { InstPreamble Binary }
Cugtl represents the 'cugtl' instruction.
type Cugtw ¶ added in v0.0.2
type Cugtw struct { InstPreamble Binary }
Cugtw represents the 'cugtw' instruction.
type Culel ¶ added in v0.0.2
type Culel struct { InstPreamble Binary }
Culel represents the 'culel' instruction.
type Culew ¶ added in v0.0.2
type Culew struct { InstPreamble Binary }
Culew represents the 'culew' instruction.
type Cultl ¶ added in v0.0.2
type Cultl struct { InstPreamble Binary }
Cultl represents the 'cultl' instruction.
type Cultw ¶ added in v0.0.2
type Cultw struct { InstPreamble Binary }
Cultw represents the 'cultw' instruction.
type Cuod ¶ added in v0.0.2
type Cuod struct { InstPreamble Binary }
Cuod represents the 'cuod' instruction.
type Cuos ¶ added in v0.0.2
type Cuos struct { InstPreamble Binary }
Cuos represents the 'cuos' instruction.
type DataDef ¶ added in v0.0.2
type DataDef struct { Align uintptr // Non zero only if explicitly specified. Global // $name Items []Node Size uintptr // Packed size in bytes. Type Type // Non-nil iff all items are of the same type. Attributes []string IsExported bool IsReadOnly bool }
DataDef represents a data definition, static initialized data.
type Declare ¶ added in v0.0.7
type Declare struct {
InstPreamble
}
Declare represents the 'declare' instruction.
type Div ¶ added in v0.0.2
type Div struct { InstPreamble Binary }
Div represents the 'div' instruction.
type Dtosi ¶ added in v0.0.2
type Dtosi struct { InstPreamble Value Node }
Dtosi represents the 'dtosi' instruction.
type Dtoui ¶ added in v0.0.6
type Dtoui struct { InstPreamble Value Node }
Dtoui represents the 'dtoui' instruction.
type EnvArg ¶ added in v0.0.2
type EnvArg struct {
Value Node
}
EnvArg represents the actual environment parameter of a function call.
type EnvParameter ¶ added in v0.0.2
type EnvParameter struct {
Local
}
EnvParameter represents the environmental formal parameter of a function definition.
type Extd ¶ added in v0.0.6
type Extd struct { InstPreamble Value Node }
Extd represents the 'extd' instruction.
type Exts ¶ added in v0.0.2
type Exts struct { InstPreamble Value Node }
Exts represents the 'exts' instruction.
type Extsb ¶ added in v0.0.2
type Extsb struct { InstPreamble Value Node }
Extsb represents the 'extsb' instruction.
type Extsh ¶ added in v0.0.2
type Extsh struct { InstPreamble Value Node }
Extsh represents the 'extsh' instruction.
type Extsw ¶ added in v0.0.2
type Extsw struct { InstPreamble Value Node }
Extsw represents the 'extsw' instruction.
type Extub ¶ added in v0.0.2
type Extub struct { InstPreamble Value Node }
Extub represents the 'extub' instruction.
type Extuh ¶ added in v0.0.2
type Extuh struct { InstPreamble Value Node }
Extuh represents the 'extuh' instruction.
type Extuw ¶ added in v0.0.2
type Extuw struct { InstPreamble Value Node }
Extuw represents the 'extuw' instruction.
type Field ¶
type Field struct { Type // contains filtered or unexported fields }
Field represents field type.
type Float32Initializer ¶ added in v0.0.2
type Float32Initializer struct { Float32Lit Type }
Float32Initializer is a DataDef item representing a float32 literal.
type Float32Lit ¶ added in v0.0.2
type Float32Lit struct {
Token
}
Float32Lit represents a float32 literal.
func (Float32Lit) Value ¶ added in v0.0.2
func (n Float32Lit) Value() float32
Value returns the float32 value represented by n.
type Float64Initializer ¶ added in v0.0.2
type Float64Initializer struct { Float64Lit Type }
Float64Initializer is a DataDef item representing a float64 literal.
type Float64Lit ¶ added in v0.0.2
type Float64Lit struct {
Token
}
Float64Lit represents a float64 literal.
func (Float64Lit) Value ¶ added in v0.0.2
func (n Float64Lit) Value() float64
Value returns the float64 value represented by n.
type FuncDef ¶ added in v0.0.2
type FuncDef struct { Blocks []*Block // In order of appearance in source code. Read only. Global // $name Params []Node Result Type Scope Scope Map map[string]*MapInfo Attributes []string IsExported bool IsVariadic bool // contains filtered or unexported fields }
FuncDef represents a function definition
type Global ¶
type Global struct {
Name
}
Global represents an address of a function or data definition of the form $name.
type GlobalInitializer ¶ added in v0.0.2
GlobalInitializer is a DataDef item representing the address of a function of data definition, with an optional offset.
type InstPreamble ¶ added in v0.0.2
InstPreamble represents the common part of a 3-address instruction.
func (*InstPreamble) Position ¶ added in v0.0.2
func (n *InstPreamble) Position() token.Position
Position implements Node.
type IntInitializer ¶ added in v0.0.2
IntInitializer is a DataDef item representing an integer literal.
type IntLit ¶ added in v0.0.2
type IntLit Token
IntLit represents a integer literal.
type Label ¶ added in v0.0.2
type Label struct {
Name
}
Label reprents a label name in the form @name.
type Ldtosi ¶ added in v0.0.6
type Ldtosi struct { InstPreamble Value Node }
Ldtosi represents the 'ldtosi' instruction.
type Ldtoui ¶ added in v0.0.6
type Ldtoui struct { InstPreamble Value Node }
Ldtoui represents the 'ldtoui' instruction.
type Loadd ¶ added in v0.0.2
type Loadd struct { InstPreamble Value Node }
Loadd represents the 'loadd' instruction.
type Loadl ¶ added in v0.0.2
type Loadl struct { InstPreamble Value Node }
Loadl represents the 'loadl' instruction.
type Loadld ¶ added in v0.0.6
type Loadld struct { InstPreamble Value Node }
Loadld represents the 'loadld' instruction.
type Loads ¶ added in v0.0.2
type Loads struct { InstPreamble Value Node }
Loads represents the 'loads' instruction.
type Loadsb ¶ added in v0.0.2
type Loadsb struct { InstPreamble Value Node }
Loadsb represents the 'loadsb' instruction.
type Loadsh ¶ added in v0.0.2
type Loadsh struct { InstPreamble Value Node }
Loadsh represents the 'loadsh' instruction.
type Loadsw ¶ added in v0.0.2
type Loadsw struct { InstPreamble Value Node }
Loadsw represents the 'loadsw' and 'loadw' instructions.
type Loadub ¶ added in v0.0.2
type Loadub struct { InstPreamble Value Node }
Loadub represents the 'loadub' instruction.
type Loaduh ¶ added in v0.0.2
type Loaduh struct { InstPreamble Value Node }
Loaduh represents the 'loaduh' instruction.
type Loaduw ¶ added in v0.0.2
type Loaduw struct { InstPreamble Value Node }
Loaduw represents the 'loaduw' instruction.
type Local ¶ added in v0.0.2
type Local struct {
Name
}
Local represents a SSA temporary variable name of the form %name.
type LocalInfo ¶ added in v0.0.2
type LocalInfo struct { N int // Zero-based local number. Name Read int // Static number of times the local is used as an operand. Type Written int // Static number of times the local is defined (assigned to). Parameters start with 1. IsParameter bool IsStruct bool }
LocalInfo desribes properties of a SSA temporary variable.
type LongDouble ¶ added in v0.0.6
type LongDouble struct{}
LongDouble represents type 'ld'.
func (LongDouble) String ¶ added in v0.0.6
func (t LongDouble) String() string
type LongDoubleLit ¶ added in v0.0.6
type LongDoubleLit Token
LongDoubleLit represents a long double literal.
func (LongDoubleLit) Position ¶ added in v0.0.6
func (n LongDoubleLit) Position() token.Position
Position implements Node.
func (LongDoubleLit) Value ¶ added in v0.0.6
func (n LongDoubleLit) Value() string
Value returns the long double value represented by n.
type LongDoubleLitInitializer ¶ added in v0.0.6
type LongDoubleLitInitializer struct { LongDoubleLit Type }
LongDoubleLitInitializer is a DataDef item representing a long double literal.
type Mul ¶ added in v0.0.2
type Mul struct { InstPreamble Binary }
Mul represents the 'mul' instruction.
type Name ¶ added in v0.0.2
type Name Token
Name is a Token that represents a name.
func (Name) Name ¶ added in v0.0.2
Name returns the effective name n stands for. The result is read only and it includes the sigil in the first byte of the result. This automatically separates the namespaces of labels, locals, globals and types.
Names other than gloabls ($name) have the effective value the same as is their source form, unchanged.
Global names of the form $"foo" have the effective name `foo`.
type Or ¶ added in v0.0.2
type Or struct { InstPreamble Binary }
Or represents the 'or' instruction.
type Phi ¶ added in v0.0.2
type Phi struct { InstPreamble Args []PhiArg }
Phi represents the 'phi' instruction.
type RegularArg ¶ added in v0.0.2
RegularArg represents the actual parameter of a function call.
func (*RegularArg) Position ¶ added in v0.0.2
func (n *RegularArg) Position() token.Position
Position implements Node.
type RegularParameter ¶ added in v0.0.2
RegularParameter represents a regular formal parameter of a function definition.
type Rem ¶ added in v0.0.2
type Rem struct { InstPreamble Binary }
Rem represents the 'rem' instruction.
type Ret ¶ added in v0.0.2
type Ret struct { Value Node // contains filtered or unexported fields }
Ret represent the 'ret' instruction.
type Sar ¶ added in v0.0.2
type Sar struct { InstPreamble Binary }
Sar represents the 'sar' instruction.
type Scanner ¶ added in v0.0.2
type Scanner struct { // Tok is the current CST token. It is valid after first call to Scan. The // value is read only. Tok CSTToken // contains filtered or unexported fields }
Scanner provides lexical analysis of its buffer.
func NewScanner ¶ added in v0.0.2
NewScanner returns a newly created scanner that will tokenize buf. Positions are reported as if buf is coming from a file named name. The buffer becomes owned by the scanner and must not be modified after calling NewScanner.
The scanner normally stops scanning after some number of errors. Passing allErrros == true overides that.
type Shl ¶ added in v0.0.2
type Shl struct { InstPreamble Binary }
Shl represents the 'shl' instruction.
type Shr ¶ added in v0.0.2
type Shr struct { InstPreamble Binary }
Shr represents the 'shr' instruction.
type Sltof ¶ added in v0.0.2
type Sltof struct { InstPreamble Value Node }
Sltof represents the 'sltof' instruction.
type Stosi ¶ added in v0.0.2
type Stosi struct { InstPreamble Value Node }
Stosi represents the 'stosi' instruction.
type Stoui ¶ added in v0.0.6
type Stoui struct { InstPreamble Value Node }
Stoui represents the 'stoui' instruction.
type StringInitializer ¶ added in v0.0.2
StringInitializer is a DataDef item representing a string literal.
type StringLit ¶ added in v0.0.2
type StringLit Token
StringLit represents a string literal.
type StructField ¶ added in v0.0.2
type StructField struct { Fields []Node // contains filtered or unexported fields }
StructField represents a struct-shaped field.
type Sub ¶ added in v0.0.2
type Sub struct { InstPreamble Binary }
Sub represents the 'sub' instruction.
type Swtof ¶ added in v0.0.2
type Swtof struct { InstPreamble Value Node }
Swtof represents the 'swtof' instruction.
type Task ¶ added in v0.0.2
type Task struct { O string // -O argument. Read only. // contains filtered or unexported fields }
Task represents a compilation job.
type Token ¶
type Token struct {
// contains filtered or unexported fields
}
Token is a terminal node of the abstract syntax tree.
type Truncd ¶ added in v0.0.2
type Truncd struct { InstPreamble Value Node }
Truncd represents the 'truncd' instruction.
type Truncld ¶ added in v0.0.6
type Truncld struct { InstPreamble Value Node }
Truncld represents the 'truncld' instruction.
type Type ¶ added in v0.0.2
type Type interface { String() string // contains filtered or unexported methods }
Type represents a QBE type.
type TypeDef ¶ added in v0.0.2
type TypeDef struct { Align uintptr // Non zero only if explicitly specified. Fields []Node TypeName // :name }
TypeDef represents a named type.
type TypeName ¶ added in v0.0.2
type TypeName struct {
Name
}
TypeName represents a named type of the form :name.
type Udiv ¶ added in v0.0.2
type Udiv struct { InstPreamble Binary }
Udiv represents the 'udiv' instruction.
type Ultof ¶ added in v0.0.4
type Ultof struct { InstPreamble Value Node }
Ultof represents the 'ultof' instruction.
type UnionField ¶ added in v0.0.2
type UnionField IntLit
UnionField represents an opaque data type.
func (UnionField) Position ¶ added in v0.0.2
func (n UnionField) Position() token.Position
Position implements Node.
func (UnionField) Size ¶ added in v0.0.2
func (n UnionField) Size() uintptr
Size returns the declared size of n in bytes.
type Urem ¶ added in v0.0.2
type Urem struct { InstPreamble Binary }
Urem represents the 'urem' instruction.
type Uwtof ¶ added in v0.0.4
type Uwtof struct { InstPreamble Value Node }
Uwtof represents the 'uwtof' instruction.
type VaArg ¶ added in v0.0.2
type VaArg struct { InstPreamble Value Node }
VaArg represents the 'vaarg' instruction.
type VaInfo ¶ added in v0.0.7
type VaInfo struct { Size int // sizeof va ElemSize int // sizeof *va or 0 if N/A // IsStructArray reports whether va_list if defined as, for example // // typedef struct { // unsigned int gp_offset; // unsigned int fp_offset; // void *overflow_arg_area; // void *reg_save_area; // } __builtin_va_list[1]; IsStructArray bool // IsPointer reports whether va_list if defined as, for example // // typedef char *__builtin_va_list; IsPointer bool // IsStruct reports whether va_list if defined as, for example // // typedef struct { // void *__ap; // } __builtin_va_list; IsStruct bool }
VaInfo describes a va_list
type VaStart ¶ added in v0.0.2
type VaStart struct { Value Node // contains filtered or unexported fields }
VaStart represents the 'vastart' instruction.
type VoidPointer ¶ added in v0.0.7
type VoidPointer struct {
Type
}
func (VoidPointer) String ¶ added in v0.0.7
func (t VoidPointer) String() string
type Xor ¶ added in v0.0.2
type Xor struct { InstPreamble Binary }
Xor represents the 'xor' instruction.
type ZeroInitializer ¶ added in v0.0.2
type ZeroInitializer IntLit
ZeroInitializer is a DataDef item representing zeroed data.
func (ZeroInitializer) Position ¶ added in v0.0.2
func (n ZeroInitializer) Position() token.Position
Position implements Node.
func (ZeroInitializer) Size ¶ added in v0.0.2
func (n ZeroInitializer) Size() uintptr
Size returns the declared size of n in bytes.