FieldUncondJumpInstruction.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. /*
  2. * V-Gears
  3. * Copyright (C) 2022 V-Gears Team
  4. *
  5. * This program is free software: you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation, either version 3 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. #pragma once
  19. #include "decompiler/instruction/UncondJumpInstruction.h"
  20. /**
  21. * An unconditional map jump instruction.
  22. */
  23. class FieldUncondJumpInstruction : public UncondJumpInstruction{
  24. public:
  25. /**
  26. * Constructor.
  27. */
  28. FieldUncondJumpInstruction();
  29. /**
  30. * Indicates if the instruction is a function call.
  31. *
  32. * @return true if the instruction is a function call, false if not.
  33. */
  34. virtual bool IsFuncCall() const;
  35. /**
  36. * Indicates if the instruction is an unconditional jump.
  37. *
  38. * @return true if the instruction is an unconditional jump, false if
  39. * it's not.
  40. */
  41. virtual bool IsUncondJump() const;
  42. /**
  43. * Retrieves the destination address of the jump.
  44. *
  45. * @return The offset (number of bytes) to jump from the beginning of
  46. * the instruction.
  47. */
  48. virtual uint32 GetDestAddress() const;
  49. /**
  50. * Processes the instruction.
  51. *
  52. * @param func[in] Function to process.
  53. * @param stack[out] Function stack. Unused.
  54. * @param engine[in] The engine. Unused
  55. * @param codegen[in|out] Code generator to append lines.
  56. */
  57. virtual void ProcessInst(
  58. Function& func, ValueStack &stack, Engine *engine, CodeGenerator *code_gen
  59. ) override;
  60. /**
  61. * Prints the instruction
  62. *
  63. * @param[in] output The stream to print the instruction to.
  64. * @return The same output.
  65. */
  66. virtual std::ostream& Print(std::ostream &output) const override;
  67. private:
  68. /**
  69. * Whether or not this is really a call to a script function.
  70. */
  71. bool is_func_call_;
  72. };