Verified Commit 34e97b73 authored by nagayama15's avatar nagayama15

add optimization targets for compound passes

parent 14fce2f6
......@@ -104,6 +104,10 @@ namespace kyut {
const auto chunk_end = std::end(chunk);
const std::size_t count = std::distance(chunk_begin, chunk_end);
if (count < 2) {
return 0;
}
const std::size_t bit_width = factorial_bit_width_table[count];
// Extract watermark.
......@@ -117,7 +121,11 @@ namespace kyut {
return !less(*a, *(begin + i)) && !less(*(begin + i), *a);
});
assert(found != std::end(chunk)); // FIXME: sometimes crashing here (maybe count < 2)
// assert(found != std::end(chunk)); // FIXME: sometimes crashing here
if (found == std::end(chunk)) {
base *= count - i;
continue;
}
const std::size_t pos = std::distance(it, found);
......
......@@ -10,7 +10,7 @@ METHODS.each do |method|
OPT_PASSES.each do |pass|
b = a.to_s.end_with?(".wasm.txt") ? a.sub(".wasm.txt", "-#{pass}.wasm.txt") : a.sub(".txt", "-#{pass}.txt")
puts "#{a.basename} - #{b.basename}: #{method[:name]}, #{pass}, #{FileUtils.cmp(a, b)}"
puts "#{a.basename} - #{b.basename}: #{method[:name]}, #{pass}, #{FileUtils.cmp(a, b) ? "○" : "☓"}"
end
end
end
......@@ -51,19 +51,26 @@ OPT_PASSES = [
"optimize-instructions",
"optimize-stack-ir",
"pick-load-signs",
"precompute-propagate",
"precompute",
"precompute-propagate",
"remove-unused-brs",
"remove-unused-module-elements",
"remove-unused-names",
"reorder-locals",
"rse",
"simplify-globals-optimizing",
"simplify-globals",
"simplify-locals-nostructure",
"simplify-globals-optimizing",
"simplify-locals",
"simplify-locals-nostructure",
"ssa-nomerge",
"vacuum",
"O1",
"O2",
"O3",
"O4",
"Os",
"Oz",
]
WATERMARK = "N7AStlK2gioIqeRi"
......@@ -79,7 +86,7 @@ def embed(file, out, method, watermark, chunk_size = 20)
end
def optimize(file, out, pass)
output = IO.popen([WASM_OPT, "-o", out.to_s, "--#{pass}", file.to_s]).read
output = IO.popen([WASM_OPT, "-o", out.to_s, pass.start_with?("O") ? "-#{pass}" : "--#{pass}", file.to_s]).read
puts "optimize #{file}, #{out}, #{pass}, #{output}"
end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment