Sha256: 46d39c95746c78d5d88107ff151be3e22c57ecf7857f63463ff8dec8fbc7d66b

Contents?: true

Size: 797 Bytes

Versions: 44

Compression:

Stored size: 797 Bytes

Contents

require "pp"

unless ARGV[0]
  puts "usage: #$0 /path/to/ruby/trunk/insns.def"
  exit
end

r = %r(
  ^DEFINE_INSN\n
  (?<name>\w+)\n
  \((?<operands>.*)\)\n
  \((?<inputs>.*)\)\n
  \((?<outputs>.*)\)\n
  (?://(?<inc>.*)\n)?
)x

INSN_TABLE = {}
Insn = Struct.new(:operands, :inputs, :outputs)
File.read(ARGV[0]).scan(r) do
  name, operands, _inputs, _outputs, _inc =
    $~[:name], $~[:operands], $~[:inputs], $~[:outputs], $~[:inc]
  next if name.start_with?("opt_")
  next if name == "bitblt" || name == "answer"
  operands = operands.split(",").map {|s| s.strip }.map do |s|
    s.split(" ").map {|s| s.strip }[0]
  end
  INSN_TABLE[name.to_sym] = operands
end
target = File.join(__dir__, "../lib/typeprof/insns-def.rb")
File.write(target, "TypeProf::INSN_TABLE = " + INSN_TABLE.pretty_inspect)

Version data entries

44 entries across 44 versions & 1 rubygems

Version Path
typeprof-0.21.11 tools/setup-insns-def.rb
typeprof-0.21.10 tools/setup-insns-def.rb
typeprof-0.21.9 tools/setup-insns-def.rb
typeprof-0.21.8 tools/setup-insns-def.rb
typeprof-0.21.7 tools/setup-insns-def.rb
typeprof-0.21.6 tools/setup-insns-def.rb
typeprof-0.21.5 tools/setup-insns-def.rb
typeprof-0.21.4 tools/setup-insns-def.rb
typeprof-0.21.3 tools/setup-insns-def.rb
typeprof-0.21.2 tools/setup-insns-def.rb
typeprof-0.21.1 tools/setup-insns-def.rb
typeprof-0.21.0 tools/setup-insns-def.rb
typeprof-0.20.4 tools/setup-insns-def.rb
typeprof-0.20.3 tools/setup-insns-def.rb
typeprof-0.20.2 tools/setup-insns-def.rb
typeprof-0.20.1 tools/setup-insns-def.rb
typeprof-0.20.0 tools/setup-insns-def.rb
typeprof-0.15.3 tools/setup-insns-def.rb
typeprof-0.15.2 tools/setup-insns-def.rb
typeprof-0.15.1 tools/setup-insns-def.rb