Make the verifier output even prettier (#599)

* Fix verifier printing to print instruction encodings consistently.

Use `FuncWriter::write_instruction` for all instructions so that
encodings are printed consistently.

* Make use-before-def errors mention the relevant value.

* When there are verifier errors, print a message at the end.

* Make verifier errors prettier.

Fix the length of the "^~~~~" to match the printed entity, and print the
error messsage on its own line.

* Clean up "test verifier" failure messages.

* Tidy the uses-value-from-itself error.

The use instruction is the same as the def instruction, so don't print
both. Also, the use instruction is already being printed at the
beginning, so don't print it again at the end.
This commit is contained in:
Dan Gohman
2018-11-26 22:18:18 -08:00
committed by GitHub
parent 737fde04a8
commit 54c388d870
4 changed files with 74 additions and 61 deletions

View File

@@ -4,13 +4,13 @@ test verifier
function %non_dominating(i32) -> i32 system_v {
ebb0(v0: i32):
v1 = iadd.i32 v2, v0 ; error: uses value from non-dominating
v1 = iadd.i32 v2, v0 ; error: uses value v2 from non-dominating
v2 = iadd.i32 v1, v0
return v2
}
function %inst_uses_its_own_values(i32) -> i32 system_v {
ebb0(v0: i32):
v1 = iadd.i32 v1, v0 ; error: uses value from itself
v1 = iadd.i32 v1, v0 ; error: uses value v1 from itself
return v1
}