asm

package
v0.0.0-...-6e409f7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 13, 2014 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TYPE_INT8 = iota
	TYPE_INT16
	TYPE_INT32
	TYPE_INT64
)

Variables

View Source
var DUMMY_SYMBOL_BASE = "L"
View Source
var DummySymbolTable = NewSymbolTable(DUMMY_SYMBOL_BASE)

Functions

func TypeGet

func TypeGet(size int) int

func TypeSize

func TypeSize(t int) int

Types

type AbsoluteAddress

type AbsoluteAddress struct {
	ClassName string
	Register  core.IRegister
}

func NewAbsoluteAddress

func NewAbsoluteAddress(reg core.IRegister) *AbsoluteAddress

func (*AbsoluteAddress) AsOperand

func (self *AbsoluteAddress) AsOperand() core.IOperand

func (*AbsoluteAddress) CollectStatistics

func (self *AbsoluteAddress) CollectStatistics(stats core.IStatistics)

func (AbsoluteAddress) GetRegister

func (self AbsoluteAddress) GetRegister() core.IOperand

func (AbsoluteAddress) IsMemoryReference

func (self AbsoluteAddress) IsMemoryReference() bool

func (AbsoluteAddress) IsRegister

func (self AbsoluteAddress) IsRegister() bool

func (*AbsoluteAddress) ToSource

func (self *AbsoluteAddress) ToSource(table core.ISymbolTable) string

type Comment

type Comment struct {
	ClassName   string
	String      string
	IndentLevel int
}

func NewComment

func NewComment(s string, indentLevel int) *Comment

func (*Comment) AsAssembly

func (self *Comment) AsAssembly() core.IAssembly

func (*Comment) CollectStatistics

func (self *Comment) CollectStatistics(stats core.IStatistics)

func (Comment) IsComment

func (self Comment) IsComment() bool

func (Comment) IsDirective

func (self Comment) IsDirective() bool

func (Comment) IsInstruction

func (self Comment) IsInstruction() bool

func (Comment) IsLabel

func (self Comment) IsLabel() bool

func (*Comment) ToSource

func (self *Comment) ToSource(table core.ISymbolTable) string

type DirectMemoryReference

type DirectMemoryReference struct {
	ClassName string
	Value     core.ILiteral
}

func NewDirectMemoryReference

func NewDirectMemoryReference(val core.ILiteral) *DirectMemoryReference

func (*DirectMemoryReference) AsMemoryReference

func (self *DirectMemoryReference) AsMemoryReference() core.IMemoryReference

func (*DirectMemoryReference) AsOperand

func (self *DirectMemoryReference) AsOperand() core.IOperand

func (*DirectMemoryReference) CollectStatistics

func (self *DirectMemoryReference) CollectStatistics(stats core.IStatistics)

func (*DirectMemoryReference) FixOffset

func (self *DirectMemoryReference) FixOffset(n int64)

func (DirectMemoryReference) GetValue

func (self DirectMemoryReference) GetValue() core.ILiteral

func (DirectMemoryReference) IsMemoryReference

func (self DirectMemoryReference) IsMemoryReference() bool

func (DirectMemoryReference) IsRegister

func (self DirectMemoryReference) IsRegister() bool

func (*DirectMemoryReference) String

func (self *DirectMemoryReference) String() string

func (*DirectMemoryReference) ToSource

func (self *DirectMemoryReference) ToSource(table core.ISymbolTable) string

type Directive

type Directive struct {
	ClassName string
	Content   string
}

func NewDirective

func NewDirective(content string) *Directive

func (*Directive) AsAssembly

func (self *Directive) AsAssembly() core.IAssembly

func (*Directive) CollectStatistics

func (self *Directive) CollectStatistics(stats core.IStatistics)

func (Directive) IsComment

func (self Directive) IsComment() bool

func (Directive) IsDirective

func (self Directive) IsDirective() bool

func (Directive) IsInstruction

func (self Directive) IsInstruction() bool

func (Directive) IsLabel

func (self Directive) IsLabel() bool

func (*Directive) ToSource

func (self *Directive) ToSource(table core.ISymbolTable) string

type ImmediateValue

type ImmediateValue struct {
	ClassName string
	Expr      core.ILiteral
}

func NewImmediateValue

func NewImmediateValue(val core.ILiteral) *ImmediateValue

func (*ImmediateValue) AsImmediateValue

func (self *ImmediateValue) AsImmediateValue() core.IImmediateValue

func (*ImmediateValue) AsOperand

func (self *ImmediateValue) AsOperand() core.IOperand

func (*ImmediateValue) CollectStatistics

func (self *ImmediateValue) CollectStatistics(stats core.IStatistics)

func (ImmediateValue) GetExpr

func (self ImmediateValue) GetExpr() core.ILiteral

