@@ -73,7 +73,7 @@ pub struct MemFlags {
7373 // * 4 - checked flag
7474 // * 5/6 - alias region
7575 // * 7/8/9/10/11/12/13/14 - trap code
76- // * 15 - pure flag
76+ // * 15 - can_move flag
7777 //
7878 // Current properties upheld are:
7979 //
@@ -112,11 +112,12 @@ const ALIAS_REGION_OFFSET: u16 = 5;
112112const MASK_TRAP_CODE : u16 = 0b1111_1111 << TRAP_CODE_OFFSET ;
113113const TRAP_CODE_OFFSET : u16 = 7 ;
114114
115- /// Whether the load's/store's safety is purely a function of its data
116- /// dependencies (i.e. operands) and is not guarded by
117- /// outside-the-data-flow-graph properties, like implicit bounds-checking
115+ /// Whether this memory operation may be freely moved by the optimizer so long
116+ /// as its data dependencies are satisfied. That is, by setting this flag, the
117+ /// producer is guaranteeing that this memory operation's safety is not guarded
118+ /// by outside-the-data-flow-graph properties, like implicit bounds-checking
118119/// control dependencies.
119- const BIT_PURE : u16 = 1 << 15 ;
120+ const BIT_CAN_MOVE : u16 = 1 << 15 ;
120121
121122impl MemFlags {
122123 /// Create a new empty set of flags.
@@ -204,7 +205,7 @@ impl MemFlags {
204205 self . with_alias_region ( Some ( AliasRegion :: Vmctx ) )
205206 }
206207 "checked" => self . with_checked ( ) ,
207- "pure " => self . with_pure ( ) ,
208+ "can_move " => self . with_can_move ( ) ,
208209
209210 other => match TrapCode :: from_str ( other) {
210211 Ok ( code) => self . with_trap_code ( Some ( code) ) ,
@@ -272,7 +273,7 @@ impl MemFlags {
272273 /// This flag does *not* mean that the associated instruction can be
273274 /// code-motioned to arbitrary places in the function so long as its data
274275 /// dependencies are met. This only means that, given its current location
275- /// in the function, it will never trap. See the `pure ` method for more
276+ /// in the function, it will never trap. See the `can_move ` method for more
276277 /// details.
277278 pub const fn notrap ( self ) -> bool {
278279 self . trap_code ( ) . is_none ( )
@@ -289,8 +290,8 @@ impl MemFlags {
289290 self . with_trap_code ( None )
290291 }
291292
292- /// Is this memory operation's safety (e.g. the validity of its `notrap` and
293- /// `readonly` claims) purely a function of its data dependencies ?
293+ /// Is this memory operation safe to move so long as its data dependencies
294+ /// remain satisfied ?
294295 ///
295296 /// If this is `true`, then it is okay to code motion this instruction to
296297 /// arbitrary locations, in the function, including across blocks and
@@ -304,18 +305,18 @@ impl MemFlags {
304305 /// bounds check, which is not reflected in its operands, and it would be
305306 /// unsafe to code motion it above the bounds check, even if its data
306307 /// dependencies would still be satisfied.
307- pub const fn pure ( self ) -> bool {
308- self . read_bit ( BIT_PURE )
308+ pub const fn can_move ( self ) -> bool {
309+ self . read_bit ( BIT_CAN_MOVE )
309310 }
310311
311- /// Set the `pure ` flag.
312- pub const fn set_pure ( & mut self ) {
313- * self = self . with_pure ( ) ;
312+ /// Set the `can_move ` flag.
313+ pub const fn set_can_move ( & mut self ) {
314+ * self = self . with_can_move ( ) ;
314315 }
315316
316- /// Set the `pure ` flag, returning new flags.
317- pub const fn with_pure ( self ) -> Self {
318- self . with_bit ( BIT_PURE )
317+ /// Set the `can_move ` flag, returning new flags.
318+ pub const fn with_can_move ( self ) -> Self {
319+ self . with_bit ( BIT_CAN_MOVE )
319320 }
320321
321322 /// Test if the `aligned` flag is set.
@@ -424,8 +425,8 @@ impl fmt::Display for MemFlags {
424425 if self . readonly ( ) {
425426 write ! ( f, " readonly" ) ?;
426427 }
427- if self . pure ( ) {
428- write ! ( f, " pure " ) ?;
428+ if self . can_move ( ) {
429+ write ! ( f, " can_move " ) ?;
429430 }
430431 if self . read_bit ( BIT_BIG_ENDIAN ) {
431432 write ! ( f, " big" ) ?;
0 commit comments