Class: RLTK::CG::ConstantAggregate Abstract

Inherits:
Constant show all
Includes:
Filigree::AbstractClass
Defined in:
lib/rltk/cg/value.rb

Overview

This class is abstract.

All constant aggregate values inherit from this class.

Direct Known Subclasses

ConstantArray, ConstantStruct

Instance Attribute Summary

Attributes included from BindingClass

#ptr

Instance Method Summary collapse

Methods inherited from Constant

#addr_space_cast, #bitcast_to, #get_element_ptr, #get_element_ptr_in_bounds, #initialize

Methods inherited from User

#operands

Methods inherited from Value

#==, #attributes, #bitcast, #constant?, #dump, #hash, #initialize, #name, #name=, #null?, #print, #trunc, #trunc_or_bitcast, #type, #undefined?, #zextend, #zextend_or_bitcast

Methods included from BindingClass

#==

Constructor Details

This class inherits a constructor from RLTK::CG::Constant

Instance Method Details

#extract(*indices) ⇒ ConstantExpr

Extract values from a constant aggregate value.

Parameters:

  • indices (Array<Value>)

    Array of values representing indices into the aggregate.

Returns:



380
381
382
383
384
385
# File 'lib/rltk/cg/value.rb', line 380

def extract(*indices)
	indices_ptr = FFI::MemoryPointer.new(:uint, indices.length)
	indices_ptr.write_array_of_uint(indices)

	ConstantExpr.new(Bindings.const_extract_value(@ptr, indices_ptr, indices.length))
end

#insert(value, indices) ⇒ ConstantExpr

Insert values into a constant aggregate value.

Parameters:

  • value (Value)

    Value to insert.

  • indices (Array<Value>)

    Array of values representing indices into the aggregate.

Returns:

  • (ConstantExpr)

    New aggregate representation with inserted values.



393
394
395
396
397
398
# File 'lib/rltk/cg/value.rb', line 393

def insert(value, indices)
	indices_ptr = FFI::MemoryPointer.new(:uint, indices.length)
	indices_ptr.write_array_of_uint(indices)

	ConstantExpr.new(Bindings.const_insert_value(@ptr, value, indices_ptr, inicies.length))
end