This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[hsa] Export dump_hsa_insn


Hi,

this small patch makes dump_hsa_insn available for dumping in other
compilation units.  Committed to the branch.

Thanks,

Martin

2015-10-12  Martin Jambor  <mjambor@suse.cz>

	* hsa-dump.c (dump_hsa_insn): Rename to dump_hsa_insn_1.
	(dump_hsa_insn): New function.
	(dump_hsa_bb): Use dump_hsa_insn_1.
	* hsa.h (dump_hsa_insn): Declare.
---
 gcc/hsa-dump.c | 23 +++++++++++++++++------
 gcc/hsa.h      |  1 +
 2 files changed, 18 insertions(+), 6 deletions(-)

diff --git a/gcc/hsa-dump.c b/gcc/hsa-dump.c
index e074241..ca27bf2 100644
--- a/gcc/hsa-dump.c
+++ b/gcc/hsa-dump.c
@@ -763,10 +763,12 @@ static void indent_stream (FILE *f, int indent)
     fputc (' ', f);
 }
 
-/* Dump textual representation of HSA IL instruction INSN to file F.  */
+/* Dump textual representation of HSA IL instruction INSN to file F.  Prepend
+   the instruction with *INDENT spaces and adjust the indentation for call
+   instructions as appropriate.  */
 
 static void
-dump_hsa_insn (FILE *f, hsa_insn_basic *insn, int *indent)
+dump_hsa_insn_1 (FILE *f, hsa_insn_basic *insn, int *indent)
 {
   gcc_checking_assert (insn);
   indent_stream (f, *indent);
@@ -1011,6 +1013,15 @@ dump_hsa_insn (FILE *f, hsa_insn_basic *insn, int *indent)
   fprintf (f, "\n");
 }
 
+/* Dump textual representation of HSA IL instruction INSN to file F.  */
+
+void
+dump_hsa_insn (FILE *f, hsa_insn_basic *insn)
+{
+  int indent = 0;
+  dump_hsa_insn_1 (f, insn, &indent);
+}
+
 /* Dump textual representation of HSA IL in HBB to file F.  */
 
 void
@@ -1026,10 +1037,10 @@ dump_hsa_bb (FILE *f, hsa_bb *hbb)
 
   int indent = 2;
   for (insn = hbb->first_phi; insn; insn = insn->next)
-    dump_hsa_insn (f, insn, &indent);
+    dump_hsa_insn_1 (f, insn, &indent);
 
   for (insn = hbb->first_insn; insn; insn = insn->next)
-    dump_hsa_insn (f, insn, &indent);
+    dump_hsa_insn_1 (f, insn, &indent);
 
   if (hbb->last_insn && is_a <hsa_insn_sbr *> (hbb->last_insn))
     goto exit;
@@ -1088,8 +1100,7 @@ dump_hsa_cfun (FILE *f)
 DEBUG_FUNCTION void
 debug_hsa_insn (hsa_insn_basic *insn)
 {
-  int indentation = 0;
-  dump_hsa_insn (stderr, insn, &indentation);
+  dump_hsa_insn (stderr, insn);
 }
 
 /* Dump textual representation of HSA IL in HBB to stderr.  */
diff --git a/gcc/hsa.h b/gcc/hsa.h
index 98d70e0..3c49d1b 100644
--- a/gcc/hsa.h
+++ b/gcc/hsa.h
@@ -1094,6 +1094,7 @@ void hsa_brig_emit_omp_symbols (void);
 
 /*  In hsa-dump.c.  */
 const char *hsa_seg_name (BrigSegment8_t);
+void dump_hsa_insn (FILE *f, hsa_insn_basic *insn);
 void dump_hsa_bb (FILE *, hsa_bb *);
 void dump_hsa_cfun (FILE *);
 DEBUG_FUNCTION void debug_hsa_operand (hsa_op_base *opc);
-- 
2.6.0


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]