2
2
//!
3
3
//! This module defines cursor data types that can be used for inserting instructions.
4
4
5
- use crate :: {
6
- inst_predicates:: has_lowering_side_effect,
7
- ir:: { self } ,
8
- } ;
9
- use alloc:: vec:: Vec ;
5
+ use crate :: ir;
10
6
11
7
/// The possible positions of a cursor.
12
8
#[ derive( Clone , Copy , PartialEq , Eq , Debug ) ]
@@ -38,9 +34,6 @@ pub trait Cursor {
38
34
/// Set the source location that should be assigned to new instructions.
39
35
fn set_srcloc ( & mut self , srcloc : ir:: SourceLoc ) ;
40
36
41
- /// Set the debug tags that should be assigned to new side-effecting instructions.
42
- fn set_debug_tags ( & mut self , tags : Vec < ir:: DebugTag > ) ;
43
-
44
37
/// Borrow a reference to the function layout that this cursor is navigating.
45
38
fn layout ( & self ) -> & ir:: Layout ;
46
39
@@ -68,30 +61,6 @@ pub trait Cursor {
68
61
self
69
62
}
70
63
71
- /// Exchange this cursor for one with a set debug tag list.
72
- ///
73
- /// These tags will be attached to all newly inserted
74
- /// side-effecting instructions.
75
- ///
76
- /// This is intended to be used as a builder method:
77
- ///
78
- /// ```
79
- /// # use cranelift_codegen::ir::{Function, Block, DebugTag};
80
- /// # use cranelift_codegen::cursor::{Cursor, FuncCursor};
81
- /// fn edit_func(func: &mut Function, tags: Vec<DebugTag>) {
82
- /// let mut pos = FuncCursor::new(func).with_debug_tags(tags);
83
- ///
84
- /// // Use `pos`...
85
- /// }
86
- /// ```
87
- fn with_debug_tags ( mut self , tags : Vec < ir:: DebugTag > ) -> Self
88
- where
89
- Self : Sized ,
90
- {
91
- self . set_debug_tags ( tags) ;
92
- self
93
- }
94
-
95
64
/// Rebuild this cursor positioned at `pos`.
96
65
fn at_position ( mut self , pos : CursorPosition ) -> Self
97
66
where
@@ -648,7 +617,6 @@ pub trait Cursor {
648
617
pub struct FuncCursor < ' f > {
649
618
pos : CursorPosition ,
650
619
srcloc : ir:: SourceLoc ,
651
- debug_tags : Vec < ir:: DebugTag > ,
652
620
653
621
/// The referenced function.
654
622
pub func : & ' f mut ir:: Function ,
@@ -660,7 +628,6 @@ impl<'f> FuncCursor<'f> {
660
628
Self {
661
629
pos : CursorPosition :: Nowhere ,
662
630
srcloc : Default :: default ( ) ,
663
- debug_tags : vec ! [ ] ,
664
631
func,
665
632
}
666
633
}
@@ -694,10 +661,6 @@ impl<'f> Cursor for FuncCursor<'f> {
694
661
self . srcloc = srcloc;
695
662
}
696
663
697
- fn set_debug_tags ( & mut self , tags : Vec < ir:: DebugTag > ) {
698
- self . debug_tags = tags;
699
- }
700
-
701
664
fn layout ( & self ) -> & ir:: Layout {
702
665
& self . func . layout
703
666
}
@@ -721,9 +684,6 @@ impl<'c, 'f> ir::InstInserterBase<'c> for &'c mut FuncCursor<'f> {
721
684
if !self . srcloc . is_default ( ) {
722
685
self . func . set_srcloc ( inst, self . srcloc ) ;
723
686
}
724
- if has_lowering_side_effect ( self . func , inst) && !self . debug_tags . is_empty ( ) {
725
- self . func . debug_tags . set ( inst, self . debug_tags . clone ( ) ) ;
726
- }
727
687
& mut self . func . dfg
728
688
}
729
689
}
0 commit comments