Merge pull request #9 from Amanieu/remove_is_call

Remove Function::is_call
This commit is contained in:
Chris Fallin
2021-09-09 10:36:58 -07:00
committed by GitHub
4 changed files with 3 additions and 16 deletions

View File

@@ -49,9 +49,8 @@ successors.
Instructions are opaque to the allocator except for a few important Instructions are opaque to the allocator except for a few important
bits: (1) `is_ret` (is a return instruction); (2) `is_branch` (is a bits: (1) `is_ret` (is a return instruction); (2) `is_branch` (is a
branch instruction); (3) `is_call` (is a call instruction, for branch instruction); (3) `is_move` (is a move between registers), and
heuristic purposes only), (4) `is_move` (is a move between registers), (4) a vector of Operands, covered below. Every block must end in a
and (5) a vector of Operands, covered below. Every block must end in a
return or branch. return or branch.
Both instructions and blocks are named by indices in contiguous index Both instructions and blocks are named by indices in contiguous index

View File

@@ -15,7 +15,6 @@ use arbitrary::{Arbitrary, Unstructured};
pub enum InstOpcode { pub enum InstOpcode {
Phi, Phi,
Op, Op,
Call,
Ret, Ret,
Branch, Branch,
} }
@@ -104,10 +103,6 @@ impl Function for Func {
&self.block_params[block.index()][..] &self.block_params[block.index()][..]
} }
fn is_call(&self, insn: Inst) -> bool {
self.insts[insn.index()].op == InstOpcode::Call
}
fn is_ret(&self, insn: Inst) -> bool { fn is_ret(&self, insn: Inst) -> bool {
self.insts[insn.index()].op == InstOpcode::Ret self.insts[insn.index()].op == InstOpcode::Ret
} }
@@ -500,11 +495,10 @@ impl Func {
.all(|op| !builder.f.reftype_vregs.contains(&op.vreg())) .all(|op| !builder.f.reftype_vregs.contains(&op.vreg()))
&& bool::arbitrary(u)?; && bool::arbitrary(u)?;
let op = *u.choose(&[InstOpcode::Op, InstOpcode::Call])?;
builder.add_inst( builder.add_inst(
Block::new(block), Block::new(block),
InstData { InstData {
op, op: InstOpcode::Op,
operands, operands,
clobbers, clobbers,
is_safepoint, is_safepoint,

View File

@@ -103,8 +103,6 @@ impl<'a, F: Function> Env<'a, F> {
.collect::<Vec<_>>(); .collect::<Vec<_>>();
let opname = if self.func.is_branch(inst) { let opname = if self.func.is_branch(inst) {
"br" "br"
} else if self.func.is_call(inst) {
"call"
} else if self.func.is_ret(inst) { } else if self.func.is_ret(inst) {
"ret" "ret"
} else { } else {

View File

@@ -847,10 +847,6 @@ pub trait Function {
/// Get the block parameters for a given block. /// Get the block parameters for a given block.
fn block_params(&self, block: Block) -> &[VReg]; fn block_params(&self, block: Block) -> &[VReg];
/// Determine whether an instruction is a call instruction. This is used
/// only for splitting heuristics.
fn is_call(&self, insn: Inst) -> bool;
/// Determine whether an instruction is a return instruction. /// Determine whether an instruction is a return instruction.
fn is_ret(&self, insn: Inst) -> bool; fn is_ret(&self, insn: Inst) -> bool;