Class: LLVM::ConstantVector

Inherits:
Constant show all
Defined in:
lib/llvm/core/value.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Constant

#bitcast_to, #gep, null, null_ptr, poison, #ptr_to_int, undef

Methods inherited from User

#operands

Methods inherited from Value

#add_attribute, #allocated_type, #allocated_type?, #constant?, #dump, from_ptr, from_ptr_kind, #gep_source_element_type, #gep_source_element_type?, #global_parent, #kind, #name, #name=, #null?, #poison?, #remove_attribute, to_ptr, #to_s, type, #type, #undef?

Methods included from PointerIdentity

#==, #eql?, #hash, #to_ptr

Class Method Details

.all_onesObject



792
793
794
# File 'lib/llvm/core/value.rb', line 792

def self.all_ones
  from_ptr(C.const_all_ones(type))
end

.const(size_or_values, &block) ⇒ Object

Raises:

  • (ArgumentError)


796
797
798
799
800
801
802
803
804
# File 'lib/llvm/core/value.rb', line 796

def self.const(size_or_values, &block)
  vals = LLVM::Support.allocate_pointers(size_or_values, &block)

  # size 0, or empty values
  # this will segfault in const_vector
  raise ArgumentError if vals.size.zero? # rubocop:disable Style/ZeroLengthPredicate

  from_ptr(C.const_vector(vals, vals.size / vals.type_size))
end

Instance Method Details

#[](idx) ⇒ Object



810
811
812
# File 'lib/llvm/core/value.rb', line 810

def [](idx)
  self.class.from_ptr(C.get_aggregate_element(self, idx))
end

#sizeObject



806
807
808
# File 'lib/llvm/core/value.rb', line 806

def size
  C.get_vector_size(type)
end