Skip to content

Commit

Permalink
Update grammar.yaml (#1)
Browse files Browse the repository at this point in the history
* Update grammar.yaml

Added additional move opcodes (07-0d) and minor corrections in formatting.

* Update grammar.yaml

* Update grammar.yaml

removed inaccurate changes, marked {todo} as placeholder for incomplete examples & descriptions.

* capitalise opcodes

* Update grammar.yaml

* Update grammar.yaml

* add return-void

* Update grammar.yaml

return opcodes added

---------

Co-authored-by: Abhi <85984486+AbhiTheModder@users.noreply.github.com>
  • Loading branch information
IndAlok and AbhiTheModder authored Dec 19, 2024
1 parent d4ab3a3 commit 5865725
Showing 1 changed file with 143 additions and 11 deletions.
154 changes: 143 additions & 11 deletions smalig/grammar.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -68,37 +68,169 @@
format: "B|A|op"
format_id: "12x"
syntax: "move-wide vA, vB"
args_info: "A: destination register pair (4 bits), B: source register pair (4 bits)"
args_info: "A: destination register-pair (4 bits), B: source register-pair (4 bits)"
short_desc: "Move the contents of one register-pair to another."
long_desc: "Move the value of the (vB, vB+1) register-pair to the (vA, vA+1) register-pair. Both register pairs must be in the first 16 register range (0-15)."
note: "It is legal to move from vN to either vN-1 or vN+1, so implementations must arrange for both halves of a register pair to be read before anything is written."
example: "" #TODO: Add example
long_desc: "Move the value of the (vB, vB+1) register-pair to the (vA, vA+1) register-pair. Both register-pairs must be in the first 16 register range (0-15)."
note: "It is legal to move from vN to either vN-1 or vN+1, so implementations must arrange for both halves of a register-pair to be read before anything is written."
example: ""
example_desc: ""

- opcode: "05"
name: "move-wide/from16"
format: "AA|op BBBB"
format_id: "22x"
syntax: "move-wide/from16 vAA, vBBBB"
args_info: "A: destination register pair (8 bits), B: source register pair (16 bits)"
args_info: "A: destination register-pair (8 bits), B: source register-pair (16 bits)"
short_desc: "Move the contents of one register-pair to another."
long_desc: "Move the value (long/double) of the (vBBBB, vBBBB+1) register-pair to the (vAA, vAA+1) register-pair. vB must be in the 64k register range (0-65535) while vA is one of the first 256 registers (0-255)."
note: "It is legal to move from vN to either vN-1 or vN+1, so implementations must arrange for both halves of a register pair to be read before anything is written."
note: "It is legal to move from vN to either vN-1 or vN+1, so implementations must arrange for both halves of a register-pair to be read before anything is written."
example: "0516 0000 - move-wide/from16 v22, v0"
example_desc: "Moves v0 into v22."
example_desc: "Moves the content of register-pair (v0, v0+1) into (v22, v22+1)."

- opcode: "06"
name: "move-wide/16"
format: "ØØ|op AAAA BBBB"
format_id: "32x"
syntax: "move-wide/from16 vAAAA, vBBBB"
args_info: "A: destination register pair (16 bits), B: source register pair (16 bits)"
args_info: "A: destination register-pair (16 bits), B: source register-pair (16 bits)"
short_desc: "Move the contents of one register-pair to another."
long_desc: "Move the value of the (vBBBB, vBBBB+1) register-pair to the (vAAAA, vAAAA+1) register-pair. Both register pairs must be in the first 64k register range (0-65535) & 16 bits."
note: "It is legal to move from vN to either vN-1 or vN+1, so implementations must arrange for both halves of a register pair to be read before anything is written."
example: "" #TODO: Add example
long_desc: "Move the value of the (vBBBB, vBBBB+1) register-pair to the (vAAAA, vAAAA+1) register-pair. Both register-pairs must be in the first 64k register range (0-65535) & 16 bits."
note: "It is legal to move from vN to either vN-1 or vN+1, so implementations must arrange for both halves of a register-pair to be read before anything is written."
example: ""
example_desc: ""

- opcode: "07"
name: "move-object"
format: "B|A|op"
format_id: "12x"
syntax: "move-object vA, vB"
args_info: "A: destination register (4 bits), B: source register (4 bits)"
short_desc: "Move the contents of one object-bearing register to another."
long_desc: "Move the value of register vB to register vA. Both registers must be in the first 16 register range (0-15)."
note: ""
example: "0781 - move-object v1, v8"
example_desc: "Moves the content of v8 to v1."

- opcode: "08"
name: "move-object/from16"
format: "AA|op BBBB"
format_id: "22x"
syntax: "move-object/from16 vAA, vBBBB"
args_info: "A: destination register (8 bits), B: source register (16 bits)"
short_desc: "Move the contents of one object-bearing register to another."
long_desc: "Move the value of register vBBBB to register vAA. vB must be in the 64k register range (0-65535) while vA is one of the first 256 registers (0-255)."
note: ""
example: "0801 1500 - move-object/from16 v1, v21"
example_desc: "Move the content of v21 to v1."

- opcode: "09"
name: "move-object/16"
format: "ØØ|op AAAA BBBB"
format_id: "32x"
syntax: "move-object/16 vAAAA, vBBBB"
args_info: "A: destination register (16 bits), B: source register (16 bits)"
short_desc: "Move the contents of one object-bearing register to another."
long_desc: "Move the value of register vBBBB to register vAAAA. Both registers must be in the first 64k register range (0-65535) & 16 bits."
note: ""
example: ""
example_desc: ""

- opcode: "0A"
name: "move-result"
format: "AA|op"
format_id: "11x"
syntax: "move-result vAA"
args_info: "A: destination register (8 bits)"
short_desc: "Moves the single-word, non-object result of the preceding invoke-kind to the specified register. Must immediately follow the invoke-kind."
long_desc: "Moves the single-word result of the immediately preceding method invocation into the destination register (vA). vA must be in the first 256-register range (0-255)."
note: "Must immediately follow an invoke-kind with a valid single-word, non-object result. Anywhere else is invalid."
example: "0A00 - move-result v0"
example_desc: "Move the return value of a previous method invocation into v0."

- opcode: "0B"
name: "move-result-wide"
format: "AA|op"
format_id: "11x"
syntax: "move-result-wide vAA"
args_info: "A: destination register (8 bits)"
short_desc: "Moves the wide (double-word) non-object result of the preceding invoke-kind to the specified register-pair."
long_desc: "Moves the wide (double-word) result of the previous method invocation into register-pair (vAA, vAA+1). vA must be in the first 256-register range (0-255)."
note: "Must immediately follow an invoke-kind with a valid double-word result. Anywhere else is invalid."
example: "0B02 - move-result-wide v2"
example_desc: "Move the long/double result value of the previous method invocation into v2,v3."

- opcode: "0C"
name: "move-result-object"
format: "AA|op"
format_id: "11x"
syntax: "move-result-object vAA"
args_info: "A: destination register (8 bits)"
short_desc: "Moves the object result of the preceding invoke-kind to the specified register."
long_desc: "Moves the object result of the previous method invocation into vAA. vA must be in the first 256-register range (0-255)."
note: "Must immediately follow an invoke-kind or filled-new-array with a valid object result. Anywhere else is invalid."
example: "0C00 - move-result-object v0"
example_desc: "Move the object result of the previous method invocation into v0."

- opcode: "0D"
name: "move-exception"
format: "AA|op"
format_id: "11x"
syntax: "move-exception vAA"
args_info: "A: destination register (8 bits)"
short_desc: "Moves the exception object of the most recent exception to the specified register."
long_desc: "Moves the caught exception into vAA. vA must be in the first 256-register range (0-255)."
note: "This must be the first instruction of any exception handler whose caught exception is not to be ignored, and must only *ever* occur as the first instruction of an exception handler; anywhere else is invalid."
example: "0D19 - move-exception v25"
example_desc: "Moves the caught exception into register v25."

- opcode: "0E"
name: "return-void"
format: "ØØ|op"
format_id: "10x"
syntax: "return-void"
args_info: ""
short_desc: "Return from a void method."
long_desc: "Return without a return value, used in void type methods."
note: ""
example: "0E00 - return-void"
example_desc: "Return of a void method without return value."

- opcode: "0F"
name: "return"
format: "AA|op"
format_id: "11x"
syntax: "return vAA"
args_info: "A: return value register (8 bits)"
short_desc: "Return from a single-width (32-bit) non-object value-returning method."
long_desc: "Returns the 32-bit value in vAA to the caller. vA must be in the first 256-register range (0-255)."
note: ""
example: "0F00 - return v0"
example_desc: "Returns with return value in v0."

- opcode: "10"
name: "return-wide"
format: "AA|op"
format_id: "11x"
syntax: "return-wide vAA"
args_info: "A: return value register (8 bits)"
short_desc: "Return from a double-width (64-bit) value-returning method."
long_desc: "Returns a double/long result from register-pair (vAA, vAA+1) to the caller. vA must be in the first 256-register range (0-255)."
note: ""
example: "1000 - return-wide v0"
example_desc: "Returns with a double/long value in v0,v1."

- opcode: "11"
name: "return-object"
format: "AA|op"
format_id: "11x"
syntax: "return-object vAA"
args_info: "A: return value register (8 bits)"
short_desc: "Return from an object-returning method."
long_desc: "Returns the object reference value from vAA to the caller. vA must be in the first 256-register range (0-255)."
note: ""
example: "1100 - return-object v0"
example_desc: "Returns with object reference value in v0."

- opcode: "28"
name: "goto"
format: "AA|op"
Expand Down

0 comments on commit 5865725

Please sign in to comment.