summaryrefslogtreecommitdiff
path: root/template/optunifs.inc.tmpl
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-08-22 04:22:01 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-08-22 04:22:01 +0000
commit7735c1f5fe4eabd97fe63d7113fc12fc25c877b7 (patch)
treedc9ac4c3d0307bfd6c5427f359070c433eb40e40 /template/optunifs.inc.tmpl
parent1f89414c20edbe0b36fac7351917f401ccee63a1 (diff)
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/optunifs.inc.tmpl')
-rw-r--r--template/optunifs.inc.tmpl37
1 files changed, 34 insertions, 3 deletions
diff --git a/template/optunifs.inc.tmpl b/template/optunifs.inc.tmpl
index 63ac4d85ca..3ac5872346 100644
--- a/template/optunifs.inc.tmpl
+++ b/template/optunifs.inc.tmpl
@@ -27,9 +27,40 @@
UNIFIED_insn_nameB, ...};
*/
-<%= unif_insns_each %>
-<%= unif_insns %>
-<%= unif_insns_data %>
+% unif_insns_data = @insns.find_all {|insn| !insn.is_sc}.map do |insn|
+% size = insn.unifs.size
+% if size > 0
+% name = "UNIFIED_#{insn.name}"
+% insn.unifs.sort_by{|unif| -unif[1].size}.each_with_index do |(uni_insn, uni_insns), i|
+% uni_insns = uni_insns[1..-1]
+static const int <%=name%>_<%=i%>[] = {
+ BIN(<%=uni_insn.name%>), <%=uni_insns.size + 2%>,
+ <% uni_insns.map{|e| -%>
+BIN(<%=e.name%>),<% -%>
+% }
+
+};
+% end
+
+static const int *const <%=name%>[] = {(int *)<%=size+1%>,
+% size.times do |e|
+ <%=name%>_<%=e%>,
+% end
+};
+% name
+% end
+% end
+
+static const int *const *const unified_insns_data[] = {<%#-%>
+% unif_insns_data.each_with_index do |insn, i|
+% if (i%8).zero?
+
+ <% -%>
+% end
+ <%=insn || "0"%>,<%#-%>
+% end
+
+};
#undef GET_INSN_NAME