* [RFC PATCH] nouveau/compiler: Allow to omit line numbers when printing instructions
@ 2017-11-14 15:01 Tobias Klausmann
[not found] ` <20171114150105.6428-1-tobias.johannes.klausmann-AqjdNwhu20eELgA04lAiVw@public.gmane.org>
0 siblings, 1 reply; 6+ messages in thread
From: Tobias Klausmann @ 2017-11-14 15:01 UTC (permalink / raw)
To: nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW
This comes in handy when checking "NV50_PROG_DEBUG=1" outputs with diff!
Signed-off-by: Tobias Klausmann <tobias.johannes.klausmann@mni.thm.de>
---
src/gallium/drivers/nouveau/codegen/nv50_ir.cpp | 6 +++---
src/gallium/drivers/nouveau/codegen/nv50_ir.h | 2 +-
src/gallium/drivers/nouveau/codegen/nv50_ir_driver.h | 1 +
src/gallium/drivers/nouveau/codegen/nv50_ir_print.cpp | 12 ++++++++----
src/gallium/drivers/nouveau/codegen/nv50_ir_target.cpp | 2 +-
src/gallium/drivers/nouveau/nouveau_compiler.c | 8 ++++++--
src/gallium/drivers/nouveau/nv50/nv50_program.c | 1 +
src/gallium/drivers/nouveau/nvc0/nvc0_program.c | 1 +
8 files changed, 22 insertions(+), 11 deletions(-)
diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir.cpp b/src/gallium/drivers/nouveau/codegen/nv50_ir.cpp
index e9363101bf..4bf6c73837 100644
--- a/src/gallium/drivers/nouveau/codegen/nv50_ir.cpp
+++ b/src/gallium/drivers/nouveau/codegen/nv50_ir.cpp
@@ -1249,7 +1249,7 @@ nv50_ir_generate_code(struct nv50_ir_prog_info *info)
if (ret < 0)
goto out;
if (prog->dbgFlags & NV50_IR_DEBUG_VERBOSE)
- prog->print();
+ prog->print(info->omitLineNum);
targ->parseDriverInfo(info);
prog->getTarget()->runLegalizePass(prog, nv50_ir::CG_STAGE_PRE_SSA);
@@ -1257,13 +1257,13 @@ nv50_ir_generate_code(struct nv50_ir_prog_info *info)
prog->convertToSSA();
if (prog->dbgFlags & NV50_IR_DEBUG_VERBOSE)
- prog->print();
+ prog->print(info->omitLineNum);
prog->optimizeSSA(info->optLevel);
prog->getTarget()->runLegalizePass(prog, nv50_ir::CG_STAGE_SSA);
if (prog->dbgFlags & NV50_IR_DEBUG_BASIC)
- prog->print();
+ prog->print(info->omitLineNum);
if (!prog->registerAllocation()) {
ret = -4;
diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir.h b/src/gallium/drivers/nouveau/codegen/nv50_ir.h
index f2ce16d882..a3c7fd2f94 100644
--- a/src/gallium/drivers/nouveau/codegen/nv50_ir.h
+++ b/src/gallium/drivers/nouveau/codegen/nv50_ir.h
@@ -1249,7 +1249,7 @@ public:
Program(Type type, Target *targ);
~Program();
- void print();
+ void print(bool omitLineNum);
Type getType() const { return progType; }
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 f5253b3745..a42fb44940 100644
--- a/src/gallium/drivers/nouveau/codegen/nv50_ir_print.cpp
+++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_print.cpp
@@ -689,7 +689,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 *);
@@ -697,6 +697,7 @@ public:
private:
int serial;
+ bool omit_serial;
};
bool
@@ -760,7 +761,10 @@ PrintPass::visit(BasicBlock *bb)
bool
PrintPass::visit(Instruction *insn)
{
- INFO("%3i: ", serial++);
+ if (omit_serial)
+ INFO(" ");
+ else
+ INFO("%3i: ", serial++);
insn->print();
return true;
}
@@ -773,9 +777,9 @@ Function::print()
}
void
-Program::print()
+Program::print(bool omitLineNum)
{
- PrintPass pass;
+ PrintPass pass(omitLineNum);
init_colours();
pass.run(this, true, false);
}
diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_target.cpp b/src/gallium/drivers/nouveau/codegen/nv50_ir_target.cpp
index 298e7c6ef9..96ad70d28a 100644
--- a/src/gallium/drivers/nouveau/codegen/nv50_ir_target.cpp
+++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_target.cpp
@@ -371,7 +371,7 @@ Program::emitBinary(struct nv50_ir_prog_info *info)
emit->prepareEmission(this);
if (dbgFlags & NV50_IR_DEBUG_BASIC)
- this->print();
+ this->print(info->omitLineNum);
if (!binSize) {
code = NULL;
diff --git a/src/gallium/drivers/nouveau/nouveau_compiler.c b/src/gallium/drivers/nouveau/nouveau_compiler.c
index 3151a6f420..ed68031383 100644
--- a/src/gallium/drivers/nouveau/nouveau_compiler.c
+++ b/src/gallium/drivers/nouveau/nouveau_compiler.c
@@ -103,7 +103,7 @@ dummy_assign_slots(struct nv50_ir_prog_info *info)
static int
nouveau_codegen(int chipset, int type, struct tgsi_token tokens[],
- unsigned *size, unsigned **code) {
+ unsigned *size, unsigned **code, bool omitLineNum) {
struct nv50_ir_prog_info info = {0};
int ret;
@@ -122,6 +122,7 @@ 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 = omitLineNum;
ret = nv50_ir_generate_code(&info);
if (ret) {
@@ -143,10 +144,13 @@ main(int argc, char *argv[])
FILE *f;
char text[65536] = {0};
unsigned size = 0, *code = NULL;
+ bool omitLineNum = false;
for (i = 1; i < argc; i++) {
if (!strcmp(argv[i], "-a"))
chipset = strtol(argv[++i], NULL, 16);
+ if (!strcmp(argv[i], "-o"))
+ omitLineNum = strtol(argv[++i], NULL, 10) ? true : false;
else
filename = argv[i];
}
@@ -203,7 +207,7 @@ main(int argc, char *argv[])
}
if (chipset >= 0x50) {
- i = nouveau_codegen(chipset, type, tokens, &size, &code);
+ i = nouveau_codegen(chipset, type, tokens, &size, &code, omitLineNum);
} else if (chipset >= 0x30) {
i = nv30_codegen(chipset, type, tokens, &size, &code);
} else {
diff --git a/src/gallium/drivers/nouveau/nv50/nv50_program.c b/src/gallium/drivers/nouveau/nv50/nv50_program.c
index 6e943a3d94..b7b76eb0fc 100644
--- a/src/gallium/drivers/nouveau/nv50/nv50_program.c
+++ b/src/gallium/drivers/nouveau/nv50/nv50_program.c
@@ -370,6 +370,7 @@ nv50_program_translate(struct nv50_program *prog, uint16_t chipset,
#else
info->optLevel = 3;
#endif
+ info->omitLineNum = false;
ret = nv50_ir_generate_code(info);
if (ret) {
diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_program.c b/src/gallium/drivers/nouveau/nvc0/nvc0_program.c
index c95a96c717..d460620b83 100644
--- a/src/gallium/drivers/nouveau/nvc0/nvc0_program.c
+++ b/src/gallium/drivers/nouveau/nvc0/nvc0_program.c
@@ -578,6 +578,7 @@ nvc0_program_translate(struct nvc0_program *prog, uint16_t chipset,
#else
info->optLevel = 3;
#endif
+ info->omitLineNum = false;
info->bin.smemSize = prog->cp.smem_size;
info->io.genUserClip = prog->vp.num_ucps;
--
2.15.0
_______________________________________________
Nouveau mailing list
Nouveau@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/nouveau
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [RFC PATCH] nouveau/compiler: Allow to omit line numbers when printing instructions
[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>
0 siblings, 1 reply; 6+ messages in thread
From: Karol Herbst @ 2017-11-14 15:51 UTC (permalink / raw)
To: Tobias Klausmann; +Cc: nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW
I think it is better to put this behind an environmental variable,
because that way it can also be used without having to dump the TGSI
first and I don't see a good reason why not to.
On Tue, Nov 14, 2017 at 4:01 PM, Tobias Klausmann
<tobias.johannes.klausmann@mni.thm.de> wrote:
> This comes in handy when checking "NV50_PROG_DEBUG=1" outputs with diff!
>
> Signed-off-by: Tobias Klausmann <tobias.johannes.klausmann@mni.thm.de>
> ---
> src/gallium/drivers/nouveau/codegen/nv50_ir.cpp | 6 +++---
> src/gallium/drivers/nouveau/codegen/nv50_ir.h | 2 +-
> src/gallium/drivers/nouveau/codegen/nv50_ir_driver.h | 1 +
> src/gallium/drivers/nouveau/codegen/nv50_ir_print.cpp | 12 ++++++++----
> src/gallium/drivers/nouveau/codegen/nv50_ir_target.cpp | 2 +-
> src/gallium/drivers/nouveau/nouveau_compiler.c | 8 ++++++--
> src/gallium/drivers/nouveau/nv50/nv50_program.c | 1 +
> src/gallium/drivers/nouveau/nvc0/nvc0_program.c | 1 +
> 8 files changed, 22 insertions(+), 11 deletions(-)
>
> diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir.cpp b/src/gallium/drivers/nouveau/codegen/nv50_ir.cpp
> index e9363101bf..4bf6c73837 100644
> --- a/src/gallium/drivers/nouveau/codegen/nv50_ir.cpp
> +++ b/src/gallium/drivers/nouveau/codegen/nv50_ir.cpp
> @@ -1249,7 +1249,7 @@ nv50_ir_generate_code(struct nv50_ir_prog_info *info)
> if (ret < 0)
> goto out;
> if (prog->dbgFlags & NV50_IR_DEBUG_VERBOSE)
> - prog->print();
> + prog->print(info->omitLineNum);
>
> targ->parseDriverInfo(info);
> prog->getTarget()->runLegalizePass(prog, nv50_ir::CG_STAGE_PRE_SSA);
> @@ -1257,13 +1257,13 @@ nv50_ir_generate_code(struct nv50_ir_prog_info *info)
> prog->convertToSSA();
>
> if (prog->dbgFlags & NV50_IR_DEBUG_VERBOSE)
> - prog->print();
> + prog->print(info->omitLineNum);
>
> prog->optimizeSSA(info->optLevel);
> prog->getTarget()->runLegalizePass(prog, nv50_ir::CG_STAGE_SSA);
>
> if (prog->dbgFlags & NV50_IR_DEBUG_BASIC)
> - prog->print();
> + prog->print(info->omitLineNum);
>
> if (!prog->registerAllocation()) {
> ret = -4;
> diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir.h b/src/gallium/drivers/nouveau/codegen/nv50_ir.h
> index f2ce16d882..a3c7fd2f94 100644
> --- a/src/gallium/drivers/nouveau/codegen/nv50_ir.h
> +++ b/src/gallium/drivers/nouveau/codegen/nv50_ir.h
> @@ -1249,7 +1249,7 @@ public:
> Program(Type type, Target *targ);
> ~Program();
>
> - void print();
> + void print(bool omitLineNum);
>
> Type getType() const { return progType; }
>
> 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 f5253b3745..a42fb44940 100644
> --- a/src/gallium/drivers/nouveau/codegen/nv50_ir_print.cpp
> +++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_print.cpp
> @@ -689,7 +689,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 *);
> @@ -697,6 +697,7 @@ public:
>
> private:
> int serial;
> + bool omit_serial;
> };
>
> bool
> @@ -760,7 +761,10 @@ PrintPass::visit(BasicBlock *bb)
> bool
> PrintPass::visit(Instruction *insn)
> {
> - INFO("%3i: ", serial++);
> + if (omit_serial)
> + INFO(" ");
> + else
> + INFO("%3i: ", serial++);
> insn->print();
> return true;
> }
> @@ -773,9 +777,9 @@ Function::print()
> }
>
> void
> -Program::print()
> +Program::print(bool omitLineNum)
> {
> - PrintPass pass;
> + PrintPass pass(omitLineNum);
> init_colours();
> pass.run(this, true, false);
> }
> diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_target.cpp b/src/gallium/drivers/nouveau/codegen/nv50_ir_target.cpp
> index 298e7c6ef9..96ad70d28a 100644
> --- a/src/gallium/drivers/nouveau/codegen/nv50_ir_target.cpp
> +++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_target.cpp
> @@ -371,7 +371,7 @@ Program::emitBinary(struct nv50_ir_prog_info *info)
> emit->prepareEmission(this);
>
> if (dbgFlags & NV50_IR_DEBUG_BASIC)
> - this->print();
> + this->print(info->omitLineNum);
>
> if (!binSize) {
> code = NULL;
> diff --git a/src/gallium/drivers/nouveau/nouveau_compiler.c b/src/gallium/drivers/nouveau/nouveau_compiler.c
> index 3151a6f420..ed68031383 100644
> --- a/src/gallium/drivers/nouveau/nouveau_compiler.c
> +++ b/src/gallium/drivers/nouveau/nouveau_compiler.c
> @@ -103,7 +103,7 @@ dummy_assign_slots(struct nv50_ir_prog_info *info)
>
> static int
> nouveau_codegen(int chipset, int type, struct tgsi_token tokens[],
> - unsigned *size, unsigned **code) {
> + unsigned *size, unsigned **code, bool omitLineNum) {
> struct nv50_ir_prog_info info = {0};
> int ret;
>
> @@ -122,6 +122,7 @@ 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 = omitLineNum;
>
> ret = nv50_ir_generate_code(&info);
> if (ret) {
> @@ -143,10 +144,13 @@ main(int argc, char *argv[])
> FILE *f;
> char text[65536] = {0};
> unsigned size = 0, *code = NULL;
> + bool omitLineNum = false;
>
> for (i = 1; i < argc; i++) {
> if (!strcmp(argv[i], "-a"))
> chipset = strtol(argv[++i], NULL, 16);
> + if (!strcmp(argv[i], "-o"))
> + omitLineNum = strtol(argv[++i], NULL, 10) ? true : false;
> else
> filename = argv[i];
> }
> @@ -203,7 +207,7 @@ main(int argc, char *argv[])
> }
>
> if (chipset >= 0x50) {
> - i = nouveau_codegen(chipset, type, tokens, &size, &code);
> + i = nouveau_codegen(chipset, type, tokens, &size, &code, omitLineNum);
> } else if (chipset >= 0x30) {
> i = nv30_codegen(chipset, type, tokens, &size, &code);
> } else {
> diff --git a/src/gallium/drivers/nouveau/nv50/nv50_program.c b/src/gallium/drivers/nouveau/nv50/nv50_program.c
> index 6e943a3d94..b7b76eb0fc 100644
> --- a/src/gallium/drivers/nouveau/nv50/nv50_program.c
> +++ b/src/gallium/drivers/nouveau/nv50/nv50_program.c
> @@ -370,6 +370,7 @@ nv50_program_translate(struct nv50_program *prog, uint16_t chipset,
> #else
> info->optLevel = 3;
> #endif
> + info->omitLineNum = false;
>
> ret = nv50_ir_generate_code(info);
> if (ret) {
> diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_program.c b/src/gallium/drivers/nouveau/nvc0/nvc0_program.c
> index c95a96c717..d460620b83 100644
> --- a/src/gallium/drivers/nouveau/nvc0/nvc0_program.c
> +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_program.c
> @@ -578,6 +578,7 @@ nvc0_program_translate(struct nvc0_program *prog, uint16_t chipset,
> #else
> info->optLevel = 3;
> #endif
> + info->omitLineNum = false;
>
> info->bin.smemSize = prog->cp.smem_size;
> info->io.genUserClip = prog->vp.num_ucps;
> --
> 2.15.0
>
> _______________________________________________
> Nouveau mailing list
> Nouveau@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/nouveau
_______________________________________________
Nouveau mailing list
Nouveau@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/nouveau
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v2] nouveau/compiler: Allow to omit line numbers when printing instructions
[not found] ` <CACO55tvX6ozw94n1E1orFaQOUEkL=gJQO4g5aT5fzcxxvOnpqg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2017-11-17 16:21 ` Tobias Klausmann
[not found] ` <20171117162151.24941-1-tobias.johannes.klausmann-AqjdNwhu20eELgA04lAiVw@public.gmane.org>
0 siblings, 1 reply; 6+ messages in thread
From: Tobias Klausmann @ 2017-11-17 16:21 UTC (permalink / raw)
To: nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW
This comes in handy when checking "NV50_PROG_DEBUG=1" outputs with diff!
V2:
- Use environmental variable (Karol Herbst)
Signed-off-by: Tobias Klausmann <tobias.johannes.klausmann@mni.thm.de>
---
src/gallium/drivers/nouveau/codegen/nv50_ir.cpp | 6 +++---
src/gallium/drivers/nouveau/codegen/nv50_ir.h | 2 +-
src/gallium/drivers/nouveau/codegen/nv50_ir_driver.h | 1 +
src/gallium/drivers/nouveau/codegen/nv50_ir_print.cpp | 14 ++++++++++----
src/gallium/drivers/nouveau/codegen/nv50_ir_target.cpp | 2 +-
src/gallium/drivers/nouveau/nouveau_compiler.c | 3 +++
src/gallium/drivers/nouveau/nv50/nv50_program.c | 2 ++
src/gallium/drivers/nouveau/nvc0/nvc0_program.c | 2 ++
8 files changed, 23 insertions(+), 9 deletions(-)
diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir.cpp b/src/gallium/drivers/nouveau/codegen/nv50_ir.cpp
index e9363101bf..4bf6c73837 100644
--- a/src/gallium/drivers/nouveau/codegen/nv50_ir.cpp
+++ b/src/gallium/drivers/nouveau/codegen/nv50_ir.cpp
@@ -1249,7 +1249,7 @@ nv50_ir_generate_code(struct nv50_ir_prog_info *info)
if (ret < 0)
goto out;
if (prog->dbgFlags & NV50_IR_DEBUG_VERBOSE)
- prog->print();
+ prog->print(info->omitLineNum);
targ->parseDriverInfo(info);
prog->getTarget()->runLegalizePass(prog, nv50_ir::CG_STAGE_PRE_SSA);
@@ -1257,13 +1257,13 @@ nv50_ir_generate_code(struct nv50_ir_prog_info *info)
prog->convertToSSA();
if (prog->dbgFlags & NV50_IR_DEBUG_VERBOSE)
- prog->print();
+ prog->print(info->omitLineNum);
prog->optimizeSSA(info->optLevel);
prog->getTarget()->runLegalizePass(prog, nv50_ir::CG_STAGE_SSA);
if (prog->dbgFlags & NV50_IR_DEBUG_BASIC)
- prog->print();
+ prog->print(info->omitLineNum);
if (!prog->registerAllocation()) {
ret = -4;
diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir.h b/src/gallium/drivers/nouveau/codegen/nv50_ir.h
index f2ce16d882..a3c7fd2f94 100644
--- a/src/gallium/drivers/nouveau/codegen/nv50_ir.h
+++ b/src/gallium/drivers/nouveau/codegen/nv50_ir.h
@@ -1249,7 +1249,7 @@ public:
Program(Type type, Target *targ);
~Program();
- void print();
+ void print(bool omitLineNum);
Type getType() const { return progType; }
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..d6fe928af4 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;
}
@@ -775,9 +781,9 @@ Function::print()
}
void
-Program::print()
+Program::print(bool omitLineNum)
{
- PrintPass pass;
+ PrintPass pass(omitLineNum);
init_colours();
pass.run(this, true, false);
}
diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_target.cpp b/src/gallium/drivers/nouveau/codegen/nv50_ir_target.cpp
index 298e7c6ef9..96ad70d28a 100644
--- a/src/gallium/drivers/nouveau/codegen/nv50_ir_target.cpp
+++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_target.cpp
@@ -371,7 +371,7 @@ Program::emitBinary(struct nv50_ir_prog_info *info)
emit->prepareEmission(this);
if (dbgFlags & NV50_IR_DEBUG_BASIC)
- this->print();
+ this->print(info->omitLineNum);
if (!binSize) {
code = NULL;
diff --git a/src/gallium/drivers/nouveau/nouveau_compiler.c b/src/gallium/drivers/nouveau/nouveau_compiler.c
index 3151a6f420..20a4966433 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) {
@@ -143,6 +145,7 @@ main(int argc, char *argv[])
FILE *f;
char text[65536] = {0};
unsigned size = 0, *code = NULL;
+ bool omitLineNum = false;
for (i = 1; i < argc; i++) {
if (!strcmp(argv[i], "-a"))
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
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v2] nouveau/compiler: Allow to omit line numbers when printing instructions
[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>
0 siblings, 1 reply; 6+ messages in thread
From: Pierre Moreau @ 2017-11-20 22:15 UTC (permalink / raw)
To: Tobias Klausmann; +Cc: nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW
[-- Attachment #1.1: Type: text/plain, Size: 7695 bytes --]
The “Program” class keeps a pointer to the “nv50_ir_prog_info” structure, so you could
just use that in the “Program::print()” function, rather than passing the flag as
an argument to “print”.
Pierre
On 2017-11-17 — 17:21, Tobias Klausmann wrote:
> This comes in handy when checking "NV50_PROG_DEBUG=1" outputs with diff!
>
> V2:
> - Use environmental variable (Karol Herbst)
>
> Signed-off-by: Tobias Klausmann <tobias.johannes.klausmann-AqjdNwhu20eELgA04lAiVw@public.gmane.org>
> ---
> src/gallium/drivers/nouveau/codegen/nv50_ir.cpp | 6 +++---
> src/gallium/drivers/nouveau/codegen/nv50_ir.h | 2 +-
> src/gallium/drivers/nouveau/codegen/nv50_ir_driver.h | 1 +
> src/gallium/drivers/nouveau/codegen/nv50_ir_print.cpp | 14 ++++++++++----
> src/gallium/drivers/nouveau/codegen/nv50_ir_target.cpp | 2 +-
> src/gallium/drivers/nouveau/nouveau_compiler.c | 3 +++
> src/gallium/drivers/nouveau/nv50/nv50_program.c | 2 ++
> src/gallium/drivers/nouveau/nvc0/nvc0_program.c | 2 ++
> 8 files changed, 23 insertions(+), 9 deletions(-)
>
> diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir.cpp b/src/gallium/drivers/nouveau/codegen/nv50_ir.cpp
> index e9363101bf..4bf6c73837 100644
> --- a/src/gallium/drivers/nouveau/codegen/nv50_ir.cpp
> +++ b/src/gallium/drivers/nouveau/codegen/nv50_ir.cpp
> @@ -1249,7 +1249,7 @@ nv50_ir_generate_code(struct nv50_ir_prog_info *info)
> if (ret < 0)
> goto out;
> if (prog->dbgFlags & NV50_IR_DEBUG_VERBOSE)
> - prog->print();
> + prog->print(info->omitLineNum);
>
> targ->parseDriverInfo(info);
> prog->getTarget()->runLegalizePass(prog, nv50_ir::CG_STAGE_PRE_SSA);
> @@ -1257,13 +1257,13 @@ nv50_ir_generate_code(struct nv50_ir_prog_info *info)
> prog->convertToSSA();
>
> if (prog->dbgFlags & NV50_IR_DEBUG_VERBOSE)
> - prog->print();
> + prog->print(info->omitLineNum);
>
> prog->optimizeSSA(info->optLevel);
> prog->getTarget()->runLegalizePass(prog, nv50_ir::CG_STAGE_SSA);
>
> if (prog->dbgFlags & NV50_IR_DEBUG_BASIC)
> - prog->print();
> + prog->print(info->omitLineNum);
>
> if (!prog->registerAllocation()) {
> ret = -4;
> diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir.h b/src/gallium/drivers/nouveau/codegen/nv50_ir.h
> index f2ce16d882..a3c7fd2f94 100644
> --- a/src/gallium/drivers/nouveau/codegen/nv50_ir.h
> +++ b/src/gallium/drivers/nouveau/codegen/nv50_ir.h
> @@ -1249,7 +1249,7 @@ public:
> Program(Type type, Target *targ);
> ~Program();
>
> - void print();
> + void print(bool omitLineNum);
>
> Type getType() const { return progType; }
>
> 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..d6fe928af4 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;
> }
> @@ -775,9 +781,9 @@ Function::print()
> }
>
> void
> -Program::print()
> +Program::print(bool omitLineNum)
> {
> - PrintPass pass;
> + PrintPass pass(omitLineNum);
> init_colours();
> pass.run(this, true, false);
> }
> diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_target.cpp b/src/gallium/drivers/nouveau/codegen/nv50_ir_target.cpp
> index 298e7c6ef9..96ad70d28a 100644
> --- a/src/gallium/drivers/nouveau/codegen/nv50_ir_target.cpp
> +++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_target.cpp
> @@ -371,7 +371,7 @@ Program::emitBinary(struct nv50_ir_prog_info *info)
> emit->prepareEmission(this);
>
> if (dbgFlags & NV50_IR_DEBUG_BASIC)
> - this->print();
> + this->print(info->omitLineNum);
>
> if (!binSize) {
> code = NULL;
> diff --git a/src/gallium/drivers/nouveau/nouveau_compiler.c b/src/gallium/drivers/nouveau/nouveau_compiler.c
> index 3151a6f420..20a4966433 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) {
> @@ -143,6 +145,7 @@ main(int argc, char *argv[])
> FILE *f;
> char text[65536] = {0};
> unsigned size = 0, *code = NULL;
> + bool omitLineNum = false;
>
> for (i = 1; i < argc; i++) {
> if (!strcmp(argv[i], "-a"))
> 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-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
> https://lists.freedesktop.org/mailman/listinfo/nouveau
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
[-- Attachment #2: Type: text/plain, Size: 154 bytes --]
_______________________________________________
Nouveau mailing list
Nouveau@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/nouveau
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v3] nouveau/compiler: Allow to omit line numbers when printing instructions
[not found] ` <20171120221501.pz3oprojv3switve-WLoDKDh+7sdAfugRpC6u6w@public.gmane.org>
@ 2017-11-24 15:55 ` Tobias Klausmann
[not found] ` <20171124155529.8990-1-tobias.johannes.klausmann-AqjdNwhu20eELgA04lAiVw@public.gmane.org>
0 siblings, 1 reply; 6+ messages in thread
From: Tobias Klausmann @ 2017-11-24 15:55 UTC (permalink / raw)
To: nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW
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
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v3] nouveau/compiler: Allow to omit line numbers when printing instructions
[not found] ` <20171124155529.8990-1-tobias.johannes.klausmann-AqjdNwhu20eELgA04lAiVw@public.gmane.org>
@ 2017-11-24 16:10 ` Pierre Moreau
0 siblings, 0 replies; 6+ messages in thread
From: Pierre Moreau @ 2017-11-24 16:10 UTC (permalink / raw)
To: Tobias Klausmann; +Cc: nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW
[-- Attachment #1.1: Type: text/plain, Size: 5120 bytes --]
(Comment is a bit further down)
On 2017-11-24 — 16:55, Tobias Klausmann wrote:
> 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-AqjdNwhu20eELgA04lAiVw@public.gmane.org>
> ---
> 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;
You could maybe add a comment that it only affects when printing the program
(in debug mode), but the patch is nonetheless:
Reviewed-by: Pierre Moreau <pierre.morrow-GANU6spQydw@public.gmane.org>
>
> 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-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
> https://lists.freedesktop.org/mailman/listinfo/nouveau
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
[-- Attachment #2: Type: text/plain, Size: 154 bytes --]
_______________________________________________
Nouveau mailing list
Nouveau@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/nouveau
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2017-11-24 16:10 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 ` [PATCH v3] " Tobias Klausmann
[not found] ` <20171124155529.8990-1-tobias.johannes.klausmann-AqjdNwhu20eELgA04lAiVw@public.gmane.org>
2017-11-24 16:10 ` Pierre Moreau
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.