Class: LLVM::ConstantVector

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

Instance Attribute Summary

Attributes included from PointerIdentity

#ptr

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Constant

#bitcast_to, #gep, #int_to_ptr, 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



837
838
839
# File 'lib/llvm/core/value.rb', line 837

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

.const(size_or_values) ⇒ Object

Raises:

  • (ArgumentError)


841
842
843
844
845
846
847
848
849
# File 'lib/llvm/core/value.rb', line 841

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

  # 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



855
856
857
# File 'lib/llvm/core/value.rb', line 855

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

#sizeObject



851
852
853
# File 'lib/llvm/core/value.rb', line 851

def size
  C.get_vector_size(type)
end