/src/wrappers/llvm/library/iterators/iterator_over_instructions.e

http://github.com/tybor/Liberty · Specman e · 94 lines · 40 code · 17 blank · 37 comment · 0 complexity · 7429bd788fc5c9b1065837c6504b6249 MD5 · raw file

  1. -- This file is part of a Liberty Eiffel library.
  2. -- See the full copyright at the end.
  3. --
  4. class ITERATOR_OVER_INSTRUCTIONS
  5. inherit
  6. BIDIRECTIONAL_ITERATOR[LLVM_INSTRUCTION]
  7. LLVM_INSTRUCTION_FACTORY
  8. insert CORE_EXTERNALS
  9. create {ANY} from_block
  10. feature {LLVM_BASIC_BLOCK}
  11. from_block (a_block: LLVM_BASIC_BLOCK)
  12. require
  13. a_block/=Void
  14. not a_block.is_deleted
  15. do
  16. block:=a_block
  17. end
  18. feature {ANY}
  19. block: LLVM_BASIC_BLOCK
  20. start
  21. do
  22. item := wrapper_or_void(llvmget_first_instruction(block.handle))
  23. end
  24. finish
  25. do
  26. item := wrapper_or_void(llvmget_last_instruction(block.handle))
  27. end
  28. next
  29. do
  30. item := wrapper_or_void(llvmget_next_instruction(item.handle))
  31. end
  32. previous
  33. do
  34. item := wrapper_or_void(llvmget_previous_instruction(item.handle))
  35. end
  36. is_off: BOOLEAN
  37. do
  38. Result:=(item=Void)
  39. end
  40. item: LLVM_INSTRUCTION is attribute end
  41. generation, iterable_generation: INTEGER is 0
  42. invariant block/=Void
  43. end -- class ITERATOR_OVER_INSTRUCTIONS
  44. --
  45. -- Copyright (C) 2009-2017: by all the people cited in the AUTHORS file.
  46. --
  47. -- Permission is hereby granted, free of charge, to any person obtaining a copy
  48. -- of this software and associated documentation files (the "Software"), to deal
  49. -- in the Software without restriction, including without limitation the rights
  50. -- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  51. -- copies of the Software, and to permit persons to whom the Software is
  52. -- furnished to do so, subject to the following conditions:
  53. --
  54. -- The above copyright notice and this permission notice shall be included in
  55. -- all copies or substantial portions of the Software.
  56. --
  57. -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  58. -- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  59. -- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  60. -- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  61. -- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  62. -- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  63. -- THE SOFTWARE.
  64. -- This file is part of LLVM wrappers for Liberty Eiffel.
  65. --
  66. -- This library is free software: you can redistribute it and/or modify
  67. -- it under the terms of the GNU Lesser General Public License as published by
  68. -- the Free Software Foundation, version 3 of the License.
  69. --
  70. -- Liberty Eiffel is distributed in the hope that it will be useful,
  71. -- but WITHOUT ANY WARRANTY; without even the implied warranty of
  72. -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  73. -- GNU General Public License for more details.
  74. --
  75. -- You should have received a copy of the GNU General Public License
  76. -- along with Liberty Eiffel. If not, see <http://www.gnu.org/licenses/>.
  77. --