diff options
Diffstat (limited to 'tool/ruby_vm/models/instructions_unification.rb')
| -rw-r--r-- | tool/ruby_vm/models/instructions_unification.rb | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/tool/ruby_vm/models/instructions_unification.rb b/tool/ruby_vm/models/instructions_unification.rb new file mode 100644 index 0000000000..5c798e6d54 --- /dev/null +++ b/tool/ruby_vm/models/instructions_unification.rb @@ -0,0 +1,42 @@ +# -*- Ruby -*- +# -*- frozen_string_literal: true; -*- +# -*- warn_indent: true; -*- +# +# Copyright (c) 2017 Urabe, Shyouhei. All rights reserved. +# +# This file is a part of the programming language Ruby. Permission is hereby +# granted, to either redistribute and/or modify this file, provided that the +# conditions mentioned in the file COPYING are met. Consult the file for +# details. + +require_relative '../helpers/c_escape' +require_relative '../loaders/opt_insn_unif_def' +require_relative 'bare_instruction' + +class RubyVM::InstructionsUnification + include RubyVM::CEscape + + attr_reader :name + + def initialize opts = {} + @location = opts[:location] + @name = namegen opts[:signature] + @series = opts[:signature].map do |i| + RubyVM::BareInstruction.find(i) # Misshit is fatal + end + end + + private + + def namegen signature + as_tr_cpp ['UNIFIED', *signature].join('_') + end + + @instances = RubyVM::OptInsnUnifDef.map do |h| + new h + end + + def self.all + @instances + end +end |
