This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
[tuples] creating singleton sequences
- From: Aldy Hernandez <aldyh at redhat dot com>
- To: gcc at gcc dot gnu dot org, dnovillo at google dot com
- Date: Tue, 15 Apr 2008 11:36:32 -0400
- Subject: [tuples] creating singleton sequences
Hey there.
Frequently we want to create a new sequence that contains one element.
This is especially common when wrapping things with a BIND or in a TRY
block.
I'm tired of typing the same thing over and over.
How about a convenience function like this?
Index: gimple.h
===================================================================
--- gimple.h (revision 134265)
+++ gimple.h (working copy)
@@ -189,6 +189,17 @@ gimple_seq_empty_p (const_gimple_seq s)
}
+/* Allocate a new sequence and initialize its first element with STMT.
*/
+
+static inline gimple_seq
+gimple_seq_alloc_with_stmt (gimple stmt)
+{
+ gimple_seq seq = NULL;
+ gimple_seq_add_stmt (&seq, stmt);
+ return seq;
+}