public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* PATCH trunk GCCJIT: adding gcc_jit_context_new_rvalue_from_long_long, etc...
@ 2015-07-15 18:43 Basile Starynkevitch
  2015-07-15 19:04 ` David Malcolm
  0 siblings, 1 reply; 10+ messages in thread
From: Basile Starynkevitch @ 2015-07-15 18:43 UTC (permalink / raw)
  To: gcc-patches; +Cc: David Malcolm

[-- Attachment #1: Type: text/plain, Size: 1169 bytes --]

Hello All and David Malcolm

The attached patch (relative to trunk r224842) is adding 
gcc_jit_context_new_rvalue_from_long_long and similar functions to GCCJIT.

It is bootstrapping, but I don't have any test cases ....

## gcc/jit/ChangeLog entry:

2015-07-15  Basile Starynkevitch  <basile@starynkevitch.net>

     * libgccjit.h (gcc_jit_context_new_rvalue_from_long_long)
     (gcc_jit_context_new_rvalue_from_int32)
     (gcc_jit_context_new_rvalue_from_int64)
     (gcc_jit_context_new_rvalue_from_intptr): New function
     declarations.

     * libgccjit.map: New entries for above functions.

     * libgccjit.c (gcc_jit_context_new_rvalue_from_long_long)
     (gcc_jit_context_new_rvalue_from_int32)
     (gcc_jit_context_new_rvalue_from_int64)
     (gcc_jit_context_new_rvalue_from_intptr): New functions.

###

Comments are welcome. Ok for trunk?

see https://gcc.gnu.org/ml/jit/2015-q3/msg00085.html

Regards.

-- 
Basile STARYNKEVITCH         http://starynkevitch.net/Basile/
email: basile<at>starynkevitch<dot>net mobile: +33 6 8501 2359
8, rue de la Faiencerie, 92340 Bourg La Reine, France
*** opinions {are only mine, sont seulement les miennes} ***


[-- Attachment #2: jitlonglongpatch-r223842.diff --]
[-- Type: text/x-patch, Size: 3988 bytes --]

Index: gcc/jit/libgccjit.c
===================================================================
--- gcc/jit/libgccjit.c	(revision 225842)
+++ gcc/jit/libgccjit.c	(working copy)
@@ -1154,6 +1154,70 @@ gcc_jit_context_new_rvalue_from_long (gcc_jit_cont
 	  ->new_rvalue_from_const <long> (numeric_type, value));
 }
 
+/* Public entrypoint.  See description in libgccjit.h.  */
+
+gcc_jit_rvalue *
+gcc_jit_context_new_rvalue_from_long_long (gcc_jit_context *ctxt,
+				     gcc_jit_type *numeric_type,
+				     long long value)
+{
+  RETURN_NULL_IF_FAIL (ctxt, NULL, NULL, "NULL context");
+  JIT_LOG_FUNC (ctxt->get_logger ());
+  RETURN_NULL_IF_FAIL_NONNULL_NUMERIC_TYPE (ctxt, numeric_type);
+
+  return ((gcc_jit_rvalue *)ctxt
+	  ->new_rvalue_from_const <long long> (numeric_type, value));
+}
+
+
+/* Public entrypoint.  See description in libgccjit.h.  */
+
+gcc_jit_rvalue *
+gcc_jit_context_new_rvalue_from_int32 (gcc_jit_context *ctxt,
+				     gcc_jit_type *numeric_type,
+				     int32_t value)
+{
+  RETURN_NULL_IF_FAIL (ctxt, NULL, NULL, "NULL context");
+  JIT_LOG_FUNC (ctxt->get_logger ());
+  RETURN_NULL_IF_FAIL_NONNULL_NUMERIC_TYPE (ctxt, numeric_type);
+
+  return ((gcc_jit_rvalue *)ctxt
+	  ->new_rvalue_from_const <int32_t> (numeric_type, value));
+}
+
+
+/* Public entrypoint.  See description in libgccjit.h.  */
+
+gcc_jit_rvalue *
+gcc_jit_context_new_rvalue_from_int64 (gcc_jit_context *ctxt,
+				     gcc_jit_type *numeric_type,
+				     int64_t value)
+{
+  RETURN_NULL_IF_FAIL (ctxt, NULL, NULL, "NULL context");
+  JIT_LOG_FUNC (ctxt->get_logger ());
+  RETURN_NULL_IF_FAIL_NONNULL_NUMERIC_TYPE (ctxt, numeric_type);
+
+  return ((gcc_jit_rvalue *)ctxt
+	  ->new_rvalue_from_const <int64_t> (numeric_type, value));
+}
+
+
+/* Public entrypoint.  See description in libgccjit.h.  */
+
+gcc_jit_rvalue *
+gcc_jit_context_new_rvalue_from_intptr (gcc_jit_context *ctxt,
+				     gcc_jit_type *numeric_type,
+				     intptr_t value)
+{
+  RETURN_NULL_IF_FAIL (ctxt, NULL, NULL, "NULL context");
+  JIT_LOG_FUNC (ctxt->get_logger ());
+  RETURN_NULL_IF_FAIL_NONNULL_NUMERIC_TYPE (ctxt, numeric_type);
+
+  return ((gcc_jit_rvalue *)ctxt
+	  ->new_rvalue_from_const <intptr_t> (numeric_type, value));
+}
+
+
 /* Public entrypoint.  See description in libgccjit.h.
 
    This is essentially equivalent to:
Index: gcc/jit/libgccjit.h
===================================================================
--- gcc/jit/libgccjit.h	(revision 225842)
+++ gcc/jit/libgccjit.h	(working copy)
@@ -752,6 +752,26 @@ gcc_jit_context_new_rvalue_from_long (gcc_jit_cont
 				      long value);
 
 extern gcc_jit_rvalue *
+gcc_jit_context_new_rvalue_from_long_long (gcc_jit_context *ctxt,
+				      gcc_jit_type *numeric_type,
+				      long long value);
+
+extern gcc_jit_rvalue *
+gcc_jit_context_new_rvalue_from_int32 (gcc_jit_context *ctxt,
+				      gcc_jit_type *numeric_type,
+				      int32_t value);
+
+extern gcc_jit_rvalue *
+gcc_jit_context_new_rvalue_from_int64 (gcc_jit_context *ctxt,
+				      gcc_jit_type *numeric_type,
+				      int64_t value);
+
+extern gcc_jit_rvalue *
+gcc_jit_context_new_rvalue_from_intptr (gcc_jit_context *ctxt,
+				      gcc_jit_type *numeric_type,
+				      intptr_t value);
+
+extern gcc_jit_rvalue *
 gcc_jit_context_zero (gcc_jit_context *ctxt,
 		      gcc_jit_type *numeric_type);
 
Index: gcc/jit/libgccjit.map
===================================================================
--- gcc/jit/libgccjit.map	(revision 225842)
+++ gcc/jit/libgccjit.map	(working copy)
@@ -61,7 +61,10 @@ LIBGCCJIT_ABI_0
     gcc_jit_context_new_param;
     gcc_jit_context_new_rvalue_from_double;
     gcc_jit_context_new_rvalue_from_int;
+    gcc_jit_context_new_rvalue_from_int32;
+    gcc_jit_context_new_rvalue_from_int64;
     gcc_jit_context_new_rvalue_from_long;
+    gcc_jit_context_new_rvalue_from_long_long;	
     gcc_jit_context_new_rvalue_from_ptr;
     gcc_jit_context_new_string_literal;
     gcc_jit_context_new_struct_type;

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2015-07-17 14:07 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-15 18:43 PATCH trunk GCCJIT: adding gcc_jit_context_new_rvalue_from_long_long, etc Basile Starynkevitch
2015-07-15 19:04 ` David Malcolm
2015-07-15 19:37   ` Basile Starynkevitch
2015-07-15 19:37     ` David Malcolm
2015-07-16  9:25       ` PATCH (v2) " Basile Starynkevitch
2015-07-17 13:50         ` David Malcolm
2015-07-17 14:19           ` David Malcolm
2015-07-15 19:56   ` PATCH " Basile Starynkevitch
2015-07-15 21:37     ` David Malcolm
2015-07-16 20:08   ` [PATCH, committed] jit: Add guide for submitting patches to jit docs David Malcolm

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).