Remove boolean parameters from instruction builder functions (#5658)
Remove the boolean parameters from the instruction builder functions, as they were only ever used with true. Additionally, change the returns and branches functions to imply terminates_block.
This commit is contained in:
@@ -171,52 +171,59 @@ impl InstructionBuilder {
|
||||
self
|
||||
}
|
||||
|
||||
#[allow(clippy::wrong_self_convention)]
|
||||
pub fn is_terminator(mut self, val: bool) -> Self {
|
||||
self.is_terminator = val;
|
||||
/// Mark this instruction as a block terminator.
|
||||
pub fn terminates_block(mut self) -> Self {
|
||||
self.is_terminator = true;
|
||||
self
|
||||
}
|
||||
|
||||
#[allow(clippy::wrong_self_convention)]
|
||||
pub fn is_branch(mut self, val: bool) -> Self {
|
||||
self.is_branch = val;
|
||||
/// Mark this instruction as a branch instruction. This also implies that the instruction is a
|
||||
/// block terminator.
|
||||
pub fn branches(mut self) -> Self {
|
||||
self.is_branch = true;
|
||||
self.terminates_block()
|
||||
}
|
||||
|
||||
/// Mark this instruction as a call instruction.
|
||||
pub fn call(mut self) -> Self {
|
||||
self.is_call = true;
|
||||
self
|
||||
}
|
||||
|
||||
#[allow(clippy::wrong_self_convention)]
|
||||
pub fn is_call(mut self, val: bool) -> Self {
|
||||
self.is_call = val;
|
||||
/// Mark this instruction as a return instruction. This also implies that the instruction is a
|
||||
/// block terminator.
|
||||
pub fn returns(mut self) -> Self {
|
||||
self.is_return = true;
|
||||
self.terminates_block()
|
||||
}
|
||||
|
||||
/// Mark this instruction as one that can load from memory.
|
||||
pub fn can_load(mut self) -> Self {
|
||||
self.can_load = true;
|
||||
self
|
||||
}
|
||||
|
||||
#[allow(clippy::wrong_self_convention)]
|
||||
pub fn is_return(mut self, val: bool) -> Self {
|
||||
self.is_return = val;
|
||||
/// Mark this instruction as one that can store to memory.
|
||||
pub fn can_store(mut self) -> Self {
|
||||
self.can_store = true;
|
||||
self
|
||||
}
|
||||
|
||||
pub fn can_load(mut self, val: bool) -> Self {
|
||||
self.can_load = val;
|
||||
/// Mark this instruction as possibly trapping.
|
||||
pub fn can_trap(mut self) -> Self {
|
||||
self.can_trap = true;
|
||||
self
|
||||
}
|
||||
|
||||
pub fn can_store(mut self, val: bool) -> Self {
|
||||
self.can_store = val;
|
||||
/// Mark this instruction as one that has side-effects.
|
||||
pub fn other_side_effects(mut self) -> Self {
|
||||
self.other_side_effects = true;
|
||||
self
|
||||
}
|
||||
|
||||
pub fn can_trap(mut self, val: bool) -> Self {
|
||||
self.can_trap = val;
|
||||
self
|
||||
}
|
||||
|
||||
pub fn other_side_effects(mut self, val: bool) -> Self {
|
||||
self.other_side_effects = val;
|
||||
self
|
||||
}
|
||||
|
||||
pub fn side_effects_idempotent(mut self, val: bool) -> Self {
|
||||
self.side_effects_idempotent = val;
|
||||
/// Mark this instruction as one whose side-effects may be de-duplicated.
|
||||
pub fn side_effects_idempotent(mut self) -> Self {
|
||||
self.side_effects_idempotent = true;
|
||||
self
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user