Don't renumber entities in the parser.

This makes it easier to debug testcases:
 - the entity numbers in a .cton file match the entity numbers used
   within Cretonne.
 - serializing and deserializing doesn't cause indices to change.

One disadvantage is that if a .cton file uses sparse entity numbers,
deserializing to the in-memory form doesn't compact it. However, the
text format is not intended to be performance-critical, so this isn't
expected to be a big burden.
This commit is contained in:
Dan Gohman
2018-02-15 21:13:25 -08:00
parent c846ec1626
commit a5b00b173e
22 changed files with 677 additions and 650 deletions

View File

@@ -6,7 +6,7 @@ ebb1:
return
}
; sameln: function %mini() native {
; nextln: ebb0:
; nextln: ebb1:
; nextln: return
; nextln: }
@@ -17,7 +17,7 @@ ebb1:
return v1, v2
}
; sameln: function %r1() -> i32, f32 spiderwasm {
; nextln: ebb0:
; nextln: ebb1:
; nextln: $v1 = iconst.i32 3
; nextln: $v2 = f32const 0.0
; nextln: return $v1, $v2
@@ -30,12 +30,12 @@ function %signatures() {
fn8 = function %bar(i32) -> b1
}
; sameln: function %signatures() native {
; nextln: $sig10 = () native
; nextln: $sig11 = (i32, f64) -> i32, b1 spiderwasm
; nextln: sig2 = (i32) -> b1 native
; nextln: $fn5 = $sig11 %foo
; nextln: $fn8 = sig2 %bar
; nextln: }
; check: $sig10 = () native
; check: $sig11 = (i32, f64) -> i32, b1 spiderwasm
; check: sig12 = (i32) -> b1 native
; check: $fn5 = $sig11 %foo
; check: $fn8 = sig12 %bar
; check: }
function %direct() {
fn0 = function %none()