diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-08-22 04:22:01 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-08-22 04:22:01 +0000 |
commit | 14bda8d3c38113d32850e6f2169761d0a46fec10 (patch) | |
tree | dc9ac4c3d0307bfd6c5427f359070c433eb40e40 /template/optinsn.inc.tmpl | |
parent | 6dbfaa2ba036e983264f0dbea94f932974f94c4d (diff) | |
download | ruby-14bda8d3c38113d32850e6f2169761d0a46fec10.tar.gz |
tool/instruction.rb: move logics to templates
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59636 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'template/optinsn.inc.tmpl')
-rw-r--r-- | template/optinsn.inc.tmpl | 44 |
1 files changed, 34 insertions, 10 deletions
diff --git a/template/optinsn.inc.tmpl b/template/optinsn.inc.tmpl index 3c4f732290..186ec46982 100644 --- a/template/optinsn.inc.tmpl +++ b/template/optinsn.inc.tmpl @@ -13,18 +13,42 @@ */ static INSN * -insn_operands_unification(INSN *insnobj){ +insn_operands_unification(INSN *insnobj) +{ #ifdef OPT_OPERANDS_UNIFICATION - /* optimize rule */ - switch(insnobj->insn_id){ + /* optimize rule */ + switch(insnobj->insn_id){ +% opt_insns_map.each do |originsn, optinsns| + case BIN(<%=originsn.name%>): +% optinsns.each {|opti| + if ( +% opti.defopes.each_with_index {|opinfo, i| +% next if opinfo[1] == '*' + insnobj->operands[<%=i%>] == <%=val_as_type(opinfo)%> && +% } + 1) { +% idx = 0 +% opti.defopes.each_with_index {|opinfo, n| +% if opinfo[1] == '*' +% if idx != n + insnobj->operands[<%=idx%>] = insnobj->operands[<%=n%>]; +% end +% idx += 1 +% end +% } + insnobj->insn_id = BIN(<%=opti.name%>); + insnobj->operand_size = <%=idx%>; + break; + } +% } + break; +% end -<%= rule %> - - default: - /* do nothing */; - break; - } + default: + /* do nothing */; + break; + } #endif - return insnobj; + return insnobj; } |