From: Philip Reames Date: Tue, 3 Jan 2023 21:56:23 +0000 (-0800) Subject: [RISCV][InsertVSETVLI] Add debug output capability to DemandedFields [nfc] X-Git-Tag: upstream/17.0.6~22239 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d36936fdb462fdda29326a51c2193a3fd10d6807;p=platform%2Fupstream%2Fllvm.git [RISCV][InsertVSETVLI] Add debug output capability to DemandedFields [nfc] --- diff --git a/llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp b/llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp index dddcd5d..438e8ee 100644 --- a/llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp +++ b/llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp @@ -146,8 +146,36 @@ struct DemandedFields { TailPolicy = true; MaskPolicy = true; } +#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) + /// Support for debugging, callable in GDB: V->dump() + LLVM_DUMP_METHOD void dump() const { + print(dbgs()); + dbgs() << "\n"; + } + + /// Implement operator<<. + void print(raw_ostream &OS) const { + OS << "{"; + OS << "VL=" << VL << ", "; + OS << "SEW=" << SEW << ", "; + OS << "LMUL=" << LMUL << ", "; + OS << "SEWLMULRatio=" << SEWLMULRatio << ", "; + OS << "TailPolicy=" << TailPolicy << ", "; + OS << "MaskPolicy=" << MaskPolicy; + OS << "}"; + } +#endif }; +#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) +LLVM_ATTRIBUTE_USED +inline raw_ostream &operator<<(raw_ostream &OS, const DemandedFields &DF) { + DF.print(OS); + return OS; +} +#endif + + /// Return true if the two values of the VTYPE register provided are /// indistinguishable from the perspective of an instruction (or set of /// instructions) which use only the Used subfields and properties.