Declare constants in the function preamble

This allows us to give names to constants in the constant pool and then use these names in the function body. The original behavior, specifiying the constant value as an instruction immediate, is still supported as a shortcut but some filetests had to change since the canonical way of printing the CLIF constants is now in the preamble.
This commit is contained in:
Andrew Brown
2020-03-20 14:08:03 -07:00
parent 7d88384c0f
commit 0672d1dc0f
14 changed files with 255 additions and 74 deletions

View File

@@ -1262,13 +1262,15 @@ block0:
assert_eq!(
func.display(None).to_string(),
"function %sample() -> i8x16, b8x16, f32x4 system_v {
const0 = 0x00000000000000000000000000000000
block0:
v5 = f32const 0.0
v6 = splat.f32x4 v5
v2 -> v6
v4 = vconst.b8x16 0x00
v4 = vconst.b8x16 const0
v1 -> v4
v3 = vconst.i8x16 0x00
v3 = vconst.i8x16 const0
v0 -> v3
return v0, v1, v2
}