cranelift: Remove redundant branch and select instructions (#5097)
As discussed in the 2022/10/19 meeting, this PR removes many of the branch and select instructions that used iflags, in favor if using brz/brnz and select in their place. Additionally, it reworks selectif_spectre_guard to take an i8 input instead of an iflags input. For reference, the removed instructions are: br_icmp, brif, brff, trueif, trueff, and selectif.
This commit is contained in:
@@ -2813,47 +2813,6 @@ impl<'a> Parser<'a> {
|
||||
args: args.into_value_list(&[ctrl_arg], &mut ctx.function.dfg.value_lists),
|
||||
}
|
||||
}
|
||||
InstructionFormat::BranchInt => {
|
||||
let cond = self.match_enum("expected intcc condition code")?;
|
||||
let arg = self.match_value("expected SSA value first operand")?;
|
||||
self.match_token(Token::Comma, "expected ',' between operands")?;
|
||||
let block_num = self.match_block("expected branch destination block")?;
|
||||
let args = self.parse_opt_value_list()?;
|
||||
InstructionData::BranchInt {
|
||||
opcode,
|
||||
cond,
|
||||
destination: block_num,
|
||||
args: args.into_value_list(&[arg], &mut ctx.function.dfg.value_lists),
|
||||
}
|
||||
}
|
||||
InstructionFormat::BranchFloat => {
|
||||
let cond = self.match_enum("expected floatcc condition code")?;
|
||||
let arg = self.match_value("expected SSA value first operand")?;
|
||||
self.match_token(Token::Comma, "expected ',' between operands")?;
|
||||
let block_num = self.match_block("expected branch destination block")?;
|
||||
let args = self.parse_opt_value_list()?;
|
||||
InstructionData::BranchFloat {
|
||||
opcode,
|
||||
cond,
|
||||
destination: block_num,
|
||||
args: args.into_value_list(&[arg], &mut ctx.function.dfg.value_lists),
|
||||
}
|
||||
}
|
||||
InstructionFormat::BranchIcmp => {
|
||||
let cond = self.match_enum("expected intcc condition code")?;
|
||||
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")?;
|
||||
self.match_token(Token::Comma, "expected ',' between operands")?;
|
||||
let block_num = self.match_block("expected branch destination block")?;
|
||||
let args = self.parse_opt_value_list()?;
|
||||
InstructionData::BranchIcmp {
|
||||
opcode,
|
||||
cond,
|
||||
destination: block_num,
|
||||
args: args.into_value_list(&[lhs, rhs], &mut ctx.function.dfg.value_lists),
|
||||
}
|
||||
}
|
||||
InstructionFormat::BranchTable => {
|
||||
let arg = self.match_value("expected SSA value operand")?;
|
||||
self.match_token(Token::Comma, "expected ',' between operands")?;
|
||||
@@ -2916,11 +2875,6 @@ impl<'a> Parser<'a> {
|
||||
imm: rhs,
|
||||
}
|
||||
}
|
||||
InstructionFormat::IntCond => {
|
||||
let cond = self.match_enum("expected intcc condition code")?;
|
||||
let arg = self.match_value("expected SSA value")?;
|
||||
InstructionData::IntCond { opcode, cond, arg }
|
||||
}
|
||||
InstructionFormat::FloatCompare => {
|
||||
let cond = self.match_enum("expected floatcc condition code")?;
|
||||
let lhs = self.match_value("expected SSA value first operand")?;
|
||||
@@ -2932,24 +2886,6 @@ impl<'a> Parser<'a> {
|
||||
args: [lhs, rhs],
|
||||
}
|
||||
}
|
||||
InstructionFormat::FloatCond => {
|
||||
let cond = self.match_enum("expected floatcc condition code")?;
|
||||
let arg = self.match_value("expected SSA value")?;
|
||||
InstructionData::FloatCond { opcode, cond, arg }
|
||||
}
|
||||
InstructionFormat::IntSelect => {
|
||||
let cond = self.match_enum("expected intcc condition code")?;
|
||||
let guard = self.match_value("expected SSA value first operand")?;
|
||||
self.match_token(Token::Comma, "expected ',' between operands")?;
|
||||
let v_true = self.match_value("expected SSA value second operand")?;
|
||||
self.match_token(Token::Comma, "expected ',' between operands")?;
|
||||
let v_false = self.match_value("expected SSA value third operand")?;
|
||||
InstructionData::IntSelect {
|
||||
opcode,
|
||||
cond,
|
||||
args: [guard, v_true, v_false],
|
||||
}
|
||||
}
|
||||
InstructionFormat::Call => {
|
||||
let func_ref = self.match_fn("expected function reference")?;
|
||||
ctx.check_fn(func_ref, self.loc)?;
|
||||
|
||||
Reference in New Issue
Block a user