[PATCH] D125344: [RISCV] Move implementation of getVLOpNum and getSEWOpNum from RISCVInsertVSETVLI to RISCVBaseInfo.h. NFC
Craig Topper via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed May 11 11:20:04 PDT 2022
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG09f48c6b80a4: [RISCV] Move implementation of getVLOpNum and getSEWOpNum from… (authored by craig.topper).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D125344/new/
https://reviews.llvm.org/D125344
Files:
llvm/lib/Target/RISCV/MCTargetDesc/RISCVBaseInfo.h
llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp
Index: llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp
===================================================================
--- llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp
+++ llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp
@@ -544,23 +544,11 @@
}
static unsigned getVLOpNum(const MachineInstr &MI) {
- const uint64_t TSFlags = MI.getDesc().TSFlags;
- // This method is only called if we expect to have a VL operand, and all
- // instructions with VL also have SEW.
- assert(RISCVII::hasSEWOp(TSFlags) && RISCVII::hasVLOp(TSFlags));
- unsigned Offset = 2;
- if (RISCVII::hasVecPolicyOp(TSFlags))
- Offset = 3;
- return MI.getNumExplicitOperands() - Offset;
+ return RISCVII::getVLOpNum(MI.getDesc());
}
static unsigned getSEWOpNum(const MachineInstr &MI) {
- const uint64_t TSFlags = MI.getDesc().TSFlags;
- assert(RISCVII::hasSEWOp(TSFlags));
- unsigned Offset = 1;
- if (RISCVII::hasVecPolicyOp(TSFlags))
- Offset = 2;
- return MI.getNumExplicitOperands() - Offset;
+ return RISCVII::getSEWOpNum(MI.getDesc());
}
static VSETVLIInfo computeInfoForInstr(const MachineInstr &MI, uint64_t TSFlags,
@@ -572,7 +560,7 @@
// destination is tied to a source. Unless the source is undef. In that case
// the user would have some control over the policy values.
bool TailAgnostic = true;
- bool UsesMaskPolicy = RISCVII::UsesMaskPolicy(TSFlags);
+ bool UsesMaskPolicy = RISCVII::usesMaskPolicy(TSFlags);
// FIXME: Could we look at the above or below instructions to choose the
// matched mask policy to reduce vsetvli instructions? Default mask policy is
// agnostic if instructions use mask policy, otherwise is undisturbed. Because
Index: llvm/lib/Target/RISCV/MCTargetDesc/RISCVBaseInfo.h
===================================================================
--- llvm/lib/Target/RISCV/MCTargetDesc/RISCVBaseInfo.h
+++ llvm/lib/Target/RISCV/MCTargetDesc/RISCVBaseInfo.h
@@ -164,10 +164,30 @@
return TSFlags & IsRVVWideningReductionMask;
}
/// \returns true if mask policy is valid for the instruction.
-static inline bool UsesMaskPolicy(uint64_t TSFlags) {
+static inline bool usesMaskPolicy(uint64_t TSFlags) {
return TSFlags & UsesMaskPolicyMask;
}
+static inline unsigned getVLOpNum(const MCInstrDesc &Desc) {
+ const uint64_t TSFlags = Desc.TSFlags;
+ // This method is only called if we expect to have a VL operand, and all
+ // instructions with VL also have SEW.
+ assert(hasSEWOp(TSFlags) && hasVLOp(TSFlags));
+ unsigned Offset = 2;
+ if (hasVecPolicyOp(TSFlags))
+ Offset = 3;
+ return Desc.getNumOperands() - Offset;
+}
+
+static inline unsigned getSEWOpNum(const MCInstrDesc &Desc) {
+ const uint64_t TSFlags = Desc.TSFlags;
+ assert(hasSEWOp(TSFlags));
+ unsigned Offset = 1;
+ if (hasVecPolicyOp(TSFlags))
+ Offset = 2;
+ return Desc.getNumOperands() - Offset;
+}
+
// RISC-V Specific Machine Operand Flags
enum {
MO_None = 0,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D125344.428721.patch
Type: text/x-patch
Size: 2912 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220511/db3bd69f/attachment.bin>
More information about the llvm-commits
mailing list