Syntax tweak: Omit comma after an initial enum immediate.

This affects the comparison instructions which now read "icmp ult a, b".
This mimics LLVM's style and makes it simpler to add instruction flags
in the future, such as "load v1" -> "load aligned v1".

These enumerated operands and flags feel like opcode modifiers rather
than value operands, so displaying them differently makes sense.

Value and numeric operands are still comma separated.
This commit is contained in:
Jakob Stoklund Olesen
2017-04-10 10:28:37 -07:00
parent d2f575b54a
commit 13b0046ed7
7 changed files with 41 additions and 45 deletions

View File

@@ -1526,7 +1526,6 @@ impl<'a> Parser<'a> {
}
InstructionFormat::BranchIcmp => {
let cond = self.match_enum("expected intcc condition code")?;
self.match_token(Token::Comma, "expected ',' between operands")?;
let lhs = self.match_value("expected SSA value first operand")?;
self.match_token(Token::Comma, "expected ',' between operands")?;
let rhs = self.match_value("expected SSA value second operand")?;
@@ -1567,7 +1566,6 @@ impl<'a> Parser<'a> {
}
InstructionFormat::IntCompare => {
let cond = self.match_enum("expected intcc condition code")?;
self.match_token(Token::Comma, "expected ',' between operands")?;
let lhs = self.match_value("expected SSA value first operand")?;
self.match_token(Token::Comma, "expected ',' between operands")?;
let rhs = self.match_value("expected SSA value second operand")?;
@@ -1580,7 +1578,6 @@ impl<'a> Parser<'a> {
}
InstructionFormat::IntCompareImm => {
let cond = self.match_enum("expected intcc condition code")?;
self.match_token(Token::Comma, "expected ',' between operands")?;
let lhs = self.match_value("expected SSA value first operand")?;
self.match_token(Token::Comma, "expected ',' between operands")?;
let rhs = self.match_imm64("expected immediate second operand")?;
@@ -1594,7 +1591,6 @@ impl<'a> Parser<'a> {
}
InstructionFormat::FloatCompare => {
let cond = self.match_enum("expected floatcc condition code")?;
self.match_token(Token::Comma, "expected ',' between operands")?;
let lhs = self.match_value("expected SSA value first operand")?;
self.match_token(Token::Comma, "expected ',' between operands")?;
let rhs = self.match_value("expected SSA value second operand")?;