[16/45] analyzer: new builtins
diff mbox series

Message ID 20191213181134.1830-17-dmalcolm@redhat.com
State New
Headers show
Series
  • v4 of analyzer patch kit
Related show

Commit Message

David Malcolm Dec. 13, 2019, 6:11 p.m. UTC
gcc/ChangeLog:
	* builtins.def (BUILT_IN_ANALYZER_BREAK): New builtin.
	(BUILT_IN_ANALYZER_DUMP): New builtin.
	(BUILT_IN_ANALYZER_DUMP_EXPLODED_NODES): New builtin.
	(BUILT_IN_ANALYZER_DUMP_NUM_HEAP_REGIONS): New builtin.
	(BUILT_IN_ANALYZER_DUMP_PATH): New builtin.
	(BUILT_IN_ANALYZER_DUMP_REGION_MODEL): New builtin.
	(BUILT_IN_ANALYZER_EVAL): New builtin.
---
 gcc/builtins.def | 33 +++++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)

Comments

Jakub Jelinek Dec. 13, 2019, 6:27 p.m. UTC | #1
On Fri, Dec 13, 2019 at 01:11:05PM -0500, David Malcolm wrote:
> gcc/ChangeLog:
> 	* builtins.def (BUILT_IN_ANALYZER_BREAK): New builtin.
> 	(BUILT_IN_ANALYZER_DUMP): New builtin.
> 	(BUILT_IN_ANALYZER_DUMP_EXPLODED_NODES): New builtin.
> 	(BUILT_IN_ANALYZER_DUMP_NUM_HEAP_REGIONS): New builtin.
> 	(BUILT_IN_ANALYZER_DUMP_PATH): New builtin.
> 	(BUILT_IN_ANALYZER_DUMP_REGION_MODEL): New builtin.
> 	(BUILT_IN_ANALYZER_EVAL): New builtin.

Is it a good idea to add further builtins without __builtin_
prefix (unless required for interoperability etc.)?

	Jakub
David Malcolm Dec. 13, 2019, 6:31 p.m. UTC | #2
On Fri, 2019-12-13 at 19:27 +0100, Jakub Jelinek wrote:
> On Fri, Dec 13, 2019 at 01:11:05PM -0500, David Malcolm wrote:
> > gcc/ChangeLog:
> > 	* builtins.def (BUILT_IN_ANALYZER_BREAK): New builtin.
> > 	(BUILT_IN_ANALYZER_DUMP): New builtin.
> > 	(BUILT_IN_ANALYZER_DUMP_EXPLODED_NODES): New builtin.
> > 	(BUILT_IN_ANALYZER_DUMP_NUM_HEAP_REGIONS): New builtin.
> > 	(BUILT_IN_ANALYZER_DUMP_PATH): New builtin.
> > 	(BUILT_IN_ANALYZER_DUMP_REGION_MODEL): New builtin.
> > 	(BUILT_IN_ANALYZER_EVAL): New builtin.
> 
> Is it a good idea to add further builtins without __builtin_
> prefix (unless required for interoperability etc.)?

I think I can do all of these with just string matching on the fndecl
names; would that be preferable to having them as builtins?

Dave

Patch
diff mbox series

diff --git a/gcc/builtins.def b/gcc/builtins.def
index d8233f5f760f..f34e95fe4bb0 100644
--- a/gcc/builtins.def
+++ b/gcc/builtins.def
@@ -1107,4 +1107,37 @@  DEF_GCC_BUILTIN (BUILT_IN_LINE, "LINE", BT_FN_INT, ATTR_NOTHROW_LEAF_LIST)
 /* HSAIL/BRIG frontend builtins.  */
 #include "brig-builtins.def"
 
+
+/* Analyzer builtins.  */
+DEF_BUILTIN (BUILT_IN_ANALYZER_BREAK, "__analyzer_break",
+	     BUILT_IN_NORMAL, BT_FN_VOID, BT_LAST,
+	     false, false, false, ATTR_NULL, true, true)
+
+DEF_BUILTIN (BUILT_IN_ANALYZER_DUMP, "__analyzer_dump",
+	     BUILT_IN_NORMAL, BT_FN_VOID, BT_LAST,
+	     false, false, false, ATTR_NULL, true, true)
+
+DEF_BUILTIN (BUILT_IN_ANALYZER_DUMP_EXPLODED_NODES,
+	     "__analyzer_dump_exploded_nodes",
+	     BUILT_IN_NORMAL, BT_FN_VOID_INT, BT_LAST,
+	     false, false, false, ATTR_NULL, true, true)
+
+DEF_BUILTIN (BUILT_IN_ANALYZER_DUMP_NUM_HEAP_REGIONS,
+	     "__analyzer_dump_num_heap_regions",
+	     BUILT_IN_NORMAL, BT_FN_VOID, BT_LAST,
+	     false, false, false, ATTR_NULL, true, true)
+
+DEF_BUILTIN (BUILT_IN_ANALYZER_DUMP_PATH, "__analyzer_dump_path",
+	     BUILT_IN_NORMAL, BT_FN_VOID, BT_LAST,
+	     false, false, false, ATTR_NULL, true, true)
+
+DEF_BUILTIN (BUILT_IN_ANALYZER_DUMP_REGION_MODEL,
+	     "__analyzer_dump_region_model",
+	     BUILT_IN_NORMAL, BT_FN_VOID, BT_LAST,
+	     false, false, false, ATTR_NULL, true, true)
+
+DEF_BUILTIN (BUILT_IN_ANALYZER_EVAL, "__analyzer_eval",
+	     BUILT_IN_NORMAL, BT_FN_VOID_INT, BT_LAST,
+	     false, false, false, ATTR_NULL, true, true)
+
 #undef DEF_BUILTIN