[llvm] r296007 - [CodeGen] Add a way to SkipDebugLoc in MachineInstr::print(). NFC.

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 27 09:45:54 PST 2017


Adding untested functionality isn't usually the best idea. Please include
functionality when it is testable, and with tests.

(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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170227/0fc485cc/attachment.html>


More information about the llvm-commits mailing list