Methods
- A
- I
- N
- S
Attributes
[R] | body | |
[R] | comm | |
[R] | defopes | |
[R] | is_sc | |
[R] | name | |
[R] | nextsc | |
[R] | opes | |
[R] | optimized | |
[R] | orig | |
[R] | pops | |
[R] | pushsc | |
[R] | rets | |
[R] | sc | |
[R] | sp_inc | |
[R] | tvars | |
[R] | type | |
[R] | unifs |
Class Public methods
new(name, opes, pops, rets, comm, body, tvars, sp_inc, orig = self, defopes = [], type = nil, nsc = [], psc = [[], []])
Link
# File tool/instruction.rb, line 11 def initialize name, opes, pops, rets, comm, body, tvars, sp_inc, orig = self, defopes = [], type = nil, nsc = [], psc = [[], []] @name = name @opes = opes # [[type, name], ...] @pops = pops # [[type, name], ...] @rets = rets # [[type, name], ...] @comm = comm # {:c => category, :e => en desc, :j => ja desc} @body = body # '...' @orig = orig @defopes = defopes @type = type @tvars = tvars @nextsc = nsc @pushsc = psc @sc = [] @unifs = [] @optimized = [] @is_sc = false @sp_inc = sp_inc end
Instance Public methods
add_optimized(insn)
Link
add_sc(sci)
Link
add_unif(insns)
Link
inspect()
Link
set_sc()
Link
sp_increase_c_expr()
Link
# File tool/instruction.rb, line 63 def sp_increase_c_expr if(pops.any?{|t, v| v == '...'} || rets.any?{|t, v| v == '...'}) # user definision raise "no sp increase definition" if @sp_inc.nil? ret = "int inc = 0;\n" @opes.each_with_index{|(t, v), i| if (t == 'rb_num_t' && ((re = /\b#{v}\b/n) =~ @sp_inc)) || (@defopes.any?{|t, val| re =~ val}) ret << " int #{v} = FIX2INT(opes[#{i}]);\n" elsif (t == 'CALL_INFO' && ((re = /\b#{v}\b/n) =~ @sp_inc)) ret << " CALL_INFO #{v} = (CALL_INFO)(opes[#{i}]);\n" end } @defopes.each_with_index{|((t, var), val), i| if t == 'rb_num_t' && val != '*' && /\b#{var}\b/ =~ @sp_inc ret << " #{t} #{var} = #{val};\n" end } ret << " #{@sp_inc};\n" ret << " return depth + inc;" ret else "return depth + #{rets.size - pops.size};" end end