public inbox for jit@gcc.gnu.org
 help / color / mirror / Atom feed
From: David Malcolm <dmalcolm@redhat.com>
To: jit@gcc.gnu.org, gcc-patches@gcc.gnu.org
Cc: David Malcolm <dmalcolm@redhat.com>
Subject: [jit] Add gcc_jit_function_get_param
Date: Wed, 01 Jan 2014 00:00:00 -0000	[thread overview]
Message-ID: <1392062961-32448-1-git-send-email-dmalcolm@redhat.com> (raw)

Committed to branch dmalcolm/jit:

gcc/jit/
	* libgccjit.h (gcc_jit_function_get_param): New.
	* libgccjit.map (gcc_jit_function_get_param): New.
	* libgccjit.c (gcc_jit_function_get_param): New.
	* libgccjit++.h (gccjit::function::get_param): New.
---
 gcc/jit/ChangeLog.jit |  7 +++++++
 gcc/jit/libgccjit++.h |  9 +++++++++
 gcc/jit/libgccjit.c   | 17 +++++++++++++++++
 gcc/jit/libgccjit.h   |  3 +++
 gcc/jit/libgccjit.map |  1 +
 5 files changed, 37 insertions(+)

diff --git a/gcc/jit/ChangeLog.jit b/gcc/jit/ChangeLog.jit
index 8b3c947..001cefb 100644
--- a/gcc/jit/ChangeLog.jit
+++ b/gcc/jit/ChangeLog.jit
@@ -1,5 +1,12 @@
 2014-02-10  David Malcolm  <dmalcolm@redhat.com>
 
+	* libgccjit.h (gcc_jit_function_get_param): New.
+	* libgccjit.map (gcc_jit_function_get_param): New.
+	* libgccjit.c (gcc_jit_function_get_param): New.
+	* libgccjit++.h (gccjit::function::get_param): New.
+
+2014-02-10  David Malcolm  <dmalcolm@redhat.com>
+
 	* libgccjit++.h (gccjit::object::get_inner_object): Make const.
 	(gccjit::location::get_inner_location): Likewise.
 	(gccjit::field::get_inner_field): Likewise.
diff --git a/gcc/jit/libgccjit++.h b/gcc/jit/libgccjit++.h
index f3c26ee..74c02ea 100644
--- a/gcc/jit/libgccjit++.h
+++ b/gcc/jit/libgccjit++.h
@@ -259,6 +259,8 @@ namespace gccjit
 
     gcc_jit_function *get_inner_function () const;
 
+    param get_param (int index);
+
     label new_forward_label ();
     label new_forward_label (const std::string &name);
 
@@ -970,6 +972,13 @@ function::get_inner_function () const
   return reinterpret_cast<gcc_jit_function *> (get_inner_object ());
 }
 
+inline param
+function::get_param (int index)
+{
+  return param (gcc_jit_function_get_param (get_inner_function (),
+					    index));
+}
+
 inline label
 function::new_forward_label ()
 {
diff --git a/gcc/jit/libgccjit.c b/gcc/jit/libgccjit.c
index 3f39984..da1afdc 100644
--- a/gcc/jit/libgccjit.c
+++ b/gcc/jit/libgccjit.c
@@ -397,6 +397,23 @@ gcc_jit_function_as_object (gcc_jit_function *func)
   return static_cast <gcc_jit_object *> (func->as_object ());
 }
 
+gcc_jit_param *
+gcc_jit_function_get_param (gcc_jit_function *func, int index)
+{
+  RETURN_NULL_IF_FAIL (func, NULL, "NULL function");
+  gcc::jit::recording::context *ctxt = func->m_ctxt;
+  RETURN_NULL_IF_FAIL (index >= 0, ctxt, "negative index");
+  int num_params = func->get_params ().length ();
+  RETURN_NULL_IF_FAIL_PRINTF3 (index < num_params,
+			       ctxt,
+			       "index of %d is too large (%s has %d params)",
+			       index,
+			       func->get_debug_string (),
+			       num_params);
+
+  return static_cast <gcc_jit_param *> (func->get_param (index));
+}
+
 gcc_jit_label*
 gcc_jit_function_new_forward_label (gcc_jit_function *func,
 				    const char *name)
diff --git a/gcc/jit/libgccjit.h b/gcc/jit/libgccjit.h
index e0161ba..03e9ff8 100644
--- a/gcc/jit/libgccjit.h
+++ b/gcc/jit/libgccjit.h
@@ -435,6 +435,9 @@ gcc_jit_context_new_function (gcc_jit_context *ctxt,
 extern gcc_jit_object *
 gcc_jit_function_as_object (gcc_jit_function *func);
 
+extern gcc_jit_param *
+gcc_jit_function_get_param (gcc_jit_function *func, int index);
+
 /* Create a label, to be placed later.
 
    The name can be NULL, or you can give it a meaningful name, which
diff --git a/gcc/jit/libgccjit.map b/gcc/jit/libgccjit.map
index 6dc700d..45b2a2f 100644
--- a/gcc/jit/libgccjit.map
+++ b/gcc/jit/libgccjit.map
@@ -39,6 +39,7 @@
     gcc_jit_function_add_label;
     gcc_jit_function_add_return;
     gcc_jit_function_as_object;
+    gcc_jit_function_get_param;
     gcc_jit_function_new_forward_label;
     gcc_jit_function_new_local;
     gcc_jit_function_new_loop;
-- 
1.7.11.7

                 reply	other threads:[~2014-02-10 20:10 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1392062961-32448-1-git-send-email-dmalcolm@redhat.com \
    --to=dmalcolm@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jit@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).