Class: Stupidedi::Builder::ConstraintTable::Deepest

Inherits:
Stupidedi::Builder::ConstraintTable show all
Defined in:
lib/stupidedi/builder/constraint_table.rb

Overview

The only exception to the rule of preferring the Instruction which pops the greatest number of states is when the Instruction is for ISA. We want to reuse one root Values::TransmissionVal container for all children.

Instance Method Summary collapse

Methods inherited from Stupidedi::Builder::ConstraintTable

build

Constructor Details

#initialize(instructions) ⇒ Deepest

Returns a new instance of Deepest.


77
78
79
# File 'lib/stupidedi/builder/constraint_table.rb', line 77

def initialize(instructions)
  @instructions = instructions
end

Instance Method Details

#matches(segment_tok, strict) ⇒ Array<Instruction>

Returns:


82
83
84
85
86
87
88
89
90
91
92
93
94
# File 'lib/stupidedi/builder/constraint_table.rb', line 82

def matches(segment_tok, strict)
  @__matches ||= begin
    deepest = @instructions.head

    @instructions.tail.each do |i|
      if i.pop_count < deepest.pop_count
        deepest = i
      end
    end

    deepest.cons
  end
end