Move the CursorBase trait into the cursor module.

Also move the CursorPosition type into the cursor module.

Move layout::cursor into the tests module as LayoutCursor and remove its
ability to insert instructions via the dfg.ins() method. This cursor
type is only used in the layout unit tests now.

The FuncCursor and EncCursor types are the commonly used cursors now.
This commit is contained in:
Jakob Stoklund Olesen
2017-10-19 11:33:53 -07:00
parent 6d44508055
commit 57b81a179e
4 changed files with 614 additions and 689 deletions

View File

@@ -2,10 +2,9 @@
use entity::{PrimaryMap, EntityMap};
use isa::TargetIsa;
use ir::builder::{InsertBuilder, ReplaceBuilder};
use ir::builder::ReplaceBuilder;
use ir::extfunc::ExtFuncData;
use ir::instructions::{InstructionData, CallInfo, BranchInfo};
use ir::layout::{Cursor, LayoutCursorInserter};
use ir::types;
use ir::{Ebb, Inst, Value, Type, SigRef, Signature, FuncRef, ValueList, ValueListPool};
use write::write_operands;
@@ -479,14 +478,6 @@ impl DataFlowGraph {
total_results
}
/// Create an `InsertBuilder` that will insert an instruction at the cursor's current position.
pub fn ins<'c, 'fc: 'c, 'fd>(
&'fd mut self,
at: &'c mut Cursor<'fc>,
) -> InsertBuilder<'fd, LayoutCursorInserter<'c, 'fc, 'fd>> {
InsertBuilder::new(LayoutCursorInserter::new(at, self))
}
/// Create a `ReplaceBuilder` that will replace `inst` with a new instruction in place.
pub fn replace(&mut self, inst: Inst) -> ReplaceBuilder {
ReplaceBuilder::new(self, inst)
@@ -508,7 +499,6 @@ impl DataFlowGraph {
self.results[inst].clear(&mut self.value_lists)
}
/// Attach an existing value to the result value list for `inst`.
///
/// The `res` value is appended to the end of the result list.