diff --git a/llvm/include/llvm/Support/MachineValueType.h b/llvm/include/llvm/Support/MachineValueType.h --- a/llvm/include/llvm/Support/MachineValueType.h +++ b/llvm/include/llvm/Support/MachineValueType.h @@ -350,6 +350,12 @@ bool operator>=(const MVT& S) const { return SimpleTy >= S.SimpleTy; } bool operator<=(const MVT& S) const { return SimpleTy <= S.SimpleTy; } + /// Support for debugging, callable in GDB: VT.dump() + void dump() const; + + /// Implement operator<<. + void print(raw_ostream &OS) const; + /// Return true if this is a valid simple valuetype. bool isValid() const { return (SimpleTy >= MVT::FIRST_VALUETYPE && @@ -1571,6 +1577,11 @@ /// @} }; + inline raw_ostream &operator<<(raw_ostream &OS, const MVT &VT) { + VT.print(OS); + return OS; + } + } // end namespace llvm #endif // LLVM_SUPPORT_MACHINEVALUETYPE_H diff --git a/llvm/lib/CodeGen/CallingConvLower.cpp b/llvm/lib/CodeGen/CallingConvLower.cpp --- a/llvm/lib/CodeGen/CallingConvLower.cpp +++ b/llvm/lib/CodeGen/CallingConvLower.cpp @@ -129,7 +129,7 @@ if (Fn(i, ArgVT, ArgVT, CCValAssign::Full, ArgFlags, *this)) { #ifndef NDEBUG dbgs() << "Call operand #" << i << " has unhandled type " - << EVT(ArgVT).getEVTString() << '\n'; + << ArgVT << '\n'; #endif llvm_unreachable(nullptr); } @@ -147,7 +147,7 @@ if (Fn(i, ArgVT, ArgVT, CCValAssign::Full, ArgFlags, *this)) { #ifndef NDEBUG dbgs() << "Call operand #" << i << " has unhandled type " - << EVT(ArgVT).getEVTString() << '\n'; + << ArgVT << '\n'; #endif llvm_unreachable(nullptr); } @@ -164,7 +164,7 @@ if (Fn(i, VT, VT, CCValAssign::Full, Flags, *this)) { #ifndef NDEBUG dbgs() << "Call result #" << i << " has unhandled type " - << EVT(VT).getEVTString() << '\n'; + << VT << '\n'; #endif llvm_unreachable(nullptr); } @@ -176,7 +176,7 @@ if (Fn(0, VT, VT, CCValAssign::Full, ISD::ArgFlagsTy(), *this)) { #ifndef NDEBUG dbgs() << "Call result has unhandled type " - << EVT(VT).getEVTString() << '\n'; + << VT << '\n'; #endif llvm_unreachable(nullptr); } @@ -212,7 +212,7 @@ do { if (Fn(0, VT, VT, CCValAssign::Full, Flags, *this)) { #ifndef NDEBUG - dbgs() << "Call has unhandled type " << EVT(VT).getEVTString() + dbgs() << "Call has unhandled type " << VT << " while computing remaining regparms\n"; #endif llvm_unreachable(nullptr); diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp @@ -3240,7 +3240,7 @@ if (CaseSize == 0) break; // Otherwise, execute the case we found. - LLVM_DEBUG(dbgs() << " TypeSwitch[" << EVT(CurNodeVT).getEVTString() + LLVM_DEBUG(dbgs() << " TypeSwitch[" << CurNodeVT << "] from " << SwitchStart << " to " << MatcherIndex << '\n'); continue; diff --git a/llvm/lib/CodeGen/ValueTypes.cpp b/llvm/lib/CodeGen/ValueTypes.cpp --- a/llvm/lib/CodeGen/ValueTypes.cpp +++ b/llvm/lib/CodeGen/ValueTypes.cpp @@ -615,3 +615,15 @@ } } } + +#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) +void MVT::dump() const { + print(dbgs()); + dbgs() << "\n"; +} +#endif + +void MVT::print(raw_ostream &OS) const { + OS << EVT(*this).getEVTString(); +} + diff --git a/llvm/lib/Target/Hexagon/HexagonISelLowering.cpp b/llvm/lib/Target/Hexagon/HexagonISelLowering.cpp --- a/llvm/lib/Target/Hexagon/HexagonISelLowering.cpp +++ b/llvm/lib/Target/Hexagon/HexagonISelLowering.cpp @@ -2573,7 +2573,7 @@ } #ifndef NDEBUG - dbgs() << "VecTy: " << EVT(VecTy).getEVTString() << '\n'; + dbgs() << "VecTy: " << VecTy << '\n'; #endif llvm_unreachable("Unexpected vector element type"); } diff --git a/llvm/lib/Target/Lanai/LanaiISelLowering.cpp b/llvm/lib/Target/Lanai/LanaiISelLowering.cpp --- a/llvm/lib/Target/Lanai/LanaiISelLowering.cpp +++ b/llvm/lib/Target/Lanai/LanaiISelLowering.cpp @@ -489,7 +489,7 @@ // Check that the argument fits in stack slot if (ObjSize > 4) { errs() << "LowerFormalArguments Unhandled argument type: " - << EVT(VA.getLocVT()).getEVTString() << "\n"; + << VA.getLocVT() << "\n"; } // Create the frame index object for this incoming parameter... int FI = MFI.CreateFixedObject(ObjSize, VA.getLocMemOffset(), true); diff --git a/llvm/lib/Target/LoongArch/LoongArchISelLowering.cpp b/llvm/lib/Target/LoongArch/LoongArchISelLowering.cpp --- a/llvm/lib/Target/LoongArch/LoongArchISelLowering.cpp +++ b/llvm/lib/Target/LoongArch/LoongArchISelLowering.cpp @@ -2048,7 +2048,7 @@ if (Fn(MF.getDataLayout(), ABI, i, ArgVT, CCValAssign::Full, Ins[i].Flags, CCInfo, /*IsFixed=*/true, IsRet, ArgTy)) { LLVM_DEBUG(dbgs() << "InputArg #" << i << " has unhandled type " - << EVT(ArgVT).getEVTString() << '\n'); + << ArgVT << '\n'); llvm_unreachable(""); } } @@ -2066,7 +2066,7 @@ if (Fn(MF.getDataLayout(), ABI, i, ArgVT, CCValAssign::Full, Outs[i].Flags, CCInfo, Outs[i].IsFixed, IsRet, OrigTy)) { LLVM_DEBUG(dbgs() << "OutputArg #" << i << " has unhandled type " - << EVT(ArgVT).getEVTString() << "\n"); + << ArgVT << "\n"); llvm_unreachable(""); } } diff --git a/llvm/lib/Target/MSP430/MSP430ISelLowering.cpp b/llvm/lib/Target/MSP430/MSP430ISelLowering.cpp --- a/llvm/lib/Target/MSP430/MSP430ISelLowering.cpp +++ b/llvm/lib/Target/MSP430/MSP430ISelLowering.cpp @@ -686,8 +686,7 @@ unsigned ObjSize = VA.getLocVT().getSizeInBits()/8; if (ObjSize > 2) { errs() << "LowerFormalArguments Unhandled argument type: " - << EVT(VA.getLocVT()).getEVTString() - << "\n"; + << VA.getLocVT() << "\n"; } // Create the frame index object for this incoming parameter... int FI = MFI.CreateFixedObject(ObjSize, VA.getLocMemOffset(), true); diff --git a/llvm/lib/Target/PowerPC/PPCISelLowering.cpp b/llvm/lib/Target/PowerPC/PPCISelLowering.cpp --- a/llvm/lib/Target/PowerPC/PPCISelLowering.cpp +++ b/llvm/lib/Target/PowerPC/PPCISelLowering.cpp @@ -5784,7 +5784,7 @@ if (Result) { #ifndef NDEBUG errs() << "Call operand #" << i << " has unhandled type " - << EVT(ArgVT).getEVTString() << "\n"; + << ArgVT << "\n"; #endif llvm_unreachable(nullptr); } diff --git a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp --- a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp +++ b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp @@ -12253,7 +12253,7 @@ ArgFlags, CCInfo, /*IsFixed=*/true, IsRet, ArgTy, *this, FirstMaskArgument)) { LLVM_DEBUG(dbgs() << "InputArg #" << i << " has unhandled type " - << EVT(ArgVT).getEVTString() << '\n'); + << ArgVT << '\n'); llvm_unreachable(nullptr); } } @@ -12279,7 +12279,7 @@ ArgFlags, CCInfo, Outs[i].IsFixed, IsRet, OrigTy, *this, FirstMaskArgument)) { LLVM_DEBUG(dbgs() << "OutputArg #" << i << " has unhandled type " - << EVT(ArgVT).getEVTString() << "\n"); + << ArgVT << "\n"); llvm_unreachable(nullptr); } } diff --git a/llvm/lib/Target/XCore/XCoreISelLowering.cpp b/llvm/lib/Target/XCore/XCoreISelLowering.cpp --- a/llvm/lib/Target/XCore/XCoreISelLowering.cpp +++ b/llvm/lib/Target/XCore/XCoreISelLowering.cpp @@ -1316,8 +1316,7 @@ unsigned ObjSize = VA.getLocVT().getSizeInBits()/8; if (ObjSize > StackSlotSize) { errs() << "LowerFormalArguments Unhandled argument type: " - << EVT(VA.getLocVT()).getEVTString() - << "\n"; + << VA.getLocVT() << "\n"; } // Create the frame index object for this incoming parameter... int FI = MFI.CreateFixedObject(ObjSize,