diff mbox

[1/4] Add classname/filename/line metadata to struct pass_data

Message ID 1435268214-8735-2-git-send-email-dmalcolm@redhat.com
State New
Headers show

Commit Message

David Malcolm June 25, 2015, 9:36 p.m. UTC
gcc/ChangeLog:
	* tree-pass.h (struct pass_data): Add fields "classname",
	"filename", "line_num".
	(PASS_DATA_INIT): New macro.
---
 gcc/tree-pass.h | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

Comments

Jeff Law July 6, 2015, 8:53 p.m. UTC | #1
On 06/25/2015 03:36 PM, David Malcolm wrote:
> gcc/ChangeLog:
> 	* tree-pass.h (struct pass_data): Add fields "classname",
> 	"filename", "line_num".
> 	(PASS_DATA_INIT): New macro.
All 4 parts of this patchkit are OK.

jeff
diff mbox

Patch

diff --git a/gcc/tree-pass.h b/gcc/tree-pass.h
index 4545556..6ebae66 100644
--- a/gcc/tree-pass.h
+++ b/gcc/tree-pass.h
@@ -61,8 +61,35 @@  struct pass_data
   /* Flags indicating common sets things to do before and after.  */
   unsigned int todo_flags_start;
   unsigned int todo_flags_finish;
+
+  /* Fields intended to make it easier to locate the implementation of
+     specific passes within gcc's sources.  */
+
+  /* Name of the opt_pass subclass.  */
+  const char *classname;
+
+  /* Source location of this pass_data instance.  */
+  const char *filename;
+  int line_num;
 };
 
+/* A macro for initializing instances of struct pass_data,
+   supplying __FILE__ and __LINE__.  */
+
+#define PASS_DATA_INIT(TYPE, NAME, OPTINFO_FLAGS, TV_ID,    \
+		       PROPERTIES_REQUIRED,		    \
+		       PROPERTIES_PROVIDED,		    \
+		       PROPERTIES_DESTROYED,		    \
+		       TODO_FLAGS_START, TODO_FLAGS_FINISH, \
+		       CLASSNAME)			    \
+  { (TYPE), (NAME), (OPTINFO_FLAGS), (TV_ID),		    \
+    (PROPERTIES_REQUIRED),				    \
+    (PROPERTIES_PROVIDED),				    \
+    (PROPERTIES_DESTROYED),				    \
+    (TODO_FLAGS_START), (TODO_FLAGS_FINISH),		    \
+    (CLASSNAME),					    \
+    (__FILE__), (__LINE__) }
+
 namespace gcc
 {
   class context;