Instruction.cpp 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /*
  2. Copyright (c) 2018 tevador
  3. This file is part of RandomX.
  4. RandomX 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 3 of the License, or
  7. (at your option) any later version.
  8. RandomX 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 RandomX. If not, see<http://www.gnu.org/licenses/>.
  14. */
  15. #include "Instruction.hpp"
  16. namespace RandomX {
  17. void Instruction::print(std::ostream& os) const {
  18. os << " A: loc = " << std::dec << (loca & 7) << ", reg: " << (rega & 7) << std::endl;
  19. os << " B: loc = " << (locb & 7) << ", reg: " << (regb & 7) << std::endl;
  20. os << " C: loc = " << (locc & 7) << ", reg: " << (regc & 7) << std::endl;
  21. os << " addra = " << std::hex << addra << std::endl;
  22. os << " addrc = " << addrc << std::endl;
  23. os << " imm8 = " << std::dec << (int)imm8 << std::endl;
  24. os << " imm32 = " << imm32 << std::endl;
  25. }
  26. #include "instructionWeights.hpp"
  27. #define INST_NAME(x) REPN(#x, WT(x))
  28. const char* Instruction::names[256] = {
  29. INST_NAME(ADD_64)
  30. INST_NAME(ADD_32)
  31. INST_NAME(SUB_64)
  32. INST_NAME(SUB_32)
  33. INST_NAME(MUL_64)
  34. INST_NAME(MULH_64)
  35. INST_NAME(MUL_32)
  36. INST_NAME(IMUL_32)
  37. INST_NAME(IMULH_64)
  38. INST_NAME(DIV_64)
  39. INST_NAME(IDIV_64)
  40. INST_NAME(AND_64)
  41. INST_NAME(AND_32)
  42. INST_NAME(OR_64)
  43. INST_NAME(OR_32)
  44. INST_NAME(XOR_64)
  45. INST_NAME(XOR_32)
  46. INST_NAME(SHL_64)
  47. INST_NAME(SHR_64)
  48. INST_NAME(SAR_64)
  49. INST_NAME(ROL_64)
  50. INST_NAME(ROR_64)
  51. INST_NAME(FPADD)
  52. INST_NAME(FPSUB)
  53. INST_NAME(FPMUL)
  54. INST_NAME(FPDIV)
  55. INST_NAME(FPSQRT)
  56. INST_NAME(FPROUND)
  57. INST_NAME(JUMP)
  58. INST_NAME(CALL)
  59. INST_NAME(RET)
  60. };
  61. }