class RCGTK::Value
This class represents LLVM
IR “data”, including integer and float literals, functions, and constant arrays, structs, and vectors.
Public Class Methods
Public Instance Methods
Compare one Value
to another.
@param [Value] other Another value object.
@return [Boolean]
# File lib/rcgtk/value.rb, line 42 def ==(other) other.is_a?(Value) and @ptr == other.ptr end
@return [AttrCollection] Proxy object for inspecing a value’s attributes.
# File lib/rcgtk/value.rb, line 47 def attributes @attributes ||= AttrCollection.new(@ptr) end
Bitcast a value to a given type.
@param [Type] type Type
to cast to.
@return [ConstantExpr]
# File lib/rcgtk/value.rb, line 57 def bitcast(type) ConstantExpr.new(Bindings.const_bit_cast(@ptr, check_cg_type(type))) end
@return [Boolean] If this value is a constant.
# File lib/rcgtk/value.rb, line 62 def constant? Bindings.is_constant(@ptr).to_bool end
@return [Fixnum] Hashed value of the pointer representing this value.
# File lib/rcgtk/value.rb, line 78 def hash @ptr.address.hash end
@return [String] Name of this value in LLVM
IR.
# File lib/rcgtk/value.rb, line 83 def name Bindings.get_value_name(@ptr) end
@return [Boolean] If the value is null or not.
# File lib/rcgtk/value.rb, line 97 def null? Bindings.is_null(@ptr).to_bool end
@return [String] LLVM
IR representation of this value
# File lib/rcgtk/value.rb, line 102 def print Bindings.print_value_to_string(@ptr) end
Truncate a value to a given type.
@param [Type] type Type
to truncate to.
@return [ConstantExpr]
# File lib/rcgtk/value.rb, line 111 def trunc(type) ConstantExpr.new(Bindings.const_trunc(check_cg_type(type))) end
Truncate or bitcast a value to the given type as is appropriate.
@param [Type] type Type
to cast or truncate to.
@return [ConstantExpr]
# File lib/rcgtk/value.rb, line 120 def trunc_or_bitcast(type) ConstantExpr.new(Bindings.const_trunc_or_bit_cast(check_cg_type(type))) end
@return [Type] Type
of this value.
# File lib/rcgtk/value.rb, line 125 def type @type ||= Type.from_ptr(Bindings.type_of(@ptr)) end
@return [Boolean] If the value is undefined or not.
# File lib/rcgtk/value.rb, line 130 def undefined? Bindings.is_undef(@ptr).to_bool end
Zero extend the value to the length of type.
@param [Type] type Type
to extend the value to.
@return [ConstantExpr]
# File lib/rcgtk/value.rb, line 139 def zextend(type) ConstantExpr.new(Bindings.const_z_ext(check_cg_type(type))) end
Zero extend or bitcast the value to the given type as is appropriate.
@param [Type] type Type
to cast or extend to.
@return [ConstantExpr]
# File lib/rcgtk/value.rb, line 148 def zextend_or_bitcast(type) ConstantExpr.new(Bindings.const_z_ext_or_bit_cast(check_cg_type(type))) end