/src/wrappers/llvm/library/values/llvm_instruction.e

http://github.com/tybor/Liberty · Specman e · 69 lines · 8 code · 14 blank · 47 comment · 0 complexity · 56e6bbc7d0d0f722c02bc2a97f83df30 MD5 · raw file

  1. deferred class LLVM_INSTRUCTION
  2. -- The Instruction class is the common base class for all LLVM
  3. -- instructions. It provides only a few methods, but is a very commonly
  4. -- used class. The primary data tracked by the Instruction class itself is
  5. -- the opcode (instruction type) and the parent BasicBlock the Instruction
  6. -- is embedded into. To represent a specific type of instruction, one of
  7. -- many subclasses of Instruction are used.
  8. -- Because the Instruction class subclasses the User class, its operands
  9. -- can be accessed in the same way as for other Users (with the
  10. -- getOperand()/getNumOperands() and op_begin()/op_end() methods).
  11. -- An important file for the Instruction class is the llvm/Instruction.def
  12. -- file. This file contains some meta-data about the various different
  13. -- types of instructions in LLVM. It describes the enum values that are
  14. -- used as opcodes (for example Instruction::Add and Instruction::ICmp), as
  15. -- well as the concrete sub-classes of Instruction that implement the
  16. -- instruction (for example BinaryOperator and CmpInst). Unfortunately, the
  17. -- use of macros in this file confuses doxygen, so these enum values don't
  18. -- show up correctly in the doxygen output.
  19. -- Important Subclasses of the Instruction class are:
  20. -- BinaryOperator represents all two operand instructions whose operands must be the same type, except for the comparison instructions.
  21. -- CastInst, the parent of the 12 casting instructions. It provides common operations on cast instructions.
  22. -- CmpInst respresents the two comparison instructions, ICmpInst (integer opreands), and FCmpInst (floating point operands).
  23. -- TerminatorInst is the parent of all terminator instructions (those which can terminate a block).
  24. inherit LLVM_USER
  25. feature {ANY} -- TODO: Important Public Members of the Instruction class
  26. parent: LLVM_BASIC_BLOCK
  27. -- The parent block containing Current instruction
  28. do
  29. create Result.from_external_pointer(llvmget_param_parent(handle))
  30. end
  31. -- bool mayWriteToMemory()
  32. -- Returns true if the instruction writes to memory, i.e. it is a call,free,invoke, or store.
  33. --
  34. -- unsigned getOpcode()
  35. -- Returns the opcode for the Instruction.
  36. --
  37. -- Instruction *clone() const
  38. -- Returns another instance of the specified instruction, identical in all ways to the original except that the instruction has no parent (ie it's not embedded into a BasicBlock), and it has no name
  39. --
  40. end -- class LLVM_INSTRUCTION
  41. -- Copyright (C) 2009-2017: LLVM Team and 2009 Paolo Redaelli
  42. -- This file is part of LLVM wrappers for Liberty Eiffel.
  43. --
  44. -- This library is free software: you can redistribute it and/or modify
  45. -- it under the terms of the GNU Lesser General Public License as published by
  46. -- the Free Software Foundation, version 3 of the License.
  47. --
  48. -- Liberty Eiffel is distributed in the hope that it will be useful,
  49. -- but WITHOUT ANY WARRANTY; without even the implied warranty of
  50. -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  51. -- GNU General Public License for more details.
  52. --
  53. -- You should have received a copy of the GNU General Public License
  54. -- along with Liberty Eiffel. If not, see <http://www.gnu.org/licenses/>.
  55. --