Skip to content

Commit

Permalink
Update grammar.yaml (#23)
Browse files Browse the repository at this point in the history
Co-authored-by: AbhiTheModder <AbhiTheModder@users.noreply.github.com>
  • Loading branch information
github-actions[bot] and AbhiTheModder authored Dec 27, 2024
1 parent 4f4f3f0 commit 4f012d4
Showing 1 changed file with 69 additions and 17 deletions.
86 changes: 69 additions & 17 deletions public/grammar.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@
# - vA: It is always a destination register on this document and a single <A> represents a 4-bit register, i.e, first 16 registers (0-15).
# As such vAA represents an 8-bit register, i.e, first 256 registers (0-255), and vAAAA represents a 16-bit register, i.e, first 64k registers (0-65535).
# - vB: It is always a source register on this document and denotion of <B> is same as <A>.
# Arguments which indicate a literal value have the form "#+X".
# Arguments which indicate a relative instruction address offset have the form "+X".
# Arguments which indicate a literal constant pool index have the form "kind@X", where "kind" indicates which constant pool is being referred to.

- opcode: "00"
name: "nop"
format: "ØØ|op"
Expand All @@ -23,7 +27,7 @@
args_info: ""
short_desc: "No operation"
long_desc: "Does nothing, Waste cycles."
note: "Data-bearing pseudo-instructions are tagged with this opcode, in which case the high-order byte of the opcode unit indicates the nature of the data. See \"packed-switch-payload Format\", \"sparse-switch-payload Format\", and \"fill-array-data-payload Format\"."
note: 'Data-bearing pseudo-instructions are tagged with this opcode, in which case the high-order byte of the opcode unit indicates the nature of the data. See "packed-switch-payload Format", "sparse-switch-payload Format", and "fill-array-data-payload Format".'
example: "0000 - nop"
example_desc: "Does nothing, Waste cycles"

Expand All @@ -34,7 +38,7 @@
syntax: "move vA, vB"
args_info: "A: destination register (4 bits), B: source register (4 bits)"
short_desc: "Move the contents of one non-object register to another."
long_desc: "Moves the content of vB into vA. Both registers must be in the first 16 register range (0-15)."
long_desc: "Moves the content of vB into vA. Both registers is in the first 16 register range (0-15)."
note: ""
example: "0110 - move v0, v1"
example_desc: "Moves the content of v1 into v0."
Expand All @@ -46,7 +50,7 @@
syntax: "move/from16 vAA, vBBBB"
args_info: "A: destination register (8 bits), B: source register (16 bits)"
short_desc: "Move the contents of one non-object register to another."
long_desc: "Moves the content of vB into vA. vB must be in the 64k register range (0-65535) while vA is one of the first 256 registers (0-255)."
long_desc: "Moves the content of vB into vA. vB is in the 64k register range (0-65535) while vA is one of the first 256 registers (0-255)."
note: ""
example: "0200 1900 - move/from16 v0, v25"
example_desc: "Moves the content of v25 into v0."
Expand All @@ -58,7 +62,7 @@
syntax: "move/16 vAAAA, vBBBB"
args_info: "A: destination register (16 bits), B: source register (16 bits)"
short_desc: "Move the contents of one non-object register to another."
long_desc: "Moves the content of vB into vA. Both registers must be in the first 64k register range (0-65535) & 16 bits."
long_desc: "Moves the content of vB into vA. Both registers is in the first 64k register range (0-65535) & 16 bits."
note: ""
example: "030000090181 - move/16 v2304, v33025"
example_desc: "Moves the content of v33025 into v2304."
Expand All @@ -70,7 +74,7 @@
syntax: "move-wide vA, vB"
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)."
long_desc: "Move the value of the (vB, vB+1) register-pair to the (vA, vA+1) register-pair. Both register-pairs is 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: ""
Expand All @@ -82,7 +86,7 @@
syntax: "move-wide/from16 vAA, vBBBB"
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)."
long_desc: "Move the value (long/double) of the (vBBBB, vBBBB+1) register-pair to the (vAA, vAA+1) register-pair. vB is 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."
example: "0516 0000 - move-wide/from16 v22, v0"
example_desc: "Moves the content of register-pair (v0, v0+1) into (v22, v22+1)."
Expand All @@ -94,7 +98,7 @@
syntax: "move-wide/from16 vAAAA, vBBBB"
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."
long_desc: "Move the value of the (vBBBB, vBBBB+1) register-pair to the (vAAAA, vAAAA+1) register-pair. Both register-pairs is 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: ""
Expand All @@ -106,7 +110,7 @@
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)."
long_desc: "Move the value of register vB to register vA. Both registers is in the first 16 register range (0-15)."
note: ""
example: "0781 - move-object v1, v8"
example_desc: "Moves the content of v8 to v1."
Expand All @@ -118,7 +122,7 @@
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)."
long_desc: "Move the value of register vBBBB to register vAA. vB is 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."
Expand All @@ -130,7 +134,7 @@
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."
long_desc: "Move the value of register vBBBB to register vAAAA. Both registers is in the first 64k register range (0-65535) & 16 bits."
note: ""
example: ""
example_desc: ""
Expand All @@ -142,7 +146,7 @@
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)."
long_desc: "Moves the single-word result of the immediately preceding method invocation into the destination register (vA). vA is 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."
Expand All @@ -154,7 +158,7 @@
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)."
long_desc: "Moves the wide (double-word) result of the previous method invocation into register-pair (vAA, vAA+1). vA is 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."
Expand All @@ -166,7 +170,7 @@
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)."
long_desc: "Moves the object result of the previous method invocation into vAA. vA is 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."
Expand All @@ -178,7 +182,7 @@
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)."
long_desc: "Moves the caught exception into vAA. vA is 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."
Expand All @@ -202,7 +206,7 @@
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)."
long_desc: "Returns the 32-bit value in vAA to the caller. vA is in the first 256-register range (0-255)."
note: ""
example: "0F00 - return v0"
example_desc: "Returns with return value in v0."
Expand All @@ -214,7 +218,7 @@
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)."
long_desc: "Returns a double/long result from register-pair (vAA, vAA+1) to the caller. vA is 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."
Expand All @@ -226,11 +230,59 @@
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)."
long_desc: "Returns the object reference value from vAA to the caller. vA is in the first 256-register range (0-255)."
note: ""
example: "1100 - return-object v0"
example_desc: "Returns with object reference value in v0."

