/src/wrappers/llvm/library/values/llvm_constant.e
Specman e | 75 lines | 28 code | 11 blank | 36 comment | 0 complexity | 63122c510f82941db0080219529bc3ca MD5 | raw file
1deferred class LLVM_CONSTANT 2 -- LLVM Constant Representation. 3 4 -- This is an important base class in LLVM. It provides the common 5 -- facilities of all constant values in an LLVM program. A constant is a 6 -- value that is immutable at runtime. Functions are constants because 7 -- their address is immutable. Same with global variables. 8 9 -- All constants share the capabilities provided in this class. All 10 -- constants can have a null value. They can have an operand list. 11 -- Constants can be simple (integer and floating point values), complex 12 -- (arrays and structures), or expression based (computations yielding a 13 -- constant value composed of only certain operators and other constant 14 -- values). 15 16 -- Note that Constants are immutable (once created they never change) and 17 -- are fully shared by structural equivalence. This means that two 18 -- structurally equivalent constants will always have the same address. 19 -- Constants are created on demand as needed and never deleted: thus 20 -- clients don't have to worry about the lifetime of the objects. 21inherit LLVM_USER 22insert CORE_EXTERNALS 23feature {ANY} 24 null_from (a_type: LLVM_TYPE) 25 -- Create a null constant of `a_type' 26 require a_type/=Void 27 do 28 handle:=llvmconst_null(a_type.handle) 29 end 30 31 undef_from (a_type: LLVM_TYPE) 32 -- Create an undefined constant of `a_type' 33 require a_type/=Void 34 do 35 handle:=llvmget_undef(a_type.handle) 36 end 37 38feature {ANY} -- Queries 39 is_constant: BOOLEAN 40 -- TODO: as far as I understand this feature shall belong to LLVM_VALUE. 41 do 42 Result := llvmis_constant(handle).to_boolean 43 end 44 45 is_null: BOOLEAN 46 -- Is Current constant null? 47 do 48 Result := llvmis_null(handle).to_boolean 49 end 50 51 is_undefined: BOOLEAN 52 -- Is Current constant not defined? 53 do 54 Result := llvmis_undef(handle).to_boolean 55 end 56 57end -- class LLVM_CONSTANT 58 59-- Copyright (C) 2009-2017: ,2010,2013 Paolo Redaelli - 2013 Cyril Adrian 60 61-- This file is part of LLVM wrappers for Liberty Eiffel. 62-- 63-- This library is free software: you can redistribute it and/or modify 64-- it under the terms of the GNU Lesser General Public License as published by 65-- the Free Software Foundation, version 3 of the License. 66-- 67-- Liberty Eiffel is distributed in the hope that it will be useful, 68-- but WITHOUT ANY WARRANTY; without even the implied warranty of 69-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 70-- GNU General Public License for more details. 71-- 72-- You should have received a copy of the GNU General Public License 73-- along with Liberty Eiffel. If not, see <http://www.gnu.org/licenses/>. 74-- 75