instructions.c 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. // SPDX-License-Identifier: GPL-2.0
  2. static
  3. struct ins_ops *mips__associate_ins_ops(struct arch *arch, const char *name)
  4. {
  5. struct ins_ops *ops = NULL;
  6. if (!strncmp(name, "bal", 3) ||
  7. !strncmp(name, "bgezal", 6) ||
  8. !strncmp(name, "bltzal", 6) ||
  9. !strncmp(name, "bgtzal", 6) ||
  10. !strncmp(name, "blezal", 6) ||
  11. !strncmp(name, "beqzal", 6) ||
  12. !strncmp(name, "bnezal", 6) ||
  13. !strncmp(name, "bgtzl", 5) ||
  14. !strncmp(name, "bltzl", 5) ||
  15. !strncmp(name, "bgezl", 5) ||
  16. !strncmp(name, "blezl", 5) ||
  17. !strncmp(name, "jialc", 5) ||
  18. !strncmp(name, "beql", 4) ||
  19. !strncmp(name, "bnel", 4) ||
  20. !strncmp(name, "jal", 3))
  21. ops = &call_ops;
  22. else if (!strncmp(name, "jr", 2))
  23. ops = &ret_ops;
  24. else if (name[0] == 'j' || name[0] == 'b')
  25. ops = &jump_ops;
  26. else
  27. return NULL;
  28. arch__associate_ins_ops(arch, name, ops);
  29. return ops;
  30. }
  31. static
  32. int mips__annotate_init(struct arch *arch, char *cpuid __maybe_unused)
  33. {
  34. if (!arch->initialized) {
  35. arch->associate_instruction_ops = mips__associate_ins_ops;
  36. arch->initialized = true;
  37. arch->objdump.comment_char = '#';
  38. }
  39. return 0;
  40. }