[PATCH] D149445: [MachineInst] Switch NumOperands to 16bits
Dávid Bolvanský via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Apr 30 12:13:12 PDT 2023
xbolva00 updated this revision to Diff 518344.
xbolva00 added a comment.
Addressed review feedback.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D149445/new/
https://reviews.llvm.org/D149445
Files:
llvm/include/llvm/CodeGen/MachineInstr.h
llvm/lib/CodeGen/MachineInstr.cpp
Index: llvm/lib/CodeGen/MachineInstr.cpp
===================================================================
--- llvm/lib/CodeGen/MachineInstr.cpp
+++ llvm/lib/CodeGen/MachineInstr.cpp
@@ -192,6 +192,7 @@
/// an explicit operand it is added at the end of the explicit operand list
/// (before the first implicit operand).
void MachineInstr::addOperand(MachineFunction &MF, const MachineOperand &Op) {
+ assert(NumOperands < USHRT_MAX && "Cannot add more operands.");
assert(MCID && "Cannot add operands before providing an instr descriptor");
// Check if we're adding one of our existing operands.
Index: llvm/include/llvm/CodeGen/MachineInstr.h
===================================================================
--- llvm/include/llvm/CodeGen/MachineInstr.h
+++ llvm/include/llvm/CodeGen/MachineInstr.h
@@ -120,7 +120,7 @@
// Operands are allocated by an ArrayRecycler.
MachineOperand *Operands = nullptr; // Pointer to the first operand.
- unsigned NumOperands = 0; // Number of operands on instruction.
+ uint16_t NumOperands = 0; // Number of operands on instruction.
uint16_t Flags = 0; // Various bits of additional
// information about machine
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D149445.518344.patch
Type: text/x-patch
Size: 1263 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230430/3b00fd71/attachment.bin>
More information about the llvm-commits
mailing list