/src/wrappers/llvm/library/types/llvm_integer_type.e

http://github.com/tybor/Liberty · Specman e · 126 lines · 79 code · 22 blank · 25 comment · 0 complexity · fd2b3ead2e995b6d018d464f909a21dd MD5 · raw file

  1. class LLVM_INTEGER_TYPE
  2. -- Integer representation type in LLVM.
  3. -- It represents integer types, including the built-in 1-bit. 8-bit,
  4. -- 16-bit, 32-bit and 64-bit.
  5. -- The underlying C++ function to get or create an IntegerType pointer is
  6. -- "const IntegerType *IntegerType::get ( LLVMContext & C, unsigned
  7. -- NumBits )" and is a static method and it's the primary way of
  8. -- constructing an IntegerType. If an IntegerType with the same NumBits
  9. -- value was previously instantiated, that instance will be returned.
  10. -- Otherwise a new one will be created. Only one instance with a given
  11. -- NumBits value is ever created.
  12. inherit
  13. LLVM_TYPE
  14. create {WRAPPER, WRAPPER_HANDLER} from_external_pointer
  15. create {ANY}
  16. with_1_bit, with_1_bit_in_context,
  17. with_8_bits, with_8_bits_in_context,
  18. with_16_bits, with_16_bits_in_context,
  19. with_32_bits, with_32_bits_in_context,
  20. with_64_bits, with_64_bits_in_context,
  21. with_bits, with_bits_in_context
  22. feature {} -- Creation in a specific context
  23. with_1_bit_in_context (a_context: LLVM_CONTEXT)
  24. require
  25. a_context /= Void
  26. do
  27. handle := llvmint1type_in_context(a_context.handle)
  28. end
  29. with_8_bits_in_context (a_context: LLVM_CONTEXT)
  30. require
  31. a_context /= Void
  32. do
  33. handle := llvmint8type_in_context(a_context.handle)
  34. end
  35. with_16_bits_in_context (a_context: LLVM_CONTEXT)
  36. require
  37. a_context /= Void
  38. do
  39. handle := llvmint16type_in_context(a_context.handle)
  40. end
  41. with_32_bits_in_context (a_context: LLVM_CONTEXT)
  42. require
  43. a_context /= Void
  44. do
  45. handle := llvmint32type_in_context(a_context.handle)
  46. end
  47. with_64_bits_in_context (a_context: LLVM_CONTEXT)
  48. require
  49. a_context /= Void
  50. do
  51. handle := llvmint1type_in_context(a_context.handle)
  52. end
  53. with_bits_in_context (a_bit_count: NATURAL_32)
  54. do
  55. handle := llvmint_type(a_bit_count)
  56. end
  57. feature {} -- Creation in global context
  58. with_1_bit
  59. do
  60. handle := llvmint1type
  61. end
  62. with_8_bits
  63. do
  64. handle := llvmint8type
  65. end
  66. with_16_bits
  67. do
  68. handle := llvmint16type
  69. end
  70. with_32_bits
  71. do
  72. handle := llvmint32type
  73. end
  74. with_64_bits
  75. do
  76. handle := llvmint64type
  77. end
  78. with_bits (a_bit_count: NATURAL_32)
  79. do
  80. handle := llvmint_type(a_bit_count)
  81. end
  82. feature {ANY}
  83. width: NATURAL_32
  84. do
  85. Result := llvmget_int_type_width(handle)
  86. end
  87. invariant
  88. type_kind.is_integer_type_kind
  89. end -- class LLVM_INTEGER_TYPE
  90. -- Copyright (C) 2009-2017: Paolo Redaelli
  91. -- This file is part of LLVM wrappers for Liberty Eiffel.
  92. --
  93. -- This library is free software: you can redistribute it and/or modify
  94. -- it under the terms of the GNU Lesser General Public License as published by
  95. -- the Free Software Foundation, version 3 of the License.
  96. --
  97. -- Liberty Eiffel is distributed in the hope that it will be useful,
  98. -- but WITHOUT ANY WARRANTY; without even the implied warranty of
  99. -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  100. -- GNU General Public License for more details.
  101. --
  102. -- You should have received a copy of the GNU General Public License
  103. -- along with Liberty Eiffel. If not, see <http://www.gnu.org/licenses/>.
  104. --