Committed to dmalcolm/jit branch:

gcc/jit/
        * internal-api.h (gcc::jit::function::add_stmt): New.

        * internal-api.c (gcc::jit::function::add_eval): Replace use of
        tsi_link_stmt with call to add_stmt.
        (gcc::jit::function::add_assignment): Likewise.
        (gcc::jit::function::add_conditional): Likewise.
        (gcc::jit::function::place_forward_label): Likewise.
        (gcc::jit::function::add_jump): Likewise.
        (gcc::jit::function::add_return): Likewise.
---
 gcc/jit/ChangeLog.jit  | 12 ++++++++++++
 gcc/jit/internal-api.c | 12 ++++++------
 gcc/jit/internal-api.h |  5 +++++
 3 files changed, 23 insertions(+), 6 deletions(-)

diff --git a/gcc/jit/ChangeLog.jit b/gcc/jit/ChangeLog.jit
index c899c9a..2018094 100644
--- a/gcc/jit/ChangeLog.jit
+++ b/gcc/jit/ChangeLog.jit
@@ -1,3 +1,15 @@
+2014-01-23  David Malcolm  <dmalc...@redhat.com>
+
+       * internal-api.h (gcc::jit::function::add_stmt): New.
+
+       * internal-api.c (gcc::jit::function::add_eval): Replace use of
+       tsi_link_stmt with call to add_stmt.
+       (gcc::jit::function::add_assignment): Likewise.
+       (gcc::jit::function::add_conditional): Likewise.
+       (gcc::jit::function::place_forward_label): Likewise.
+       (gcc::jit::function::add_jump): Likewise.
+       (gcc::jit::function::add_return): Likewise.
+
 2014-01-21  David Malcolm  <dmalc...@redhat.com>
 
        * internal-api.c (gcc::jit::function::add_comment): New.
diff --git a/gcc/jit/internal-api.c b/gcc/jit/internal-api.c
index a92c797..f7a2618 100644
--- a/gcc/jit/internal-api.c
+++ b/gcc/jit/internal-api.c
@@ -889,7 +889,7 @@ add_eval (location *loc,
   if (loc)
     set_tree_location (rvalue->as_tree (), loc);
 
-  tsi_link_after (&m_stmt_iter, rvalue->as_tree (), TSI_CONTINUE_LINKING);
+  add_stmt (rvalue->as_tree ());
 }
 
 void
@@ -918,7 +918,7 @@ add_assignment (location *loc,
            t_lvalue, t_rvalue);
   if (loc)
     set_tree_location (stmt, loc);
-  tsi_link_after (&m_stmt_iter, stmt, TSI_CONTINUE_LINKING);
+  add_stmt (stmt);
 }
 
 void
@@ -977,7 +977,7 @@ add_conditional (location *loc,
            true_jump, false_jump);
   if (loc)
     set_tree_location (stmt, loc);
-  tsi_link_after (&m_stmt_iter, stmt, TSI_CONTINUE_LINKING);
+  add_stmt (stmt);
 }
 
 gcc::jit::label *
@@ -1005,7 +1005,7 @@ place_forward_label (location *loc, label *lab)
                             lab->as_label_decl ());
   if (loc)
     set_tree_location (lab->m_label_expr, loc);
-  tsi_link_after (&m_stmt_iter, lab->m_label_expr, TSI_CONTINUE_LINKING);
+  add_stmt (lab->m_label_expr);
 }
 
 void
@@ -1025,7 +1025,7 @@ add_jump (location *loc,
   tree stmt = build1 (GOTO_EXPR, void_type_node, target->as_label_decl ());
   if (loc)
     set_tree_location (stmt, loc);
-  tsi_link_after (&m_stmt_iter, stmt, TSI_CONTINUE_LINKING);
+  add_stmt (stmt);
 
   /*
   from c-typeck.c:
@@ -1069,7 +1069,7 @@ add_return (location *loc,
       set_tree_location (modify_retval, loc);
       set_tree_location (return_stmt, loc);
     }
-  tsi_link_after (&m_stmt_iter, return_stmt, TSI_CONTINUE_LINKING);
+  add_stmt (return_stmt);
 }
 
 gcc::jit::loop *
diff --git a/gcc/jit/internal-api.h b/gcc/jit/internal-api.h
index 1ec2ea1..7a5c92a 100644
--- a/gcc/jit/internal-api.h
+++ b/gcc/jit/internal-api.h
@@ -354,6 +354,11 @@ public:
   context *m_ctxt;
 
 private:
+  void add_stmt (tree stmt)
+  {
+    tsi_link_after (&m_stmt_iter, stmt, TSI_CONTINUE_LINKING);
+  }
+
   void
   set_tree_location (tree t, location *loc)
   {
-- 
1.7.11.7

Reply via email to