- ARM64 Instruction Reference
- ARM Assembly Editor support
- ARM Assembly syntax support
- ARM64 Snippets
- Hex Editor
// Initialize allocator
allocator := NewAllocator()
...
// Assign a register for myVar
reg, err := allocator.GetRegister("myVar")
if err != nil {
Handle allocation error
}
// Free the register when done
defer allocator.FreeRegister("myVar")
// Use the register
...
// Compare
instr := op.NewBinaryOperation("CMP",
CreateRegisterOperand("R0"),
CreateImmediateOperand("#0"),
nil,
"Compare with zero")
// Branch
instr := op.NewBranch("B", ".L1", "Branch to loop start")
3 main interfaces that implement ast . Node:
- ast.Expr — representing expressions and types node
- ast.Stmt — representing statement node
- ast.Decl — representing declaration node
ast.Ident
*ast.Ident {
. NamePos: dummy.go:1:9
. Name: "hello"
}
ast.GenDecl
*ast.GenDecl {
. TokPos: dummy.go:3:1
. Tok: import
. Lparen: -
. Specs: []ast.Spec (len = 1) {
. . 0: *ast.ImportSpec {/* Omission */}
. }
. Rparen: -
}
ast.ImportSpec (single import declaration)
*ast.ImportSpec {
. Path: *ast.BasicLit {/* Omission */}
. EndPos: -
}
ast.BasicLit (literal of basic type)
*ast.BasicLit {
. ValuePos: dummy.go:3:8
. Kind: STRING
. Value: "\"fmt\""
}
NOTE type of token: token.INT, token.FLOAT, token.IMAG, token.CHAR, or token.STRING
ast.FuncDecl
*ast.FuncDecl {
. Name: *ast.Ident {/* Omission */}
. Type: *ast.FuncType {/* Omission */}
. Body: *ast.BlockStmt {/* Omission */}
}
ast.Ident
*ast.Ident {
. NamePos: dummy.go:5:6
. Name: "greet"
. Obj: *ast.Object {
. . Kind: func
. . Name: "greet"
. . Decl: *(obj @ 0)
. }
}
ast.FuncType
*ast.FuncType {
. Func: dummy.go:5:1
. Params: *ast.FieldList {/* Omission */}
}
ast.FieldList
*ast.FieldList {
. Opening: dummy.go:5:11
. List: nil
. Closing: dummy.go:5:12
}
ast.BlockStmt
*ast.BlockStmt {
. Lbrace: dummy.go:5:14
. List: []ast.Stmt (len = 1) {
. . 0: *ast.ExprStmt {/* Omission */}
. }
. Rbrace: dummy.go:7:1
}
ast.BlockStmt node represents a braced statement list
ast.ExprStmt
*ast.ExprStmt {
. X: *ast.CallExpr {/* Omission */}
}
ast.CallExpr
*ast.CallExpr {
. Fun: *ast.SelectorExpr {/* Omission */}
. Lparen: dummy.go:6:13
. Args: []ast.Expr (len = 1) {
. . 0: *ast.BasicLit {/* Omission */}
. }
. Ellipsis: -
. Rparen: dummy.go:6:28
}
represents an expression that calls a function
ast.SelectorExpr
*ast.SelectorExpr {
. X: *ast.Ident {
. . NamePos: dummy.go:6:2
. . Name: "fmt"
. }
. Sel: *ast.Ident {
. . NamePos: dummy.go:6:6
. . Name: "Println"
. }
}
ast.BasicLit
*ast.BasicLit {
. ValuePos: dummy.go:6:14
. Kind: STRING
. Value: "\"OK Let's Go!\""
}
NEXT -> Concrete example adding two slices
Goroutine Support:
- GO_STACK_INIT: Allocates stack space with guard pages
- GO_START: Creates and starts a new goroutine with proper stack and state initialization
Channel Operations:
- CHAN_INIT: Creates a new channel with specified buffer size
- CHAN_SEND: Non-blocking and blocking channel send operations
- CHAN_RECV: Non-blocking and blocking channel receive operations
Core standard library:
- DEFER: Implements Go's defer mechanism using a linked list of deferred functions
- SELECT: Basic SELECT implementation for channel operations supporting multiple cases with timeout
- PANIC: Implements panic with proper defer chain unwinding
- RECOVER: TODO needs expansion
(go back)