Class: BOAST::Affectation

Inherits:
Operator show all
Extended by:
Functor
Includes:
Arithmetic, Inspectable, Intrinsics, PrivateStateAccessor
Defined in:
lib/BOAST/Language/Operators.rb

Constant Summary

Constants included from Intrinsics

Intrinsics::CONVERSIONS, Intrinsics::INTRINSICS

Constants inherited from Operator

Operator::DISCARD_OPTIONS

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Functor

extended

Methods included from PrivateStateAccessor

#address_size, #address_size=, #annotate, #annotate=, #annotate?, #annotate_indepth_list, #annotate_indepth_list=, #annotate_level, #annotate_level=, #annotate_list, #annotate_list=, #architecture, #architecture=, #array_start, #array_start=, #chain_code, #chain_code=, #chain_code?, #debug, #debug=, #debug?, #debug_kernel_source, #debug_kernel_source=, #debug_kernel_source?, #debug_source, #debug_source=, #debug_source?, #decl_module, #decl_module=, #decl_module?, #default_align, #default_align=, #default_int_signed, #default_int_signed=, #default_int_signed?, #default_int_size, #default_int_size=, #default_real_size, #default_real_size=, #default_type, #default_type=, #disable_openmp, #disable_openmp=, #disable_openmp?, #executable, #executable=, #executable?, #ffi, #ffi=, #ffi?, #fortran_line_length, #fortran_line_length=, #get_address_size, #get_annotate, #get_annotate_indepth_list, #get_annotate_level, #get_annotate_list, #get_architecture, #get_array_start, #get_chain_code, #get_debug, #get_debug_kernel_source, #get_debug_source, #get_decl_module, #get_default_align, #get_default_int_signed, #get_default_int_size, #get_default_real_size, #get_default_type, #get_disable_openmp, #get_executable, #get_ffi, #get_fortran_line_length, #get_indent_increment, #get_indent_level, #get_keep_temp, #get_lang, #get_model, #get_optimizer_log, #get_optimizer_log_file, #get_output, #get_replace_constants, #get_use_vla, #get_verbose, #indent_increment, #indent_increment=, #indent_level, #indent_level=, #keep_temp, #keep_temp=, #keep_temp?, #lang, #lang=, #model, #model=, #optimizer_log, #optimizer_log=, #optimizer_log?, #optimizer_log_file, #optimizer_log_file=, #output, #output=, #replace_constants, #replace_constants=, #replace_constants?, #set_address_size, #set_annotate, #set_annotate_indepth_list, #set_annotate_level, #set_annotate_list, #set_architecture, #set_array_start, #set_chain_code, #set_debug, #set_debug_kernel_source, #set_debug_source, #set_decl_module, #set_default_align, #set_default_int_signed, #set_default_int_size, #set_default_real_size, #set_default_type, #set_disable_openmp, #set_executable, #set_ffi, #set_fortran_line_length, #set_indent_increment, #set_indent_level, #set_keep_temp, #set_lang, #set_model, #set_optimizer_log, #set_optimizer_log_file, #set_output, #set_replace_constants, #set_use_vla, #set_verbose, #use_vla, #use_vla=, #use_vla?, #verbose, #verbose=, #verbose?

Methods included from Inspectable

#inspect

Methods included from Arithmetic

#!, #!=, #*, #**, #+, #+@, #-, #-@, #/, #<, #<=, #==, #===, #>, #>=, #and, #cast, #components, #dereference, #or, #reference

Methods included from Intrinsics

check_coverage, generate_conversions, get_conversion_path, get_vector_decl, get_vector_decl_ARM, get_vector_decl_X86, get_vector_name, intrinsics, intrinsics_by_vector_name, type_name_ARM, type_name_X86, vector_type_name

Methods inherited from Operator

convert, inspect

Constructor Details

#initialize(target, source, options = {}) ⇒ Affectation

Returns a new instance of Affectation.



488
489
490
491
492
# File 'lib/BOAST/Language/Operators.rb', line 488

def initialize(target, source, options = {})
  @target = target
  @source = source
  @options = options
end

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



486
487
488
# File 'lib/BOAST/Language/Operators.rb', line 486

def options
  @options
end

#sourceObject (readonly)

Returns the value of attribute source.



485
486
487
# File 'lib/BOAST/Language/Operators.rb', line 485

def source
  @source
end

#targetObject (readonly)

Returns the value of attribute target.



484
485
486
# File 'lib/BOAST/Language/Operators.rb', line 484

def target
  @target
end

Instance Method Details

#prObject



518
519
520
521
522
523
524
525
# File 'lib/BOAST/Language/Operators.rb', line 518

def pr
  s=""
  s += indent
  s += to_s
  s += ";" if [C, CL, CUDA].include?( lang )
  output.puts s
  return self
end

#to_sObject



514
515
516
# File 'lib/BOAST/Language/Operators.rb', line 514

def to_s
  return to_var.to_s
end

#to_varObject



498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
# File 'lib/BOAST/Language/Operators.rb', line 498

def to_var
  tar = @target
  tar = @target.to_var if @target.respond_to?(:to_var)
  src = @source
  src = @source.to_var if @source.respond_to?(:to_var)
  if tar.class == Variable and tar.type.vector_length > 1 then
    return @target.copy("#{@target} = #{Load(@source, @target, @options)}", DISCARD_OPTIONS)
  elsif src.class == Variable and src.type.vector_length > 1 then
    r_t, _ = transition(tar, src, Affectation)
    opts = @options.clone
    opts[:store_type] = r_t
    return @target.copy("#{Store(@target, @source, opts)}", DISCARD_OPTIONS)
  end
  return tar.copy("#{tar ? tar : @target} = #{src ? src : @source}", DISCARD_OPTIONS)
end

#typeObject



494
495
496
# File 'lib/BOAST/Language/Operators.rb', line 494

def type
  return target.to_var.type
end