diff options
| author | Andrea Corallo | 2019-06-24 11:32:11 +0200 |
|---|---|---|
| committer | Andrea Corallo | 2020-01-01 11:33:45 +0100 |
| commit | f2dd0cb80fc283293ef64e07d79b06609058e216 (patch) | |
| tree | dc6a070926c2103feeedaddb872c778d0e10f047 /src/comp.c | |
| parent | 4577eeedf620a739a66e69204b40da8cdbbd77e0 (diff) | |
| download | emacs-f2dd0cb80fc283293ef64e07d79b06609058e216.tar.gz emacs-f2dd0cb80fc283293ef64e07d79b06609058e216.zip | |
add char * type support
Diffstat (limited to 'src/comp.c')
| -rw-r--r-- | src/comp.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/comp.c b/src/comp.c index e1a7b25bb26..2bffba08334 100644 --- a/src/comp.c +++ b/src/comp.c | |||
| @@ -185,6 +185,7 @@ typedef struct { | |||
| 185 | gcc_jit_type *long_long_type; | 185 | gcc_jit_type *long_long_type; |
| 186 | gcc_jit_type *emacs_int_type; | 186 | gcc_jit_type *emacs_int_type; |
| 187 | gcc_jit_type *void_ptr_type; | 187 | gcc_jit_type *void_ptr_type; |
| 188 | gcc_jit_type *char_ptr_type; | ||
| 188 | gcc_jit_type *ptrdiff_type; | 189 | gcc_jit_type *ptrdiff_type; |
| 189 | gcc_jit_type *lisp_obj_type; | 190 | gcc_jit_type *lisp_obj_type; |
| 190 | gcc_jit_type *lisp_obj_ptr_type; | 191 | gcc_jit_type *lisp_obj_ptr_type; |
| @@ -215,6 +216,7 @@ typedef struct { | |||
| 215 | gcc_jit_field *cast_union_as_u; | 216 | gcc_jit_field *cast_union_as_u; |
| 216 | gcc_jit_field *cast_union_as_i; | 217 | gcc_jit_field *cast_union_as_i; |
| 217 | gcc_jit_field *cast_union_as_b; | 218 | gcc_jit_field *cast_union_as_b; |
| 219 | gcc_jit_field *cast_union_as_c_p; | ||
| 218 | gcc_jit_function *func; /* Current function being compiled */ | 220 | gcc_jit_function *func; /* Current function being compiled */ |
| 219 | gcc_jit_rvalue *most_positive_fixnum; | 221 | gcc_jit_rvalue *most_positive_fixnum; |
| 220 | gcc_jit_rvalue *most_negative_fixnum; | 222 | gcc_jit_rvalue *most_negative_fixnum; |
| @@ -293,6 +295,8 @@ type_to_cast_field (gcc_jit_type *type) | |||
| 293 | field = comp.cast_union_as_i; | 295 | field = comp.cast_union_as_i; |
| 294 | else if (type == comp.bool_type) | 296 | else if (type == comp.bool_type) |
| 295 | field = comp.cast_union_as_b; | 297 | field = comp.cast_union_as_b; |
| 298 | else if (type == comp.char_ptr_type) | ||
| 299 | field = comp.cast_union_as_c_p; | ||
| 296 | else | 300 | else |
| 297 | error ("unsopported cast\n"); | 301 | error ("unsopported cast\n"); |
| 298 | 302 | ||
| @@ -1234,6 +1238,7 @@ init_comp (int opt_level) | |||
| 1234 | comp.void_ptr_type = | 1238 | comp.void_ptr_type = |
| 1235 | gcc_jit_context_get_type (comp.ctxt, GCC_JIT_TYPE_VOID_PTR); | 1239 | gcc_jit_context_get_type (comp.ctxt, GCC_JIT_TYPE_VOID_PTR); |
| 1236 | comp.char_type = gcc_jit_context_get_type (comp.ctxt, GCC_JIT_TYPE_CHAR); | 1240 | comp.char_type = gcc_jit_context_get_type (comp.ctxt, GCC_JIT_TYPE_CHAR); |
| 1241 | comp.char_ptr_type = gcc_jit_type_get_pointer (comp.char_type); | ||
| 1237 | comp.int_type = gcc_jit_context_get_type (comp.ctxt, GCC_JIT_TYPE_INT); | 1242 | comp.int_type = gcc_jit_context_get_type (comp.ctxt, GCC_JIT_TYPE_INT); |
| 1238 | comp.unsigned_type = gcc_jit_context_get_type (comp.ctxt, | 1243 | comp.unsigned_type = gcc_jit_context_get_type (comp.ctxt, |
| 1239 | GCC_JIT_TYPE_UNSIGNED_INT); | 1244 | GCC_JIT_TYPE_UNSIGNED_INT); |
| @@ -1303,13 +1308,19 @@ init_comp (int opt_level) | |||
| 1303 | NULL, | 1308 | NULL, |
| 1304 | comp.bool_type, | 1309 | comp.bool_type, |
| 1305 | "b"); | 1310 | "b"); |
| 1311 | comp.cast_union_as_c_p = | ||
| 1312 | gcc_jit_context_new_field (comp.ctxt, | ||
| 1313 | NULL, | ||
| 1314 | comp.bool_type, | ||
| 1315 | "c_p"); | ||
| 1306 | 1316 | ||
| 1307 | gcc_jit_field *cast_union_fields[] = | 1317 | gcc_jit_field *cast_union_fields[] = |
| 1308 | { comp.cast_union_as_ll, | 1318 | { comp.cast_union_as_ll, |
| 1309 | comp.cast_union_as_l, | 1319 | comp.cast_union_as_l, |
| 1310 | comp.cast_union_as_u, | 1320 | comp.cast_union_as_u, |
| 1311 | comp.cast_union_as_i, | 1321 | comp.cast_union_as_i, |
| 1312 | comp.cast_union_as_b,}; | 1322 | comp.cast_union_as_b, |
| 1323 | comp.cast_union_as_c_p, }; | ||
| 1313 | comp.cast_union_type = | 1324 | comp.cast_union_type = |
| 1314 | gcc_jit_context_new_union_type (comp.ctxt, | 1325 | gcc_jit_context_new_union_type (comp.ctxt, |
| 1315 | NULL, | 1326 | NULL, |