PageRenderTime 20ms CodeModel.GetById 16ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

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

http://github.com/tybor/Liberty
Specman e | 81 lines | 46 code | 13 blank | 22 comment | 0 complexity | 7921f62e39da61f62dd1e54fb0cdb0e0 MD5 | raw file
 1class LLVM_REAL_TYPE
 2-- Float: 32bit
 3-- Double: 64 bit
 4-- X86: 80 bit
 5-- fp128: 128bit with 112 bit of mantissa
 6-- ppc_fp128: 128 bit (two 64 bits)
 7
 8inherit LLVM_TYPE
 9
10create {ANY}
11   from_external_pointer,
12   as_float, as_float_in_context,
13   as_double, as_double_in_context,
14   as_x86, as_x86_in_context,
15   with_128bits, with_128bits_in_context
16      -- TODO: allow creation of fp128 and ppc_fp128
17
18feature {} -- Creation
19   as_float
20      do
21         handle := llvmfloat_type
22      end
23
24   as_float_in_context (a_context: LLVM_CONTEXT)
25      require a_context/=Void
26      do
27         handle:=llvmfloat_type_in_context(a_context.handle)
28      end
29
30   as_double
31      do
32         handle := llvmdouble_type
33      end
34
35   with_128bits
36      do
37         handle := llvmfp128type
38      end
39
40   with_128bits_in_context (a_context: LLVM_CONTEXT)
41      require a_context/=Void
42      do
43         handle:=llvmfp128type_in_context(a_context.handle)
44      end
45
46   as_double_in_context (a_context: LLVM_CONTEXT)
47      require a_context/=Void
48      do
49         handle:=llvmdouble_type_in_context(a_context.handle)
50      end
51
52   as_x86
53      do
54         handle := llvmx86fp80type
55      end
56
57   as_x86_in_context (a_context: LLVM_CONTEXT)
58      require a_context/=Void
59      do
60         handle:=llvmx86fp80type_in_context(a_context.handle)
61      end
62
63   -- TODO: write a correct invariant type.is_real_type_kind
64end -- class LLVM_REAL_TYPE
65
66-- Copyright (C) 2009-2017: Paolo Redaelli
67
68-- This file is part of LLVM wrappers for Liberty Eiffel.
69--
70-- This library is free software: you can redistribute it and/or modify
71-- it under the terms of the GNU Lesser General Public License as published by
72-- the Free Software Foundation, version 3 of the License.
73--
74-- Liberty Eiffel is distributed in the hope that it will be useful,
75-- but WITHOUT ANY WARRANTY; without even the implied warranty of
76-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
77-- GNU General Public License for more details.
78--
79-- You should have received a copy of the GNU General Public License
80-- along with Liberty Eiffel.  If not, see <http://www.gnu.org/licenses/>.
81--