aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAndrea Corallo2020-05-02 20:33:42 +0100
committerAndrea Corallo2020-05-14 21:50:32 +0100
commit392a6f9bab5eb2a872380cfaff3a7ab6f809dac6 (patch)
tree4c86bc2ce5c6b1c4a7711a43d33bbeaaa5e5602b /src
parentacf7e129ea13b4650983135c8c92447b230a0c99 (diff)
downloademacs-392a6f9bab5eb2a872380cfaff3a7ab6f809dac6.tar.gz
emacs-392a6f9bab5eb2a872380cfaff3a7ab6f809dac6.zip
* Split emit_const_lisp_obj logic
* src/comp.c (emit_lisp_obj_reloc_lval): New function. (emit_const_lisp_obj): Rename into 'emit_lisp_obj_rval' and strip logic for 'emit_lisp_obj_reloc_lval'. (emit_NILP, emit_CHECK_CONS, emit_mvar_rval, emit_set_internal) (define_CAR_CDR, define_bool_to_lisp_obj): Update for 'emit_const_lisp_obj' being renamed.
Diffstat (limited to 'src')
-rw-r--r--src/comp.c41
1 files changed, 24 insertions, 17 deletions
diff --git a/src/comp.c b/src/comp.c
index 45d293db859..c88c9f3f481 100644
--- a/src/comp.c
+++ b/src/comp.c
@@ -1099,8 +1099,21 @@ emit_make_fixnum (gcc_jit_rvalue *obj)
1099 : emit_make_fixnum_MSB_TAG (obj); 1099 : emit_make_fixnum_MSB_TAG (obj);
1100} 1100}
1101 1101
1102static gcc_jit_lvalue *
1103emit_lisp_obj_reloc_lval (Lisp_Object obj)
1104{
1105 emit_comment (format_string ("l-value for lisp obj: %s",
1106 SSDATA (Fprin1_to_string (obj, Qnil))));
1107
1108 imm_reloc_t reloc = obj_to_reloc (obj);
1109 return gcc_jit_context_new_array_access (comp.ctxt,
1110 NULL,
1111 reloc.array,
1112 reloc.idx);
1113}
1114
1102static gcc_jit_rvalue * 1115static gcc_jit_rvalue *
1103emit_const_lisp_obj (Lisp_Object obj) 1116emit_lisp_obj_rval (Lisp_Object obj)
1104{ 1117{
1105 emit_comment (format_string ("const lisp obj: %s", 1118 emit_comment (format_string ("const lisp obj: %s",
1106 SSDATA (Fprin1_to_string (obj, Qnil)))); 1119 SSDATA (Fprin1_to_string (obj, Qnil))));
@@ -1119,20 +1132,14 @@ emit_const_lisp_obj (Lisp_Object obj)
1119 return emit_coerce (comp.lisp_obj_type, n); 1132 return emit_coerce (comp.lisp_obj_type, n);
1120 } 1133 }
1121 1134
1122 imm_reloc_t reloc = obj_to_reloc (obj); 1135 return gcc_jit_lvalue_as_rvalue (emit_lisp_obj_reloc_lval (obj));
1123 return
1124 gcc_jit_lvalue_as_rvalue (
1125 gcc_jit_context_new_array_access (comp.ctxt,
1126 NULL,
1127 reloc.array,
1128 reloc.idx));
1129} 1136}
1130 1137
1131static gcc_jit_rvalue * 1138static gcc_jit_rvalue *
1132emit_NILP (gcc_jit_rvalue *x) 1139emit_NILP (gcc_jit_rvalue *x)
1133{ 1140{
1134 emit_comment ("NILP"); 1141 emit_comment ("NILP");
1135 return emit_EQ (x, emit_const_lisp_obj (Qnil)); 1142 return emit_EQ (x, emit_lisp_obj_rval (Qnil));
1136} 1143}
1137 1144
1138static gcc_jit_rvalue * 1145static gcc_jit_rvalue *
@@ -1235,7 +1242,7 @@ emit_CHECK_CONS (gcc_jit_rvalue *x)
1235 1242
1236 gcc_jit_rvalue *args[] = 1243 gcc_jit_rvalue *args[] =
1237 { emit_CONSP (x), 1244 { emit_CONSP (x),
1238 emit_const_lisp_obj (Qconsp), 1245 emit_lisp_obj_rval (Qconsp),
1239 x }; 1246 x };
1240 1247
1241 gcc_jit_block_add_eval ( 1248 gcc_jit_block_add_eval (
@@ -1348,7 +1355,7 @@ emit_mvar_rval (Lisp_Object mvar)
1348 return emit_coerce (comp.lisp_obj_type, word); 1355 return emit_coerce (comp.lisp_obj_type, word);
1349 } 1356 }
1350 /* Other const objects are fetched from the reloc array. */ 1357 /* Other const objects are fetched from the reloc array. */
1351 return emit_const_lisp_obj (constant); 1358 return emit_lisp_obj_rval (constant);
1352 } 1359 }
1353 1360
1354 return gcc_jit_lvalue_as_rvalue (emit_mvar_lval (mvar)); 1361 return gcc_jit_lvalue_as_rvalue (emit_mvar_lval (mvar));
@@ -1383,7 +1390,7 @@ emit_set_internal (Lisp_Object args)
1383 gcc_jit_rvalue *gcc_args[4]; 1390 gcc_jit_rvalue *gcc_args[4];
1384 FOR_EACH_TAIL (args) 1391 FOR_EACH_TAIL (args)
1385 gcc_args[i++] = emit_mvar_rval (XCAR (args)); 1392 gcc_args[i++] = emit_mvar_rval (XCAR (args));
1386 gcc_args[2] = emit_const_lisp_obj (Qnil); 1393 gcc_args[2] = emit_lisp_obj_rval (Qnil);
1387 gcc_args[3] = gcc_jit_context_new_rvalue_from_int (comp.ctxt, 1394 gcc_args[3] = gcc_jit_context_new_rvalue_from_int (comp.ctxt,
1388 comp.int_type, 1395 comp.int_type,
1389 SET_INTERNAL_SET); 1396 SET_INTERNAL_SET);
@@ -2626,11 +2633,11 @@ define_CAR_CDR (void)
2626 comp.block = is_nil_b; 2633 comp.block = is_nil_b;
2627 gcc_jit_block_end_with_return (comp.block, 2634 gcc_jit_block_end_with_return (comp.block,
2628 NULL, 2635 NULL,
2629 emit_const_lisp_obj (Qnil)); 2636 emit_lisp_obj_rval (Qnil));
2630 2637
2631 comp.block = not_nil_b; 2638 comp.block = not_nil_b;
2632 gcc_jit_rvalue *wrong_type_args[] = 2639 gcc_jit_rvalue *wrong_type_args[] =
2633 { emit_const_lisp_obj (Qlistp), c }; 2640 { emit_lisp_obj_rval (Qlistp), c };
2634 2641
2635 gcc_jit_block_add_eval (comp.block, 2642 gcc_jit_block_add_eval (comp.block,
2636 NULL, 2643 NULL,
@@ -2639,7 +2646,7 @@ define_CAR_CDR (void)
2639 false)); 2646 false));
2640 gcc_jit_block_end_with_return (comp.block, 2647 gcc_jit_block_end_with_return (comp.block,
2641 NULL, 2648 NULL,
2642 emit_const_lisp_obj (Qnil)); 2649 emit_lisp_obj_rval (Qnil));
2643 } 2650 }
2644 comp.car = func[0]; 2651 comp.car = func[0];
2645 comp.cdr = func[1]; 2652 comp.cdr = func[1];
@@ -3000,12 +3007,12 @@ define_bool_to_lisp_obj (void)
3000 comp.block = ret_t_block; 3007 comp.block = ret_t_block;
3001 gcc_jit_block_end_with_return (ret_t_block, 3008 gcc_jit_block_end_with_return (ret_t_block,
3002 NULL, 3009 NULL,
3003 emit_const_lisp_obj (Qt)); 3010 emit_lisp_obj_rval (Qt));
3004 3011
3005 comp.block = ret_nil_block; 3012 comp.block = ret_nil_block;
3006 gcc_jit_block_end_with_return (ret_nil_block, 3013 gcc_jit_block_end_with_return (ret_nil_block,
3007 NULL, 3014 NULL,
3008 emit_const_lisp_obj (Qnil)); 3015 emit_lisp_obj_rval (Qnil));
3009} 3016}
3010 3017
3011/* Declare a function being compiled and add it to comp.exported_funcs_h. */ 3018/* Declare a function being compiled and add it to comp.exported_funcs_h. */