- opcode: "12"
name: "const/4"
format: "B|A|op"
format_id: "11n"
syntax: "const/4 vA, #+B"
args_info: "A: destination register (4 bits), B: signed int (4 bits)"
short_disc: "Move the given literal value (sign-extended to 32 bits) into the specified register."
long_desc: "Moves the literal value B into vA. B is sign-extended to 32 bits. The value of B is in the range -8 to 7 (-0x8 to 0x7)."
note: ""
example: "1200 0001 - const/4 v0, 0x1"
example_desc: "Moves the literal value 0x1(1) into v0."

- opcode: "13"
name: "const/16"
format: "AA|op BBBB"
format_id: "21s"
syntax: "const/16 vAA, #+BBBB"
args_info: "A: destination register (8 bits), B: signed int (16 bits)"
short_desc: "Move the given literal value (sign-extended to 32 bits) into the specified register."
long_desc: "Moves the literal value BBBB into vAA. BBBB is sign-extended to 32 bits. The value of BBBB is in the range -32768 to 32767 (-0x8000 to 0x7FFF)."
note: ""
example: "1300 0A00 - const/16 v0, 0xa"
example_desc: "Moves the literal value 0xa(10) into v0."

- opcode: "14"
name: "const"
format: "AA|op BBBBlo"
format_id: "31i"
syntax: "const vAA, #+BBBBBBBB"
args_info: "A: destination register (8 bits), B: arbitrary constant (32 bits)"
short_desc: "Move the given literal value into the specified register."
long_desc: "Moves the literal value BBBB into vAA. BBBB is a 32-bit constant. The value of BBBB is in the range -2147483648 to 2147483647 (-0x80000000 to 0x7FFFFFFF)."
note: ""
example: "1400 4E61BC00 - const v0, 0xBC614E"
example_desc: "Moves the literal value 0xBC614E(12345678) into v0."

- opcode: "15"
name: "const/high16"
format: "AA|op BBBB"
format_id: "21h"
syntax: "const/high16 vAA, #+BBBB0000"
args_info: "A: destination register (8 bits), B: signed int (16 bits)"
short_desc: "Move the given literal value (right-zero-extended to 32 bits) into the specified register."
long_desc: "Moves the literal value BBBB0000 into vAA. BBBB is right-zero-extended to 32 bits. The value of BBBB is in the range -32768 to 32767 (-0x80000000 to 0x7FFF0000)."
note: "Generaly used to initialise float values."
example: "1500 2041 - const/high16 v0, 0x41200000 (#float 10.0)"
example_disc: "Moves the floating literal value 0x41200000(10.0) into v0. The 16 bit literal in the instruction carries the top 16 bits of the floating point number."

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

0 comments on commit 4f012d4

Please sign in to comment.