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



794
795
796
# File 'lib/llvm/core/value.rb', line 794

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

.const(size_or_values, &block) ⇒ Object

Raises:

  • (ArgumentError)


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

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



812
813
814
# File 'lib/llvm/core/value.rb', line 812

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

#sizeObject



808
809
810
# File 'lib/llvm/core/value.rb', line 808

def size
  C.get_vector_size(type)
end