func (ImmediateValue) IsMemoryReference

func (self ImmediateValue) IsMemoryReference() bool

func (ImmediateValue) IsRegister

func (self ImmediateValue) IsRegister() bool

func (*ImmediateValue) ToSource

func (self *ImmediateValue) ToSource(table core.ISymbolTable) string

type IndirectMemoryReference

type IndirectMemoryReference struct {
	ClassName string
	Offset    core.ILiteral
	Base      core.IRegister
	Fixed     bool
}

func NewIndirectMemoryReference

func NewIndirectMemoryReference(offset core.ILiteral, base core.IRegister, fixed bool) *IndirectMemoryReference

func (*IndirectMemoryReference) AsMemoryReference

func (self *IndirectMemoryReference) AsMemoryReference() core.IMemoryReference

func (*IndirectMemoryReference) AsOperand

func (self *IndirectMemoryReference) AsOperand() core.IOperand

func (*IndirectMemoryReference) CollectStatistics

func (self *IndirectMemoryReference) CollectStatistics(stats core.IStatistics)

func (*IndirectMemoryReference) FixOffset

func (self *IndirectMemoryReference) FixOffset(diff int64)

func (IndirectMemoryReference) IsMemoryReference

func (self IndirectMemoryReference) IsMemoryReference() bool

func (IndirectMemoryReference) IsRegister

func (self IndirectMemoryReference) IsRegister() bool

func (*IndirectMemoryReference) String

func (self *IndirectMemoryReference) String() string

func (*IndirectMemoryReference) ToSource

func (self *IndirectMemoryReference) ToSource(table core.ISymbolTable) string

type Instruction

type Instruction struct {
	ClassName      string
	Mnemonic       string
	Suffix         string
	Operands       []core.IOperand
	NeedRelocation bool
}

func NewInstruction

func NewInstruction(mnemonic string, suffix string, operands []core.IOperand, reloc bool) *Instruction

func (*Instruction) AsAssembly

func (self *Instruction) AsAssembly() core.IAssembly

func (*Instruction) CollectStatistics

func (self *Instruction) CollectStatistics(stats core.IStatistics)

func (Instruction) GetMnemonic

func (self Instruction) GetMnemonic() string

func (Instruction) IsComment

func (self Instruction) IsComment() bool

func (Instruction) IsDirective

func (self Instruction) IsDirective() bool

func (Instruction) IsInstruction

func (self Instruction) IsInstruction() bool

func (Instruction) IsJumpInstruction

func (self Instruction) IsJumpInstruction() bool

func (Instruction) IsLabel

func (self Instruction) IsLabel() bool

func (Instruction) JumpDestination

func (self Instruction) JumpDestination() core.ISymbol

func (Instruction) NumOperands

func (self Instruction) NumOperands() int

func (Instruction) Operand1

func (self Instruction) Operand1() core.IOperand

func (Instruction) Operand2

func (self Instruction) Operand2() core.IOperand

func (*Instruction) ToSource

func (self *Instruction) ToSource(table core.ISymbolTable) string

type IntegerLiteral

type IntegerLiteral struct {
	ClassName string
	Value     int64
}

func NewIntegerLiteral

func NewIntegerLiteral(n int64) *IntegerLiteral

func (*IntegerLiteral) AsLiteral

func (self *IntegerLiteral) AsLiteral() core.ILiteral

func (*IntegerLiteral) CollectStatistics

func (self *IntegerLiteral) CollectStatistics(stats core.IStatistics)

func (IntegerLiteral) GetValue

func (self IntegerLiteral) GetValue() int64

func (IntegerLiteral) IsZero

func (self IntegerLiteral) IsZero() bool

func (IntegerLiteral) String

func (self IntegerLiteral) String() string

func (*IntegerLiteral) ToSource

func (self *IntegerLiteral) ToSource(table core.ISymbolTable) string

type Label

type Label struct {
	ClassName string
	Symbol    core.ISymbol
}

func NewLabel

func NewLabel(sym core.ISymbol) *Label

func NewUnnamedLabel

func NewUnnamedLabel() *Label

func (*Label) AsAssembly

func (self *Label) AsAssembly() core.IAssembly

func (*Label) CollectStatistics

func (self *Label) CollectStatistics(stats core.IStatistics)

func (Label) GetSymbol

func (self Label) GetSymbol() core.ISymbol

func (Label) IsComment

func (self Label) IsComment() bool

func (Label) IsDirective

func (self Label) IsDirective() bool

func (Label) IsInstruction

func (self Label) IsInstruction() bool

func (Label) IsLabel

func (self Label) IsLabel() bool

func (*Label) ToSource

func (self *Label) ToSource(table core.ISymbolTable) string

type NamedSymbol

