|
16 | 16 | #include "llvm/ADT/DenseMapInfo.h" |
17 | 17 | #include "llvm/CodeGen/Register.h" |
18 | 18 | #include "llvm/IR/Intrinsics.h" |
| 19 | +#include "llvm/MC/LaneBitmask.h" |
19 | 20 | #include "llvm/Support/Compiler.h" |
20 | 21 | #include <cassert> |
21 | 22 |
|
@@ -69,7 +70,8 @@ class MachineOperand { |
69 | 70 | MO_Predicate, ///< Generic predicate for ISel |
70 | 71 | MO_ShuffleMask, ///< Other IR Constant for ISel (shuffle masks) |
71 | 72 | MO_DbgInstrRef, ///< Integer indices referring to an instruction+operand |
72 | | - MO_Last = MO_DbgInstrRef |
| 73 | + MO_LaneMask, ///< Mask to represent active parts of registers |
| 74 | + MO_Last = MO_LaneMask |
73 | 75 | }; |
74 | 76 |
|
75 | 77 | private: |
@@ -178,6 +180,7 @@ class MachineOperand { |
178 | 180 | Intrinsic::ID IntrinsicID; // For MO_IntrinsicID. |
179 | 181 | unsigned Pred; // For MO_Predicate |
180 | 182 | ArrayRef<int> ShuffleMask; // For MO_ShuffleMask |
| 183 | + LaneBitmask LaneMask; // For MO_LaneMask |
181 | 184 |
|
182 | 185 | struct { // For MO_Register. |
183 | 186 | // Register number is in SmallContents.RegNo. |
@@ -360,6 +363,7 @@ class MachineOperand { |
360 | 363 | bool isIntrinsicID() const { return OpKind == MO_IntrinsicID; } |
361 | 364 | bool isPredicate() const { return OpKind == MO_Predicate; } |
362 | 365 | bool isShuffleMask() const { return OpKind == MO_ShuffleMask; } |
| 366 | + bool isLaneMask() const { return OpKind == MO_LaneMask; } |
363 | 367 | //===--------------------------------------------------------------------===// |
364 | 368 | // Accessors for Register Operands |
365 | 369 | //===--------------------------------------------------------------------===// |
@@ -624,6 +628,11 @@ class MachineOperand { |
624 | 628 | return Contents.ShuffleMask; |
625 | 629 | } |
626 | 630 |
|
| 631 | + LaneBitmask getLaneMask() const { |
| 632 | + assert(isLaneMask() && "Wrong MachineOperand accessor"); |
| 633 | + return Contents.LaneMask; |
| 634 | + } |
| 635 | + |
627 | 636 | /// Return the offset from the symbol in this operand. This always returns 0 |
628 | 637 | /// for ExternalSymbol operands. |
629 | 638 | int64_t getOffset() const { |
@@ -992,6 +1001,12 @@ class MachineOperand { |
992 | 1001 | return Op; |
993 | 1002 | } |
994 | 1003 |
|
| 1004 | + static MachineOperand CreateLaneMask(LaneBitmask LaneMask) { |
| 1005 | + MachineOperand Op(MachineOperand::MO_LaneMask); |
| 1006 | + Op.Contents.LaneMask = LaneMask; |
| 1007 | + return Op; |
| 1008 | + } |
| 1009 | + |
995 | 1010 | friend class MachineInstr; |
996 | 1011 | friend class MachineRegisterInfo; |
997 | 1012 |
|
|
0 commit comments