diff options
author | David Malcolm <dmalcolm@redhat.com> | 2017-01-18 21:09:32 +0000 |
---|---|---|
committer | David Malcolm <dmalcolm@gcc.gnu.org> | 2017-01-18 21:09:32 +0000 |
commit | b37589b0c4c23db8e9f1d4825998aea18125435a (patch) | |
tree | b55aca824f899dc323377e0aa7e6a4e8df50c5fc /gcc/jit | |
parent | 8b1346a80ab539a680eb7d010a1de5f18c53a9d5 (diff) | |
download | gcc-b37589b0c4c23db8e9f1d4825998aea18125435a.zip gcc-b37589b0c4c23db8e9f1d4825998aea18125435a.tar.gz gcc-b37589b0c4c23db8e9f1d4825998aea18125435a.tar.bz2 |
Implement LANG_HOOKS_TYPE_FOR_SIZE for jit
gcc/jit/ChangeLog:
* dummy-frontend.c (jit_langhook_type_for_size): Implement, using
lto's lto_type_for_size.
From-SVN: r244600
Diffstat (limited to 'gcc/jit')
-rw-r--r-- | gcc/jit/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/jit/dummy-frontend.c | 49 |
2 files changed, 50 insertions, 4 deletions
diff --git a/gcc/jit/ChangeLog b/gcc/jit/ChangeLog index 03b42fd..712382c 100644 --- a/gcc/jit/ChangeLog +++ b/gcc/jit/ChangeLog @@ -1,3 +1,8 @@ +2017-01-18 David Malcolm <dmalcolm@redhat.com> + + * dummy-frontend.c (jit_langhook_type_for_size): Implement, using + lto's lto_type_for_size. + 2017-01-01 Jakub Jelinek <jakub@redhat.com> Update copyright years. diff --git a/gcc/jit/dummy-frontend.c b/gcc/jit/dummy-frontend.c index 1ef4736..4c7932b 100644 --- a/gcc/jit/dummy-frontend.c +++ b/gcc/jit/dummy-frontend.c @@ -207,12 +207,53 @@ jit_langhook_type_for_mode (enum machine_mode mode, int unsignedp) return NULL; } +/* Return an integer type with PRECISION bits of precision, + that is unsigned if UNSIGNEDP is nonzero, otherwise signed. */ + static tree -jit_langhook_type_for_size (unsigned int bits ATTRIBUTE_UNUSED, - int unsignedp ATTRIBUTE_UNUSED) +jit_langhook_type_for_size (unsigned precision, int unsignedp) { - gcc_unreachable (); - return NULL; + int i; + + if (precision == TYPE_PRECISION (integer_type_node)) + return unsignedp ? unsigned_type_node : integer_type_node; + + if (precision == TYPE_PRECISION (signed_char_type_node)) + return unsignedp ? unsigned_char_type_node : signed_char_type_node; + + if (precision == TYPE_PRECISION (short_integer_type_node)) + return unsignedp ? short_unsigned_type_node : short_integer_type_node; + + if (precision == TYPE_PRECISION (long_integer_type_node)) + return unsignedp ? long_unsigned_type_node : long_integer_type_node; + + if (precision == TYPE_PRECISION (long_long_integer_type_node)) + return unsignedp + ? long_long_unsigned_type_node + : long_long_integer_type_node; + + for (i = 0; i < NUM_INT_N_ENTS; i ++) + if (int_n_enabled_p[i] + && precision == int_n_data[i].bitsize) + return (unsignedp ? int_n_trees[i].unsigned_type + : int_n_trees[i].signed_type); + + if (precision <= TYPE_PRECISION (intQI_type_node)) + return unsignedp ? unsigned_intQI_type_node : intQI_type_node; + + if (precision <= TYPE_PRECISION (intHI_type_node)) + return unsignedp ? unsigned_intHI_type_node : intHI_type_node; + + if (precision <= TYPE_PRECISION (intSI_type_node)) + return unsignedp ? unsigned_intSI_type_node : intSI_type_node; + + if (precision <= TYPE_PRECISION (intDI_type_node)) + return unsignedp ? unsigned_intDI_type_node : intDI_type_node; + + if (precision <= TYPE_PRECISION (intTI_type_node)) + return unsignedp ? unsigned_intTI_type_node : intTI_type_node; + + return NULL_TREE; } /* Record a builtin function. We just ignore builtin functions. */ |