A game about forced loneliness, made by TACStudios
at master 263 lines 13 kB view raw
1namespace Unity.Burst.Editor 2{ 3 internal partial class BurstDisassembler 4 { 5 internal class WasmInstructionInfo 6 { 7 internal static bool GetWasmInfo(string instructionName, out string instructionInfo) 8 { 9 var returnValue = true; 10 11 switch (instructionName) 12 { 13 case "if": 14 instructionInfo = "Executes a statement if the last item on the stack is true."; 15 break; 16 case "end": 17 instructionInfo = "Can be used to end a block, loop, if or else."; 18 break; 19 case "end_function": 20 instructionInfo = "Ends function."; 21 break; 22 case "block": 23 instructionInfo = "Creates a label that can later be branched out of with a br."; 24 break; 25 case "end_block": 26 instructionInfo = "Ends the previous opened block."; 27 break; 28 case "loop": 29 instructionInfo = "Creates a label that can later be branched to with a br."; 30 break; 31 case "end_loop": 32 instructionInfo = "Ends the previous opened loop label."; 33 break; 34 case "unreachable": 35 instructionInfo = "Denotes a point in code that should not be reachable."; 36 break; 37 case "nop": 38 instructionInfo = "Does nothing."; 39 break; 40 case "call": 41 instructionInfo = "Calls a function."; 42 break; 43 case "call_indirect": 44 instructionInfo = "Calls a function in a table."; 45 break; 46 case "drop": 47 instructionInfo = "Pops a value from the stack, and discards it."; 48 break; 49 case "select": 50 instructionInfo = "Selects one of its first two operands based on a boolean condition."; 51 break; 52 case "get": 53 instructionInfo = "Load the value of a variable onto the stack."; 54 break; 55 case "set": 56 instructionInfo = "Set the value of a variable."; 57 break; 58 case "tee": 59 instructionInfo = "Set the value of a variable and keep the value on the stack."; 60 break; 61 case "load": 62 instructionInfo = "Load a number from memory."; 63 break; 64 case "load8_s": 65 instructionInfo = "Load a signed 8-bit value from memory."; 66 break; 67 case "load8_u": 68 instructionInfo = "Load an unsigned 8-bit value from memory."; 69 break; 70 case "load16_s": 71 instructionInfo = "Load a signed 16-bit value from memory."; 72 break; 73 case "load16_u": 74 instructionInfo = "Load an unsigned 16-bit value from memory."; 75 break; 76 case "load32_s": 77 instructionInfo = "Load a signed 32-bit value from memory."; 78 break; 79 case "load32_u": 80 instructionInfo = "Load an unsigned 32-bit value from memory."; 81 break; 82 case "store": 83 instructionInfo = "Store a number in memory."; 84 break; 85 case "store8": 86 instructionInfo = "Store a 8-bit number in memory."; 87 break; 88 case "store16": 89 instructionInfo = "Store a 16-bit number in memory."; 90 break; 91 case "store32": 92 instructionInfo = "Store a 32-bit number in memory."; 93 break; 94 case "size": 95 instructionInfo = "Get the size of the memory instance."; 96 break; 97 case "grow": 98 instructionInfo = "Increase the size of the memory instance."; 99 break; 100 case "const": 101 instructionInfo = "Declare a constant number."; 102 break; 103 case "clz": 104 instructionInfo = "Count leading zeros in a numbers binary representation."; 105 break; 106 case "ctz": 107 instructionInfo = "Count trailing zeros in a numbers binary representation."; 108 break; 109 case "popcnt": 110 instructionInfo = "Count the number of '1' in a numbers binary representation."; 111 break; 112 case "add": 113 instructionInfo = "Add up two numbers."; 114 break; 115 case "sub": 116 instructionInfo = "Subtract one number from another number."; 117 break; 118 case "mul": 119 instructionInfo = "Multiply one number by another number."; 120 break; 121 case "div_s": 122 instructionInfo = "Divide two signed numbers."; 123 break; 124 case "div_u": 125 instructionInfo = "Divide two unsigned numbers."; 126 break; 127 case "rem_s": 128 instructionInfo = "Calculate the remainder left over when two signed integers are divided."; 129 break; 130 case "rem_u": 131 instructionInfo = "Calculate the remainder left over when two unsigned integers are divided."; 132 break; 133 case "and": 134 instructionInfo = "Bitwise and operation."; 135 break; 136 case "or": 137 instructionInfo = "Bitwise or operation."; 138 break; 139 case "xor": 140 instructionInfo = "Bitwise exclusive or operation."; 141 break; 142 case "shl": 143 instructionInfo = "Bitwise shift left operation."; 144 break; 145 case "shr_s": 146 instructionInfo = "Bitwise signed shift right operation."; 147 break; 148 case "shr_u": 149 instructionInfo = "Bitwise unsigned shift right operation."; 150 break; 151 case "rotl": 152 instructionInfo = "Bitwise rotate left operation."; 153 break; 154 case "rotr": 155 instructionInfo = "Bitwise rotate right operation."; 156 break; 157 case "abs": 158 instructionInfo = "Get the absolute value of a number."; 159 break; 160 case "neg": 161 instructionInfo = "Negate a number."; 162 break; 163 case "ceil": 164 instructionInfo = "Round up a number."; 165 break; 166 case "floor": 167 instructionInfo = "Round down a number."; 168 break; 169 case "trunc": 170 instructionInfo = "Discard the fractional part of a number."; 171 break; 172 case "sqrt": 173 instructionInfo = "Get the square root of a number."; 174 break; 175 case "div": 176 instructionInfo = "Divide two numbers."; 177 break; 178 case "min": 179 instructionInfo = "Get the lower of two numbers."; 180 break; 181 case "max": 182 instructionInfo = "Get the highest of two numbers."; 183 break; 184 case "copysign": 185 instructionInfo = "Copy just the sign bit from one number to another."; 186 break; 187 case "wrap_i64": 188 instructionInfo = "Convert (wrap) i64 number to i32 number."; 189 break; 190 case "trunc_f32_s": 191 instructionInfo = "Truncate fractional part away from a signed 32-bit floating number, giving a " + 192 "signed 32-bit integer."; 193 break; 194 case "trunc_f32_u": 195 instructionInfo = "Truncate fractional part away from a unsigned 32-bit floating number, giving a " + 196 "unsigned 32-bit integer."; 197 break; 198 case "trunc_f64_s": 199 instructionInfo = "Truncate fractional part away from a signed 64-bit floating number, giving a " + 200 "signed 64-bit integer."; 201 break; 202 case "trunc_f64_u": 203 instructionInfo = "Truncate fractional part away from a unsigned 64-bit floating number, giving a " + 204 "unsigned 64-bit integer."; 205 break; 206 case "extend_i32_s": 207 instructionInfo = "Convert (extend) signed 32-bit integer to signed 64-bit integer number."; 208 break; 209 case "extend_i32_u": 210 instructionInfo = "Convert (extend) unsigned 32-bit integer to unsigned 64-bit integer number."; 211 break; 212 case "convert_i32_s": 213 instructionInfo = "Convert signed 32-bit integer to signed 32-bit floating number."; 214 break; 215 case "convert_i32_u": 216 instructionInfo = "Convert unsigned 32-bit integer to unsigned 32-bit floating number."; 217 break; 218 case "convert_i64_s": 219 instructionInfo = "Convert signed 64-bit integer to signed 64-bit floating number."; 220 break; 221 case "convert_i64_u": 222 instructionInfo = "Convert unsigned 64-bit integer to unsigned 64-bit floating number."; 223 break; 224 case "demote_f64": 225 instructionInfo = "Convert (demote) 64-bit floating number to 32-bit floating number."; 226 break; 227 case "promote_f32": 228 instructionInfo = "Convert (promote) 32-bit floating number to 64-bit floating number."; 229 break; 230 case "reinterpret_f32": 231 instructionInfo = "Reinterpret the bytes of 32-bit floating number as 32-bit integer number."; 232 break; 233 case "reinterpret_f64": 234 instructionInfo = "Reinterpret the bytes of 64-bit floating number as 64-bit integer number."; 235 break; 236 case "reinterpret_i32": 237 instructionInfo = "Reinterpret the bytes of 32-bit integer number as 32-bit floating number."; 238 break; 239 case "reinterpret_i64": 240 instructionInfo = "Reinterpret the bytes of 64-bit integer number as 64-bit floating number."; 241 break; 242 case "br_if": 243 instructionInfo = "Branch to a loop or block if condition is true."; 244 break; 245 case "br": 246 instructionInfo = "Branch to a loop or block."; 247 break; 248 case "br_table": 249 instructionInfo = "Branch to a loop or block if condition based on argument."; 250 break; 251 case "return": 252 instructionInfo = "Returns from a function."; 253 break; 254 default: 255 instructionInfo = string.Empty; 256 break; 257 } 258 259 return returnValue; 260 } 261 } 262 } 263}