@@ -426,14 +426,13 @@ impl std::fmt::Display for OperandConstraint {
426426 }
427427}
428428
429- /// The "kind" of the operand: whether it reads a vreg (Use), writes a
430- /// vreg (Def), or reads and then writes (Mod, for "modify" ).
429+ /// The "kind" of the operand: whether it reads a vreg (Use) or writes
430+ /// a vreg (Def).
431431#[ derive( Clone , Copy , Debug , PartialEq , Eq ) ]
432432#[ cfg_attr( feature = "enable-serde" , derive( Serialize , Deserialize ) ) ]
433433pub enum OperandKind {
434434 Def = 0 ,
435- Mod = 1 ,
436- Use = 2 ,
435+ Use = 1 ,
437436}
438437
439438/// The "position" of the operand: where it has its read/write
@@ -488,7 +487,7 @@ pub enum OperandPos {
488487pub struct Operand {
489488 /// Bit-pack into 32 bits.
490489 ///
491- /// constraint:7 kind:2 pos:1 class:1 vreg:21
490+ /// constraint:7 kind:1 pos:1 class:2 vreg:21
492491 ///
493492 /// where `constraint` is an `OperandConstraint`, `kind` is an
494493 /// `OperandKind`, `pos` is an `OperandPos`, `class` is a
@@ -532,8 +531,8 @@ impl Operand {
532531 Operand {
533532 bits : vreg. vreg ( ) as u32
534533 | ( class_field << 21 )
535- | ( pos_field << 22 )
536- | ( kind_field << 23 )
534+ | ( pos_field << 23 )
535+ | ( kind_field << 24 )
537536 | ( constraint_field << 25 ) ,
538537 }
539538 }
@@ -719,23 +718,22 @@ impl Operand {
719718 /// Get the register class used by this operand.
720719 #[ inline( always) ]
721720 pub fn class ( self ) -> RegClass {
722- let class_field = ( self . bits >> 21 ) & 1 ;
721+ let class_field = ( self . bits >> 21 ) & 3 ;
723722 match class_field {
724723 0 => RegClass :: Int ,
725724 1 => RegClass :: Float ,
726725 _ => unreachable ! ( ) ,
727726 }
728727 }
729728
730- /// Get the "kind" of this operand: a definition (write), a use
731- /// (read), or a "mod" / modify (a read followed by a write) .
729+ /// Get the "kind" of this operand: a definition (write) or a use
730+ /// (read).
732731 #[ inline( always) ]
733732 pub fn kind ( self ) -> OperandKind {
734- let kind_field = ( self . bits >> 23 ) & 3 ;
733+ let kind_field = ( self . bits >> 24 ) & 1 ;
735734 match kind_field {
736735 0 => OperandKind :: Def ,
737- 1 => OperandKind :: Mod ,
738- 2 => OperandKind :: Use ,
736+ 1 => OperandKind :: Use ,
739737 _ => unreachable ! ( ) ,
740738 }
741739 }
@@ -746,7 +744,7 @@ impl Operand {
746744 /// at "after", though there are cases where this is not true.
747745 #[ inline( always) ]
748746 pub fn pos ( self ) -> OperandPos {
749- let pos_field = ( self . bits >> 22 ) & 1 ;
747+ let pos_field = ( self . bits >> 23 ) & 1 ;
750748 match pos_field {
751749 0 => OperandPos :: Early ,
752750 1 => OperandPos :: Late ,
@@ -808,8 +806,7 @@ impl std::fmt::Debug for Operand {
808806impl std:: fmt:: Display for Operand {
809807 fn fmt ( & self , f : & mut std:: fmt:: Formatter ) -> std:: fmt:: Result {
810808 match ( self . kind ( ) , self . pos ( ) ) {
811- ( OperandKind :: Def , OperandPos :: Late )
812- | ( OperandKind :: Mod | OperandKind :: Use , OperandPos :: Early ) => {
809+ ( OperandKind :: Def , OperandPos :: Late ) | ( OperandKind :: Use , OperandPos :: Early ) => {
813810 write ! ( f, "{:?}" , self . kind( ) ) ?;
814811 }
815812 _ => {
@@ -1058,8 +1055,8 @@ pub trait Function {
10581055 /// it in a given PReg chosen by the client prior to regalloc.
10591056 ///
10601057 /// Every register written by an instruction must either
1061- /// correspond to (be assigned to) an Operand of kind `Def` or
1062- /// `Mod`, or else must be a "clobber".
1058+ /// correspond to (be assigned to) an Operand of kind `Def`, or
1059+ /// else must be a "clobber".
10631060 ///
10641061 /// This can be used to, for example, describe ABI-specified
10651062 /// registers that are not preserved by a call instruction, or
0 commit comments