Move most Cursor methods into a CursorBase trait.

The Cursor navigation methods all just depend on the cursor's position
and layout reference. Make a CursorBase trait that provides access to
this information with methods and implement the navigation methods on
top of that.

This makes it possible to have multiple types implement the cursor
interface.
This commit is contained in:
Jakob Stoklund Olesen
2017-08-03 16:43:47 -07:00
parent f175882030
commit dba0df787c
20 changed files with 136 additions and 110 deletions

View File

@@ -8,7 +8,7 @@
use dbg::DisplayList;
use dominator_tree::DominatorTree;
use flowgraph::{ControlFlowGraph, BasicBlock};
use ir::{DataFlowGraph, Layout, Cursor, InstBuilder, ValueDef};
use ir::{DataFlowGraph, Layout, Cursor, CursorBase, InstBuilder, ValueDef};
use ir::{Function, Ebb, Inst, Value, ExpandedProgramPoint};
use regalloc::affinity::Affinity;
use regalloc::liveness::Liveness;

View File

@@ -43,7 +43,7 @@
//! The exception is the entry block whose arguments are colored from the ABI requirements.
use dominator_tree::DominatorTree;
use ir::{Ebb, Inst, Value, Function, Cursor, ValueLoc, DataFlowGraph, Layout};
use ir::{Ebb, Inst, Value, Function, Cursor, CursorBase, ValueLoc, DataFlowGraph, Layout};
use ir::{InstEncodings, ValueLocations};
use ir::{InstBuilder, Signature, ArgumentType, ArgumentLoc};
use isa::{RegUnit, RegClass, RegInfo, regs_overlap};

View File

@@ -11,7 +11,7 @@
use dominator_tree::DominatorTree;
use ir::{Ebb, Inst, Value, Function, Signature, DataFlowGraph, InstEncodings};
use ir::layout::{Cursor, CursorPosition};
use ir::layout::{Cursor, CursorBase, CursorPosition};
use ir::{InstBuilder, Opcode, ArgumentType, ArgumentLoc};
use isa::RegClass;
use isa::{TargetIsa, Encoding, EncInfo, RecipeConstraints, ConstraintKind};

View File

@@ -16,7 +16,7 @@
//! operands.
use dominator_tree::DominatorTree;
use ir::{DataFlowGraph, Layout, Cursor, InstBuilder};
use ir::{DataFlowGraph, Layout, Cursor, CursorBase, InstBuilder};
use ir::{Function, Ebb, Inst, Value, ValueLoc, SigRef};
use ir::{InstEncodings, StackSlots, ValueLocations};
use isa::registers::{RegClassMask, RegClassIndex};