Add syntax for cold blocks to CLIF.

This commit adds support for denoting cold blocks in the CLIF text
format as follows:

```plain

function %f() {
block0(...):
  ...

block1 cold:
  ...

block2(...) cold:
  ...

block3:
  ...
```

With this syntax, we are able to see the cold-block flag in CLIF, we can
write tests using it, and it is preserved when round-tripping.

Fixes #3701.
This commit is contained in:
Chris Fallin
2022-01-20 15:37:07 -08:00
parent 90e7cef56c
commit 51649d56b7
3 changed files with 65 additions and 6 deletions

View File

@@ -34,6 +34,7 @@ pub enum Token<'a> {
Type(types::Type), // i32, f32, b32x4, ...
Value(Value), // v12, v7
Block(Block), // block3
Cold, // cold (flag on block)
StackSlot(u32), // ss3
GlobalValue(u32), // gv3
Heap(u32), // heap2
@@ -326,6 +327,7 @@ impl<'a> Lexer<'a> {
.unwrap_or_else(|| match text {
"iflags" => Token::Type(types::IFLAGS),
"fflags" => Token::Type(types::FFLAGS),
"cold" => Token::Cold,
_ => Token::Identifier(text),
}),
loc,