itcpuwasm.pas 4.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. {
  2. Copyright (c) 2016 by Karoly Balogh
  3. This unit contains the WebAssembly instruction tables
  4. This program is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 2 of the License, or
  7. (at your option) any later version.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with this program; if not, write to the Free Software
  14. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  15. ****************************************************************************
  16. }
  17. unit itcpuwasm;
  18. {$i fpcdefs.inc}
  19. interface
  20. uses
  21. cpubase,cgbase;
  22. const
  23. wasm_op2str : array[tasmop] of string[31] = ( '<none>',
  24. // control flow
  25. 'block', 'loop', 'br', 'br_if', 'br_table', 'if', 'else', 'end',
  26. 'return', 'unreachable',
  27. // basic
  28. 'nop', 'drop', 'i32.const', 'i64.const', 'f32.const', 'f64.const',
  29. 'get_local', 'set_local', 'tee_local', 'get_global', 'set_global',
  30. 'select', 'call', 'call_indirect',
  31. // integer
  32. 'i32.add', 'i64.add', 'i32.sub', 'i64.sub', 'i32.mul', 'i64.mul',
  33. 'i32.div_s', 'i64.div_s', 'i32.div_u', 'i64.div_u', 'i32.rem_s', 'i64.rem_s',
  34. 'i32.rem_u', 'i64.rem_u', 'i32.and', 'i64.and', 'i32.or', 'i64.or',
  35. 'i32.xor', 'i64.xor', 'i32.shl', 'i64.shl', 'i32.shr_s', 'i64.shr_s',
  36. 'i32.shr_u', 'i64.shr_u', 'i32.rotl', 'i64.rotl', 'i32.rotr', 'i64.rotr',
  37. 'i32.clz', 'i64.clz', 'i32.ctz', 'i64.ctz', 'i32.popcnt', 'i64.popcnt',
  38. 'i32.eqz', 'i64.eqz',
  39. // floating point
  40. 'f32.add', 'f64.add', 'f32.sub', 'f64.sub', 'f32.mul', 'f64.mul',
  41. 'f32.div', 'f64.div', 'f32.sqrt', 'f64.sqrt', 'f32.min', 'f64.min',
  42. 'f32.max', 'f64.max', 'f32.ceil', 'f64.ceil', 'f32.floor', 'f64.floor',
  43. 'f32.trunc', 'f64.trunc', 'f32.nearest', 'f64.nearest', 'f32.abs', 'f64.abs',
  44. 'f32.neg', 'f64.neg', 'f32.copysign', 'f64.copysign',
  45. // integer compare
  46. 'i32.eq', 'i64.eq', 'i32.ne', 'i64.ne', 'i32.lt_s', 'i64.lt_s',
  47. 'i32.lt_u', 'i64.lt_u', 'i32.le_s', 'i64.le_s', 'i32.le_u', 'i64.le_u',
  48. 'i32.gt_s', 'i64.gt_s', 'i32.gt_u', 'i64.gt_u', 'i32.ge_s', 'i64.ge_s',
  49. 'i32.ge_u', 'i64.ge_u',
  50. // floating point compare
  51. 'f32.eq', 'f64.eq', 'f32.ne', 'f64.ne', 'f32.lt', 'f64.lt',
  52. 'f32.le', 'f64.le', 'f32.gt', 'f64.gt', 'f32.ge', 'f64.gt',
  53. // conversion
  54. 'i32.wrap/i64', 'i64.extend_s/i32', 'i64.extend_u/i32',
  55. 'i32.trunc_s/f32', 'i32.trunc_s/f64', 'i64.trunc_s/f32', 'i64.trunc_s/f64',
  56. 'i32.trunc_u/f32', 'i32.trunc_u/f64', 'i64.trunc_u/f32', 'i64.trunc_u/f64',
  57. 'f32.demote/f64', 'f64.promote/f32',
  58. 'f32.convert_s/i32', 'f32.convert_s/i64', 'f64.convert_s/i32', 'f64.convert_s/i64',
  59. 'f32.convert_u/i32', 'f32.convert_u/i64', 'f64.convert_u/i32', 'f64.convert_u/i64',
  60. 'i32.reinterpret/f32', 'i64.reinterpret/f64', 'f32.reinterpret/i32', 'f64.reinterpret/i64',
  61. // load/store
  62. 'i32.load', 'i64.load', 'f32.load', 'f64.load',
  63. 'i32.store', 'i64.store', 'f32.store', 'f64.store',
  64. 'i32.load8_s', 'i32.load16_s', 'i64.load8_s', 'i64.load16_s', 'i64.load32_s',
  65. 'i32.load8_u', 'i32.load16_u', 'i64.load8_u', 'i64.load16_u', 'i64.load32_u',
  66. 'i32.store8', 'i32.store16', 'i64.store8', 'i64.store16', 'i64.store32',
  67. // additional memory
  68. 'grow_memory', 'current_memory'
  69. ,'<none>','<none>','<none>','<none>','<none>','<none>','<none>','<none>','<none>','<none>'
  70. ,'<none>','<none>','<none>','<none>','<none>','<none>','<none>','<none>','<none>','<none>'
  71. ,'<none>','<none>','<none>','<none>','<none>','<none>','<none>','<none>','<none>','<none>'
  72. );
  73. implementation
  74. end.