diff options
Diffstat (limited to 'llvm/lib/CodeGen/MachineInstr.cpp')
-rw-r--r-- | llvm/lib/CodeGen/MachineInstr.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/llvm/lib/CodeGen/MachineInstr.cpp b/llvm/lib/CodeGen/MachineInstr.cpp index 400e76f..a930948 100644 --- a/llvm/lib/CodeGen/MachineInstr.cpp +++ b/llvm/lib/CodeGen/MachineInstr.cpp @@ -96,7 +96,8 @@ void MachineInstr::addImplicitDefUseOperands(MachineFunction &MF) { /// the MCInstrDesc. MachineInstr::MachineInstr(MachineFunction &MF, const MCInstrDesc &TID, DebugLoc DL, bool NoImp) - : MCID(&TID), DbgLoc(std::move(DL)), DebugInstrNum(0) { + : MCID(&TID), NumOperands(0), Flags(0), AsmPrinterFlags(0), + DbgLoc(std::move(DL)), DebugInstrNum(0) { assert(DbgLoc.hasTrivialDestructor() && "Expected trivial destructor"); // Reserve space for the expected number of operands. @@ -114,8 +115,8 @@ MachineInstr::MachineInstr(MachineFunction &MF, const MCInstrDesc &TID, /// Does not copy the number from debug instruction numbering, to preserve /// uniqueness. MachineInstr::MachineInstr(MachineFunction &MF, const MachineInstr &MI) - : MCID(&MI.getDesc()), Info(MI.Info), DbgLoc(MI.getDebugLoc()), - DebugInstrNum(0) { + : MCID(&MI.getDesc()), NumOperands(0), Flags(0), AsmPrinterFlags(0), + Info(MI.Info), DbgLoc(MI.getDebugLoc()), DebugInstrNum(0) { assert(DbgLoc.hasTrivialDestructor() && "Expected trivial destructor"); CapOperands = OperandCapacity::get(MI.getNumOperands()); @@ -192,7 +193,8 @@ static void moveOperands(MachineOperand *Dst, MachineOperand *Src, /// 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(isUInt<LLVM_MI_NUMOPERANDS_BITS>(NumOperands + 1) && + "Cannot add more operands."); assert(MCID && "Cannot add operands before providing an instr descriptor"); // Check if we're adding one of our existing operands. |