No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

BurstDisassembler.Core.Wasm.info.cs 13KB

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