Function.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. /*
  2. * Copyright (C) 2022 The V-Gears Team
  3. *
  4. * This file is part of V-Gears
  5. *
  6. * V-Gears is free software: you can redistribute it and/or modify it under
  7. * terms of the GNU General Public License as published by the Free Software
  8. * Foundation, version 3.0 (GPLv3) of the License.
  9. *
  10. * V-Gears 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. #pragma once
  16. #include <set>
  17. #include "CodeGenerator.h"
  18. #include "Disassembler.h"
  19. /**
  20. * Structure representing a function.
  21. */
  22. class Function {
  23. public:
  24. /**
  25. * Constructor.
  26. *
  27. * Required for use with STL, should not be called manually.
  28. */
  29. Function();
  30. /**
  31. * Constructor.
  32. *
  33. * @param start_addr[in] Address of the first instruction in the function.
  34. * @param end_addr[in] Address of the last instruction in the function
  35. */
  36. Function(uint32 start_addr, uint32 end_addr);
  37. /**
  38. * The function starting address.
  39. */
  40. uint32 start_addr = 0;
  41. /**
  42. * The function ending address.
  43. */
  44. uint32 end_addr = 0;
  45. /**
  46. * Number of instructions in the function.
  47. */
  48. uint32 num_instructions = 0;
  49. /**
  50. * The name of the function.
  51. */
  52. std::string name;
  53. /**
  54. * The function vertex.
  55. */
  56. GraphVertex vertex;
  57. /**
  58. * Number of arguments in the function.
  59. */
  60. uint32 num_args;
  61. /**
  62. * Return value of the function.
  63. */
  64. bool ret_val;
  65. /**
  66. * Metadata for code generation.
  67. */
  68. std::string metadata;
  69. };