rj32

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2022 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ArgRegs = []Reg{A0, A1, A2}
View Source
var SavedRegs = []Reg{S0, S1, S2, S3, T5}
View Source
var TempRegs = []Reg{T0, T1, T2, T3, T4}

Functions

func OpcodeStrings

func OpcodeStrings() []string

OpcodeStrings returns a slice of all String values of the enum

func RegStrings

func RegStrings() []string

RegStrings returns a slice of all String values of the enum

Types

type Fmt

type Fmt int
const (
	BadFmt Fmt = iota
	LoadFmt
	StoreFmt
	MoveFmt
	CompareFmt
	BinaryFmt
	UnaryFmt
	CallFmt
	NoFmt
)

func (Fmt) Template

func (f Fmt) Template() string

func (Fmt) Vars

func (f Fmt) Vars(val *ir.Value) []*asm.Var

type Opcode

type Opcode int
const (
	// Natively implemented instructions
	Nop Opcode = iota
	Rets
	Error
	Halt
	Rcsr
	Wcsr
	Move
	Loadc
	Jump
	Imm
	Call
	Imm2
	Load
	Store
	Loadb
	Storeb
	Add
	Sub
	Addc
	Subc
	Xor
	And
	Or
	Shl
	Shr
	Asr
	IfEq
	IfNe
	IfLt
	IfGe
	IfUlt
	IfUge

	// Psuedoinstructions
	Not
	Neg
	Swap
	IfGt
	IfLe
	IfUgt
	IfUle
	Return

	NumOps
)

func OpcodeString

func OpcodeString(s string) (Opcode, error)

OpcodeString retrieves an enum value from the enum constants string name. Throws an error if the param is not part of the enum.

func OpcodeValues

func OpcodeValues() []Opcode

OpcodeValues returns all values of the enum

func (Opcode) Asm

func (op Opcode) Asm() string

func (Opcode) Fmt

func (op Opcode) Fmt() asm.Fmt

func (Opcode) IsAOpcode

func (i Opcode) IsAOpcode() bool

IsAOpcode returns "true" if the value is listed in the enum definition. "false" otherwise

func (Opcode) IsCall

func (op Opcode) IsCall() bool

func (Opcode) IsMove

func (op Opcode) IsMove() bool

func (Opcode) String

func (i Opcode) String() string

type Reg

type Reg uint
const (
	RA Reg = iota
	A0
	A1
	A2

	S0
	S1
	S2
	S3

	T0
	T1
	T2
	T3

	T4
	T5
	GP
	SP
)

func RegString

func RegString(s string) (Reg, error)

RegString retrieves an enum value from the enum constants string name. Throws an error if the param is not part of the enum.

func RegValues

func RegValues() []Reg

RegValues returns all values of the enum

func (Reg) IsAReg

func (i Reg) IsAReg() bool

IsAReg returns "true" if the value is listed in the enum definition. "false" otherwise

func (Reg) String

func (i Reg) String() string

Jump to

Keyboard shortcuts

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