lib/sfrp/mono/type.rb
def gen_mark_function(src_set, dest_set)
        return unless need_mark?(src_set)
        dest_set << L.function(low_mark_func_str, 'int') do |f|
          f.append_param(low_type_str, 'target')
          f << L.stmt("#{meta_access_str('target')}.mark = 1") unless static?
          @vconst_strs.each_with_index do |v_str, term_id|
            vconst = src_set.vconst(v_str)
            cond_exps = vconst.low_compare_exps(src_set, 'target')
            mark_exps = vconst.low_mark_element_exps(src_set, term_id, 'target')
            next if mark_exps.empty?
            mark_stmt = L.stmt(mark_exps.join(', '))
            if cond_exps.empty?
              f << mark_stmt
            else
              cond_exp = cond_exps.reduce { |a, e| "#{a} && #{e}" }
              f << L.if_stmt(cond_exp) do |i|
                i << mark_stmt
              end
            end
          end
          f << L.stmt('return 0')
        end
      end
# Generate mark function for this type.
Generate mark function for this type.
Generate mark function for this type .
def gen_mark_function(src_set, dest_set)
        return unless need_mark?(src_set)
        dest_set << L.function(low_mark_func_str, 'int') do |f|
          f.append_param(low_type_str, 'target')
          f << L.stmt("#{meta_access_str('target')}.mark = 1") unless static?
          @vconst_strs.each_with_index do |v_str, term_id|
            vconst = src_set.vconst(v_str)
            cond_exps = vconst.low_compare_exps(src_set, 'target')
            mark_exps = vconst.low_mark_element_exps(src_set, term_id, 'target')
            next if mark_exps.empty?
            mark_stmt = L.stmt(mark_exps.join(', '))
            if cond_exps.empty?
              f << mark_stmt
            else
              cond_exp = cond_exps.reduce { |a, e| "#{a} && #{e}" }
              f << L.if_stmt(cond_exp) do |i|
                i << mark_stmt
              end
            end
          end
          f << L.stmt('return 0')
        end
      end
def gen_mark_function ( src_set , dest_set ) return unless need_mark? ( src_set ) dest_set << L . function ( low_mark_func_str , 'int' ) do | f | f . append_param ( low_type_str , 'target' ) f << L . stmt ( "#{meta_access_str('target')}.mark = 1" ) unless static? @vconst_strs . each_with_index do | v_str , term_id | vconst = src_set . vconst ( v_str ) cond_exps = vconst . low_compare_exps ( src_set , 'target' ) mark_exps = vconst . low_mark_element_exps ( src_set , term_id , 'target' ) next if mark_exps . empty? mark_stmt = L . stmt ( mark_exps . join ( ', ' ) ) if cond_exps . empty? f << mark_stmt else cond_exp = cond_exps . reduce { | a , e | "#{a} && #{e}" } f << L . if_stmt ( cond_exp ) do | i | i << mark_stmt end end end f << L . stmt ( 'return 0' ) end end
Generate mark function for this type.
Generate mark function for this type .
src_set
dest_set