[llvm] r296007 - [CodeGen] Add a way to SkipDebugLoc in MachineInstr::print(). NFC.
Ahmed Bougacha via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 28 16:19:08 PST 2017
On Mon, Feb 27, 2017 at 9:45 AM, David Blaikie <dblaikie at gmail.com> wrote:
> Adding untested functionality isn't usually the best idea. Please include
> functionality when it is testable, and with tests.
I'm not convinced it's very useful to test this (I guess it depends on
whether one views debug printing as "functionality").
But I was curious, so I tried! https://reviews.llvm.org/D30480
-Ahmed
> (also: explaining why something is done, not just what is done, is helpful
> for context/understanding, etc)
>
> On Thu, Feb 23, 2017 at 11:29 AM Ahmed Bougacha via llvm-commits
> <llvm-commits at lists.llvm.org> wrote:
>>
>> Author: ab
>> Date: Thu Feb 23 13:17:31 2017
>> New Revision: 296007
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=296007&view=rev
>> Log:
>> [CodeGen] Add a way to SkipDebugLoc in MachineInstr::print(). NFC.
>>
>> Modified:
>> llvm/trunk/include/llvm/CodeGen/MachineInstr.h
>> llvm/trunk/lib/CodeGen/MachineInstr.cpp
>>
>> Modified: llvm/trunk/include/llvm/CodeGen/MachineInstr.h
>> URL:
>> http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineInstr.h?rev=296007&r1=296006&r2=296007&view=diff
>>
>> ==============================================================================
>> --- llvm/trunk/include/llvm/CodeGen/MachineInstr.h (original)
>> +++ llvm/trunk/include/llvm/CodeGen/MachineInstr.h Thu Feb 23 13:17:31
>> 2017
>> @@ -1149,9 +1149,10 @@ public:
>> //
>> // Debugging support
>> //
>> - void print(raw_ostream &OS, bool SkipOpers = false,
>> + void print(raw_ostream &OS, bool SkipOpers = false, bool SkipDebugLoc =
>> false,
>> const TargetInstrInfo *TII = nullptr) const;
>> void print(raw_ostream &OS, ModuleSlotTracker &MST, bool SkipOpers =
>> false,
>> + bool SkipDebugLoc = false,
>> const TargetInstrInfo *TII = nullptr) const;
>> void dump() const;
>>
>>
>> Modified: llvm/trunk/lib/CodeGen/MachineInstr.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineInstr.cpp?rev=296007&r1=296006&r2=296007&view=diff
>>
>> ==============================================================================
>> --- llvm/trunk/lib/CodeGen/MachineInstr.cpp (original)
>> +++ llvm/trunk/lib/CodeGen/MachineInstr.cpp Thu Feb 23 13:17:31 2017
>> @@ -1699,7 +1699,7 @@ LLVM_DUMP_METHOD void MachineInstr::dump
>> }
>> #endif
>>
>> -void MachineInstr::print(raw_ostream &OS, bool SkipOpers,
>> +void MachineInstr::print(raw_ostream &OS, bool SkipOpers, bool
>> SkipDebugLoc,
>> const TargetInstrInfo *TII) const {
>> const Module *M = nullptr;
>> if (const MachineBasicBlock *MBB = getParent())
>> @@ -1707,11 +1707,12 @@ void MachineInstr::print(raw_ostream &OS
>> M = MF->getFunction()->getParent();
>>
>> ModuleSlotTracker MST(M);
>> - print(OS, MST, SkipOpers, TII);
>> + print(OS, MST, SkipOpers, SkipDebugLoc, TII);
>> }
>>
>> void MachineInstr::print(raw_ostream &OS, ModuleSlotTracker &MST,
>> - bool SkipOpers, const TargetInstrInfo *TII)
>> const {
>> + bool SkipOpers, bool SkipDebugLoc,
>> + const TargetInstrInfo *TII) const {
>> // We can be a bit tidier if we know the MachineFunction.
>> const MachineFunction *MF = nullptr;
>> const TargetRegisterInfo *TRI = nullptr;
>> @@ -1987,7 +1988,7 @@ void MachineInstr::print(raw_ostream &OS
>> }
>> if (isIndirectDebugValue())
>> OS << " indirect";
>> - } else if (debugLoc && MF) {
>> + } else if (debugLoc && MF && !SkipDebugLoc) {
>> if (!HaveSemi)
>> OS << ";";
>> OS << " dbg:";
>>
>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
More information about the llvm-commits
mailing list