All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tobias Klausmann <tobias.johannes.klausmann-AqjdNwhu20eELgA04lAiVw@public.gmane.org>
To: nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Subject: [PATCH v3] nouveau/compiler: Allow to omit line numbers when printing instructions
Date: Fri, 24 Nov 2017 16:55:29 +0100	[thread overview]
Message-ID: <20171124155529.8990-1-tobias.johannes.klausmann@mni.thm.de> (raw)
In-Reply-To: <20171120221501.pz3oprojv3switve-WLoDKDh+7sdAfugRpC6u6w@public.gmane.org>

This comes in handy when checking "NV50_PROG_DEBUG=1" outputs with diff!

V2:
 - Use environmental variable (Karol Herbst)
V3:
 - Use the already populated nv50_ir_prog_info to forward information to the
   print pass (Pierre Moreau)

Signed-off-by: Tobias Klausmann <tobias.johannes.klausmann@mni.thm.de>
---
 src/gallium/drivers/nouveau/codegen/nv50_ir_driver.h  |  1 +
 src/gallium/drivers/nouveau/codegen/nv50_ir_print.cpp | 12 +++++++++---
 src/gallium/drivers/nouveau/nouveau_compiler.c        |  2 ++
 src/gallium/drivers/nouveau/nv50/nv50_program.c       |  2 ++
 src/gallium/drivers/nouveau/nvc0/nvc0_program.c       |  2 ++
 5 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_driver.h b/src/gallium/drivers/nouveau/codegen/nv50_ir_driver.h
index ffd53c9cd3..604a22ba89 100644
--- a/src/gallium/drivers/nouveau/codegen/nv50_ir_driver.h
+++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_driver.h
@@ -82,6 +82,7 @@ struct nv50_ir_prog_info
 
    uint8_t optLevel; /* optimization level (0 to 3) */
    uint8_t dbgFlags;
+   bool omitLineNum;
 
    struct {
       int16_t maxGPR;     /* may be -1 if none used */
diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_print.cpp b/src/gallium/drivers/nouveau/codegen/nv50_ir_print.cpp
index 9145801b62..eb7e9057b5 100644
--- a/src/gallium/drivers/nouveau/codegen/nv50_ir_print.cpp
+++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_print.cpp
@@ -691,7 +691,7 @@ void Instruction::print() const
 class PrintPass : public Pass
 {
 public:
-   PrintPass() : serial(0) { }
+   PrintPass(bool omitLineNum = false) : serial(0), omit_serial(omitLineNum) { }
 
    virtual bool visit(Function *);
    virtual bool visit(BasicBlock *);
@@ -699,6 +699,7 @@ public:
 
 private:
    int serial;
+   bool omit_serial;
 };
 
 bool
@@ -762,7 +763,12 @@ PrintPass::visit(BasicBlock *bb)
 bool
 PrintPass::visit(Instruction *insn)
 {
-   INFO("%3i: ", serial++);
+   if (omit_serial) {
+      INFO("     ");
+      serial++;
+   }
+   else
+      INFO("%3i: ", serial++);
    insn->print();
    return true;
 }
@@ -777,7 +783,7 @@ Function::print()
 void
 Program::print()
 {
-   PrintPass pass;
+   PrintPass pass(driver->omitLineNum);
    init_colours();
    pass.run(this, true, false);
 }
diff --git a/src/gallium/drivers/nouveau/nouveau_compiler.c b/src/gallium/drivers/nouveau/nouveau_compiler.c
index 3151a6f420..1214cf3565 100644
--- a/src/gallium/drivers/nouveau/nouveau_compiler.c
+++ b/src/gallium/drivers/nouveau/nouveau_compiler.c
@@ -122,6 +122,8 @@ nouveau_codegen(int chipset, int type, struct tgsi_token tokens[],
 
    info.optLevel = debug_get_num_option("NV50_PROG_OPTIMIZE", 3);
    info.dbgFlags = debug_get_num_option("NV50_PROG_DEBUG", 0);
+   info.omitLineNum =
+         debug_get_num_option("NV50_PROG_DEBUG_OMIT_LINENUM", 0) ? true : false;
 
    ret = nv50_ir_generate_code(&info);
    if (ret) {
diff --git a/src/gallium/drivers/nouveau/nv50/nv50_program.c b/src/gallium/drivers/nouveau/nv50/nv50_program.c
index 6e943a3d94..fb5c9ed777 100644
--- a/src/gallium/drivers/nouveau/nv50/nv50_program.c
+++ b/src/gallium/drivers/nouveau/nv50/nv50_program.c
@@ -367,6 +367,8 @@ nv50_program_translate(struct nv50_program *prog, uint16_t chipset,
 #ifdef DEBUG
    info->optLevel = debug_get_num_option("NV50_PROG_OPTIMIZE", 3);
    info->dbgFlags = debug_get_num_option("NV50_PROG_DEBUG", 0);
+   info->omitLineNum =
+         debug_get_num_option("NV50_PROG_DEBUG_OMIT_LINENUM", 0) ? true : false;
 #else
    info->optLevel = 3;
 #endif
diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_program.c b/src/gallium/drivers/nouveau/nvc0/nvc0_program.c
index c95a96c717..8dced66437 100644
--- a/src/gallium/drivers/nouveau/nvc0/nvc0_program.c
+++ b/src/gallium/drivers/nouveau/nvc0/nvc0_program.c
@@ -575,6 +575,8 @@ nvc0_program_translate(struct nvc0_program *prog, uint16_t chipset,
    info->target = debug_get_num_option("NV50_PROG_CHIPSET", chipset);
    info->optLevel = debug_get_num_option("NV50_PROG_OPTIMIZE", 3);
    info->dbgFlags = debug_get_num_option("NV50_PROG_DEBUG", 0);
+   info->omitLineNum =
+         debug_get_num_option("NV50_PROG_DEBUG_OMIT_LINENUM", 0) ? true : false;
 #else
    info->optLevel = 3;
 #endif
-- 
2.15.0

_______________________________________________
Nouveau mailing list
Nouveau@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/nouveau

  parent reply	other threads:[~2017-11-24 15:55 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-14 15:01 [RFC PATCH] nouveau/compiler: Allow to omit line numbers when printing instructions Tobias Klausmann
     [not found] ` <20171114150105.6428-1-tobias.johannes.klausmann-AqjdNwhu20eELgA04lAiVw@public.gmane.org>
2017-11-14 15:51   ` Karol Herbst
     [not found]     ` <CACO55tvX6ozw94n1E1orFaQOUEkL=gJQO4g5aT5fzcxxvOnpqg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-11-17 16:21       ` [PATCH v2] " Tobias Klausmann
     [not found]         ` <20171117162151.24941-1-tobias.johannes.klausmann-AqjdNwhu20eELgA04lAiVw@public.gmane.org>
2017-11-20 22:15           ` Pierre Moreau
     [not found]             ` <20171120221501.pz3oprojv3switve-WLoDKDh+7sdAfugRpC6u6w@public.gmane.org>
2017-11-24 15:55               ` Tobias Klausmann [this message]
     [not found]                 ` <20171124155529.8990-1-tobias.johannes.klausmann-AqjdNwhu20eELgA04lAiVw@public.gmane.org>
2017-11-24 16:10                   ` [PATCH v3] " Pierre Moreau

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171124155529.8990-1-tobias.johannes.klausmann@mni.thm.de \
    --to=tobias.johannes.klausmann-aqjdnwhu20eelga04laivw@public.gmane.org \
    --cc=nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.