PageRenderTime 5ms CodeModel.GetById 2ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

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