[PATCH] D133957: [RISCV] Verify merge operand is tied properly
Philip Reames via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 15 13:07:10 PDT 2022
This revision was automatically updated to reflect the committed changes.
Closed by commit rGfdff1bb10337: [RISCV] Verify merge operand is tied properly (authored by reames).
Changed prior to commit:
https://reviews.llvm.org/D133957?vs=460454&id=460490#toc
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D133957/new/
https://reviews.llvm.org/D133957
Files:
llvm/lib/Target/RISCV/MCTargetDesc/RISCVBaseInfo.h
llvm/lib/Target/RISCV/RISCVInstrInfo.cpp
Index: llvm/lib/Target/RISCV/RISCVInstrInfo.cpp
===================================================================
--- llvm/lib/Target/RISCV/RISCVInstrInfo.cpp
+++ llvm/lib/Target/RISCV/RISCVInstrInfo.cpp
@@ -1216,6 +1216,13 @@
}
const uint64_t TSFlags = Desc.TSFlags;
+ if (RISCVII::hasMergeOp(TSFlags)) {
+ unsigned OpIdx = RISCVII::getMergeOpNum(Desc);
+ if (MI.findTiedOperandIdx(0) != OpIdx) {
+ ErrInfo = "Merge op improperly tied";
+ return false;
+ }
+ }
if (RISCVII::hasVLOp(TSFlags)) {
const MachineOperand &Op = MI.getOperand(RISCVII::getVLOpNum(Desc));
if (!Op.isImm() && !Op.isReg()) {
Index: llvm/lib/Target/RISCV/MCTargetDesc/RISCVBaseInfo.h
===================================================================
--- llvm/lib/Target/RISCV/MCTargetDesc/RISCVBaseInfo.h
+++ llvm/lib/Target/RISCV/MCTargetDesc/RISCVBaseInfo.h
@@ -168,6 +168,12 @@
return TSFlags & UsesMaskPolicyMask;
}
+static inline unsigned getMergeOpNum(const MCInstrDesc &Desc) {
+ assert(hasMergeOp(Desc.TSFlags));
+ assert(!Desc.isVariadic());
+ return Desc.getNumDefs();
+}
+
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D133957.460490.patch
Type: text/x-patch
Size: 1292 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220915/54a22d10/attachment.bin>
More information about the llvm-commits
mailing list