type NamedSymbol struct {
	ClassName string
	Name      string
}

func NewNamedSymbol

func NewNamedSymbol(name string) *NamedSymbol

func (*NamedSymbol) AsLiteral

func (self *NamedSymbol) AsLiteral() core.ILiteral

func (*NamedSymbol) AsSymbol

func (self *NamedSymbol) AsSymbol() core.ISymbol

func (*NamedSymbol) CollectStatistics

func (self *NamedSymbol) CollectStatistics(stats core.IStatistics)

func (NamedSymbol) GetName

func (self NamedSymbol) GetName() string

func (NamedSymbol) IsZero

func (self NamedSymbol) IsZero() bool

func (NamedSymbol) String

func (self NamedSymbol) String() string

func (*NamedSymbol) ToSource

func (self *NamedSymbol) ToSource(table core.ISymbolTable) string

type Statistics

type Statistics struct {
	// contains filtered or unexported fields
}

func CollectStatistics

func CollectStatistics(assemblies []core.IAssembly) *Statistics

func NewStatistics

func NewStatistics() *Statistics

func (*Statistics) AsStatistics

func (self *Statistics) AsStatistics() core.IStatistics

func (*Statistics) DoesInstructionUsed

func (self *Statistics) DoesInstructionUsed(insn string) bool

func (*Statistics) DoesRegisterUsed

func (self *Statistics) DoesRegisterUsed(reg core.IRegister) bool

func (*Statistics) DoesSymbolUsed

func (self *Statistics) DoesSymbolUsed(sym core.ISymbol) bool

func (*Statistics) InstructionUsed

func (self *Statistics) InstructionUsed(insn string)

func (*Statistics) NumInstructionUsed

func (self *Statistics) NumInstructionUsed(insn string) int

func (*Statistics) NumRegisterUsed

func (self *Statistics) NumRegisterUsed(reg core.IRegister) int

func (*Statistics) NumSymbolUsed

func (self *Statistics) NumSymbolUsed(sym core.ISymbol) int

func (*Statistics) RegisterUsed

func (self *Statistics) RegisterUsed(reg core.IRegister)

func (*Statistics) SymbolUsed

func (self *Statistics) SymbolUsed(sym core.ISymbol)

type SuffixedSymbol

type SuffixedSymbol struct {
	ClassName string
	Base      core.ISymbol
	Suffix    string
}

func NewSuffixedSymbol

func NewSuffixedSymbol(base core.ISymbol, suffix string) *SuffixedSymbol

func (*SuffixedSymbol) AsLiteral

func (self *SuffixedSymbol) AsLiteral() core.ILiteral

func (*SuffixedSymbol) AsSymbol

func (self *SuffixedSymbol) AsSymbol() core.ISymbol

func (*SuffixedSymbol) CollectStatistics

func (self *SuffixedSymbol) CollectStatistics(stats core.IStatistics)

func (SuffixedSymbol) GetName

func (self SuffixedSymbol) GetName() string

func (SuffixedSymbol) IsZero

func (self SuffixedSymbol) IsZero() bool

func (SuffixedSymbol) String

func (self SuffixedSymbol) String() string

func (*SuffixedSymbol) ToSource

func (self *SuffixedSymbol) ToSource(table core.ISymbolTable) string

type SymbolTable

type SymbolTable struct {
	ClassName string
	Base      string
	Seq       int
	// contains filtered or unexported fields
}

func NewSymbolTable

func NewSymbolTable(base string) *SymbolTable

func (*SymbolTable) AsSymbolTable

func (self *SymbolTable) AsSymbolTable() core.ISymbolTable

func (*SymbolTable) NewSymbol

func (self *SymbolTable) NewSymbol() core.ISymbol

func (*SymbolTable) SymbolString

func (self *SymbolTable) SymbolString(sym core.ISymbol) string

type UnnamedSymbol

type UnnamedSymbol struct {
	ClassName string
}

func NewUnnamedSymbol

func NewUnnamedSymbol() *UnnamedSymbol

func (*UnnamedSymbol) AsLiteral

func (self *UnnamedSymbol) AsLiteral() core.ILiteral

func (*UnnamedSymbol) AsSymbol

func (self *UnnamedSymbol) AsSymbol() core.ISymbol

func (*UnnamedSymbol) CollectStatistics

func (self *UnnamedSymbol) CollectStatistics(stats core.IStatistics)

func (UnnamedSymbol) GetName

func (self UnnamedSymbol) GetName() string

func (UnnamedSymbol) IsZero

func (self UnnamedSymbol) IsZero() bool

func (UnnamedSymbol) String

func (self UnnamedSymbol) String() string

func (*UnnamedSymbol) ToSource

func (self *UnnamedSymbol) ToSource(table core.ISymbolTable) string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL