Drop 'basic-blocks' feature (#1363)
* All: Drop 'basic-blocks' feature This makes it so that 'basic-blocks' cannot be disabled and we can start assuming it everywhere. * Tests: Replace non-bb filetests with bb version * Tests: Adapt solver-fixedconflict filetests to use basic blocks
This commit is contained in:
@@ -31,7 +31,7 @@ use crate::binemit::{CodeInfo, CodeOffset};
|
||||
use crate::cursor::{Cursor, FuncCursor};
|
||||
use crate::dominator_tree::DominatorTree;
|
||||
use crate::flowgraph::ControlFlowGraph;
|
||||
use crate::ir::{Function, InstructionData, Opcode};
|
||||
use crate::ir::{Ebb, Function, Inst, InstructionData, Opcode, Value, ValueList};
|
||||
use crate::isa::{EncInfo, TargetIsa};
|
||||
use crate::iterators::IteratorExtras;
|
||||
use crate::regalloc::RegDiversions;
|
||||
@@ -40,9 +40,6 @@ use crate::CodegenResult;
|
||||
use core::convert::TryFrom;
|
||||
use log::debug;
|
||||
|
||||
#[cfg(feature = "basic-blocks")]
|
||||
use crate::ir::{Ebb, Inst, Value, ValueList};
|
||||
|
||||
/// Relax branches and compute the final layout of EBB headers in `func`.
|
||||
///
|
||||
/// Fill in the `func.offsets` table so the function is ready for binary emission.
|
||||
@@ -61,7 +58,6 @@ pub fn relax_branches(
|
||||
func.offsets.resize(func.dfg.num_ebbs());
|
||||
|
||||
// Start by removing redundant jumps.
|
||||
#[cfg(feature = "basic-blocks")]
|
||||
fold_redundant_jumps(func, _cfg, _domtree);
|
||||
|
||||
// Convert jumps to fallthrough instructions where possible.
|
||||
@@ -154,7 +150,6 @@ pub fn relax_branches(
|
||||
|
||||
/// Folds an instruction if it is a redundant jump.
|
||||
/// Returns whether folding was performed (which invalidates the CFG).
|
||||
#[cfg(feature = "basic-blocks")]
|
||||
fn try_fold_redundant_jump(
|
||||
func: &mut Function,
|
||||
cfg: &mut ControlFlowGraph,
|
||||
@@ -260,7 +255,6 @@ fn try_fold_redundant_jump(
|
||||
|
||||
/// Redirects `jump` instructions that point to other `jump` instructions to the final destination.
|
||||
/// This transformation may orphan some blocks.
|
||||
#[cfg(feature = "basic-blocks")]
|
||||
fn fold_redundant_jumps(
|
||||
func: &mut Function,
|
||||
cfg: &mut ControlFlowGraph,
|
||||
|
||||
@@ -636,7 +636,6 @@ impl<'c, 'f> ir::InstInserterBase<'c> for &'c mut FuncCursor<'f> {
|
||||
|
||||
fn insert_built_inst(self, inst: ir::Inst, _: ir::Type) -> &'c mut ir::DataFlowGraph {
|
||||
// TODO: Remove this assertion once #796 is fixed.
|
||||
#[cfg(feature = "basic-blocks")]
|
||||
#[cfg(debug_assertions)]
|
||||
{
|
||||
if let CursorPosition::At(_) = self.position() {
|
||||
@@ -766,7 +765,6 @@ impl<'c, 'f> ir::InstInserterBase<'c> for &'c mut EncCursor<'f> {
|
||||
ctrl_typevar: ir::Type,
|
||||
) -> &'c mut ir::DataFlowGraph {
|
||||
// TODO: Remove this assertion once #796 is fixed.
|
||||
#[cfg(feature = "basic-blocks")]
|
||||
#[cfg(debug_assertions)]
|
||||
{
|
||||
if let CursorPosition::At(_) = self.position() {
|
||||
|
||||
@@ -9,7 +9,7 @@ use crate::ir;
|
||||
use crate::ir::{DataFlowGraph, ExternalName, Layout, Signature};
|
||||
use crate::ir::{
|
||||
Ebb, ExtFuncData, FuncRef, GlobalValue, GlobalValueData, Heap, HeapData, Inst, JumpTable,
|
||||
JumpTableData, SigRef, StackSlot, StackSlotData, Table, TableData,
|
||||
JumpTableData, Opcode, SigRef, StackSlot, StackSlotData, Table, TableData,
|
||||
};
|
||||
use crate::ir::{EbbOffsets, FrameLayout, InstEncodings, SourceLocs, StackSlots, ValueLocations};
|
||||
use crate::ir::{JumpTableOffsets, JumpTables};
|
||||
@@ -19,9 +19,6 @@ use crate::value_label::ValueLabelsRanges;
|
||||
use crate::write::write_function;
|
||||
use core::fmt;
|
||||
|
||||
#[cfg(feature = "basic-blocks")]
|
||||
use crate::ir::Opcode;
|
||||
|
||||
/// A function.
|
||||
///
|
||||
/// Functions can be cloned, but it is not a very fast operation.
|
||||
@@ -273,7 +270,6 @@ impl Function {
|
||||
/// Checks that the specified EBB can be encoded as a basic block.
|
||||
///
|
||||
/// On error, returns the first invalid instruction and an error message.
|
||||
#[cfg(feature = "basic-blocks")]
|
||||
pub fn is_ebb_basic(&self, ebb: Ebb) -> Result<(), (Inst, &'static str)> {
|
||||
let dfg = &self.dfg;
|
||||
let inst_iter = self.layout.ebb_insts(ebb);
|
||||
|
||||
@@ -189,19 +189,18 @@ fn perform_repairs(pos: &mut FuncCursor, cfg: &ControlFlowGraph, mut repairs: Ve
|
||||
|
||||
// Split the old argument, possibly causing more repairs to be scheduled.
|
||||
pos.goto_inst(inst);
|
||||
#[cfg(feature = "basic-blocks")]
|
||||
{
|
||||
let inst_ebb = pos.func.layout.inst_ebb(inst).expect("inst in ebb");
|
||||
|
||||
// Insert split values prior to the terminal branch group.
|
||||
let canonical = pos
|
||||
.func
|
||||
.layout
|
||||
.canonical_branch_inst(&pos.func.dfg, inst_ebb);
|
||||
if let Some(first_branch) = canonical {
|
||||
pos.goto_inst(first_branch);
|
||||
}
|
||||
let inst_ebb = pos.func.layout.inst_ebb(inst).expect("inst in ebb");
|
||||
|
||||
// Insert split values prior to the terminal branch group.
|
||||
let canonical = pos
|
||||
.func
|
||||
.layout
|
||||
.canonical_branch_inst(&pos.func.dfg, inst_ebb);
|
||||
if let Some(first_branch) = canonical {
|
||||
pos.goto_inst(first_branch);
|
||||
}
|
||||
|
||||
let (lo, hi) = split_value(pos, old_arg, repair.concat, &mut repairs);
|
||||
|
||||
// The `lo` part replaces the original argument.
|
||||
|
||||
@@ -2,8 +2,6 @@
|
||||
//!
|
||||
//! One of the reason for splitting edges is to be able to insert `copy` and `regmove` instructions
|
||||
//! between a conditional branch and the following terminator.
|
||||
#![cfg(feature = "basic-blocks")]
|
||||
|
||||
use alloc::vec::Vec;
|
||||
|
||||
use crate::cursor::{Cursor, EncCursor};
|
||||
|
||||
@@ -206,7 +206,7 @@ impl<'a> Context<'a> {
|
||||
// We are not able to insert any regmove for diversion or un-diversion after the first
|
||||
// branch. Instead, we record the diversion to be restored at the entry of the next EBB,
|
||||
// which should have a single predecessor.
|
||||
if opcode.is_branch() && cfg!(feature = "basic-blocks") {
|
||||
if opcode.is_branch() {
|
||||
// The next instruction is necessarily an unconditional branch.
|
||||
if let Some(branch) = self.cur.next_inst() {
|
||||
debug!(
|
||||
|
||||
@@ -8,7 +8,6 @@ use crate::dominator_tree::DominatorTree;
|
||||
use crate::flowgraph::ControlFlowGraph;
|
||||
use crate::ir::Function;
|
||||
use crate::isa::TargetIsa;
|
||||
#[cfg(feature = "basic-blocks")]
|
||||
use crate::regalloc::branch_splitting;
|
||||
use crate::regalloc::coalescing::Coalescing;
|
||||
use crate::regalloc::coloring::Coloring;
|
||||
@@ -96,10 +95,7 @@ impl Context {
|
||||
self.tracker.clear();
|
||||
|
||||
// Pass: Split branches, add space where to add copy & regmove instructions.
|
||||
#[cfg(feature = "basic-blocks")]
|
||||
{
|
||||
branch_splitting::run(isa, func, cfg, domtree, &mut self.topo);
|
||||
}
|
||||
branch_splitting::run(isa, func, cfg, domtree, &mut self.topo);
|
||||
|
||||
// Pass: Liveness analysis.
|
||||
self.liveness.compute(isa, func, cfg);
|
||||
|
||||
@@ -504,7 +504,6 @@ impl<'a> Verifier<'a> {
|
||||
|
||||
/// Check that the given EBB can be encoded as a BB, by checking that only
|
||||
/// branching instructions are ending the EBB.
|
||||
#[cfg(feature = "basic-blocks")]
|
||||
fn encodable_as_bb(&self, ebb: Ebb, errors: &mut VerifierErrors) -> VerifierStepResult<()> {
|
||||
match self.func.is_ebb_basic(ebb) {
|
||||
Ok(()) => Ok(()),
|
||||
@@ -1983,7 +1982,6 @@ impl<'a> Verifier<'a> {
|
||||
self.immediate_constraints(inst, errors)?;
|
||||
}
|
||||
|
||||
#[cfg(feature = "basic-blocks")]
|
||||
self.encodable_as_bb(ebb, errors)?;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user