[jit] Add creating globals to C++ wrapper API

David Malcolm dmalcolm@redhat.com
Wed Jan 1 00:00:00 GMT 2014


Committed to branch dmalcolm/jit:

gcc/jit/
	* libgccjit++.h (gccjit::context::new_global): New.
---
 gcc/jit/ChangeLog.jit |  4 ++++
 gcc/jit/libgccjit++.h | 15 +++++++++++++++
 2 files changed, 19 insertions(+)

diff --git a/gcc/jit/ChangeLog.jit b/gcc/jit/ChangeLog.jit
index 2298e49..ef820ea 100644
--- a/gcc/jit/ChangeLog.jit
+++ b/gcc/jit/ChangeLog.jit
@@ -1,5 +1,9 @@
 2014-03-07  David Malcolm  <dmalcolm@redhat.com>
 
+	* libgccjit++.h (gccjit::context::new_global): New.
+
+2014-03-07  David Malcolm  <dmalcolm@redhat.com>
+
 	* internal-api.c (gcc::jit::playback::context::handle_locations):
 	Add a disabled call to line_table_dump, in case it's handy for
 	debugging in the future.
diff --git a/gcc/jit/libgccjit++.h b/gcc/jit/libgccjit++.h
index da7471b..71bb855 100644
--- a/gcc/jit/libgccjit++.h
+++ b/gcc/jit/libgccjit++.h
@@ -121,6 +121,10 @@ namespace gccjit
 
     function get_builtin_function (const std::string &name);
 
+    lvalue new_global (type type_,
+		       const std::string &name,
+		       location loc = location ());
+
     rvalue new_rvalue (type numeric_type,
 		       int value);
     rvalue zero (type numeric_type);
@@ -640,6 +644,17 @@ context::get_builtin_function (const std::string &name)
 							 name.c_str ()));
 }
 
+inline lvalue
+context::new_global (type type_,
+		     const std::string &name,
+		     location loc)
+{
+  return lvalue (gcc_jit_context_new_global (m_inner_ctxt,
+					     loc.get_inner_location (),
+					     type_.get_inner_type (),
+					     name.c_str ()));
+}
+
 inline rvalue
 context::new_rvalue (type numeric_type,
 		     int value)
-- 
1.7.11.7



More information about the Jit mailing list