summaryrefslogtreecommitdiff
path: root/template/optunifs.inc.tmpl
diff options
context:
space:
mode:
authorshyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-01-10 01:53:24 +0000
committershyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-01-10 01:53:24 +0000
commit5ad95486e63675b2bb3ad665bb2b84eb260c6f29 (patch)
tree9ed7d02028ba1edd4a74e090fb4c7155b55aafd6 /template/optunifs.inc.tmpl
parent7c7d47d2369881f8ea22da34077459771276786a (diff)
merge revisions 61753:61750 61747:61740 61737:61728
Revert all the VM generator rewrites; requested by naruse git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61755 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'template/optunifs.inc.tmpl')
-rw-r--r--template/optunifs.inc.tmpl67
1 files changed, 67 insertions, 0 deletions
diff --git a/template/optunifs.inc.tmpl b/template/optunifs.inc.tmpl
new file mode 100644
index 0000000..3ac5872
--- /dev/null
+++ b/template/optunifs.inc.tmpl
@@ -0,0 +1,67 @@
+/* -*-c-*- *********************************************************/
+/*******************************************************************/
+/*******************************************************************/
+/**
+ This file is for threaded code.
+
+ ----
+ This file is auto generated by insns2vm.rb
+ DO NOT TOUCH!
+
+ If you want to fix something, you must edit 'template/optunifs.inc.tmpl'
+ or tool/insns2vm.rb
+ */
+
+/*
+ static const int UNIFIED_insn_name_1[] = {id, size, ...};
+ static const int UNIFIED_insn_name_2[] = {id, size, ...};
+ ...
+
+ static const int *const UNIFIED_insn_name[] = {size,
+ UNIFIED_insn_name_1,
+ UNIFIED_insn_name_2, ...};
+ ...
+
+ static const int *const *const unified_insns_data[] = {
+ UNIFIED_insn_nameA,
+ UNIFIED_insn_nameB, ...};
+ */
+
+% 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
+
+ASSERT_VM_INSTRUCTION_SIZE(unified_insns_data);