aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAndrea Corallo2020-05-20 21:03:29 +0100
committerAndrea Corallo2020-05-22 21:52:11 +0100
commit38a9ddbc1c656cfaab2c7660f7dab9b0587ecfef (patch)
treed0b95c55dd7bede0d5778d3063312f9203cff27f /src
parent7fa83f9ac96bd201a15f7b0ae4a2cd20a70fd7ef (diff)
downloademacs-38a9ddbc1c656cfaab2c7660f7dab9b0587ecfef.tar.gz
emacs-38a9ddbc1c656cfaab2c7660f7dab9b0587ecfef.zip
* src/comp.c: Some aesthetic code clean-up.
* src/comp.c (comp_t): Remove 'lisp_X_s' field. (emit_coerce): Respect 80 columns limit. (emit_rvalue_from_emacs_uint): GNU style, unnecessary brackets. (emit_rvalue_from_emacs_int): Likewise. (emit_rvalue_from_lisp_word_tag): Likewise. (emit_rvalue_from_lisp_word): Likewise. (emit_lval_XLI): Remove unused function. (emit_lval_XLP): Remove commented out code. (define_add1_sub1): Respect 80 columns limit. (Fcomp__init_ctxt): Reflect 'lisp_X_s' field removal.
Diffstat (limited to 'src')
-rw-r--r--src/comp.c104
1 files changed, 35 insertions, 69 deletions
diff --git a/src/comp.c b/src/comp.c
index acb018bab7b..14862228ab2 100644
--- a/src/comp.c
+++ b/src/comp.c
@@ -117,7 +117,6 @@ typedef struct {
117 gcc_jit_type *ptrdiff_type; 117 gcc_jit_type *ptrdiff_type;
118 gcc_jit_type *uintptr_type; 118 gcc_jit_type *uintptr_type;
119#if LISP_WORDS_ARE_POINTERS 119#if LISP_WORDS_ARE_POINTERS
120 gcc_jit_struct *lisp_X_s;
121 gcc_jit_type *lisp_X; 120 gcc_jit_type *lisp_X;
122#endif 121#endif
123 gcc_jit_type *lisp_word_type; 122 gcc_jit_type *lisp_word_type;
@@ -650,14 +649,15 @@ emit_coerce (gcc_jit_type *new_type, gcc_jit_rvalue *obj)
650 gcc_jit_rvalue *lwordobj = 649 gcc_jit_rvalue *lwordobj =
651 emit_coerce (comp.lisp_word_type, obj); 650 emit_coerce (comp.lisp_word_type, obj);
652 651
653 gcc_jit_lvalue *tmp_s 652 gcc_jit_lvalue *tmp_s =
654 = gcc_jit_function_new_local (comp.func, NULL, comp.lisp_obj_type, 653 gcc_jit_function_new_local (comp.func, NULL, comp.lisp_obj_type,
655 format_string ("lisp_obj_%td", i++)); 654 format_string ("lisp_obj_%td", i++));
656 655
657 gcc_jit_block_add_assignment (comp.block, NULL, 656 gcc_jit_block_add_assignment (
658 gcc_jit_lvalue_access_field (tmp_s, NULL, 657 comp.block, NULL,
659 comp.lisp_obj_i), 658 gcc_jit_lvalue_access_field (tmp_s, NULL,
660 lwordobj); 659 comp.lisp_obj_i),
660 lwordobj);
661 return gcc_jit_lvalue_as_rvalue (tmp_s); 661 return gcc_jit_lvalue_as_rvalue (tmp_s);
662 } 662 }
663#endif 663#endif
@@ -786,44 +786,32 @@ static gcc_jit_rvalue *
786emit_rvalue_from_emacs_uint (EMACS_UINT val) 786emit_rvalue_from_emacs_uint (EMACS_UINT val)
787{ 787{
788 if (val != (long) val) 788 if (val != (long) val)
789 { 789 return emit_rvalue_from_unsigned_long_long (comp.emacs_uint_type, val);
790 return emit_rvalue_from_unsigned_long_long (comp.emacs_uint_type, val);
791 }
792 else 790 else
793 { 791 return gcc_jit_context_new_rvalue_from_long (comp.ctxt,
794 return gcc_jit_context_new_rvalue_from_long (comp.ctxt, 792 comp.emacs_uint_type,
795 comp.emacs_uint_type, 793 val);
796 val);
797 }
798} 794}
799 795
800static gcc_jit_rvalue * 796static gcc_jit_rvalue *
801emit_rvalue_from_emacs_int (EMACS_INT val) 797emit_rvalue_from_emacs_int (EMACS_INT val)
802{ 798{
803 if (val != (long) val) 799 if (val != (long) val)
804 { 800 return emit_rvalue_from_long_long (comp.emacs_int_type, val);
805 return emit_rvalue_from_long_long (comp.emacs_int_type, val);
806 }
807 else 801 else
808 { 802 return gcc_jit_context_new_rvalue_from_long (comp.ctxt,
809 return gcc_jit_context_new_rvalue_from_long (comp.ctxt, 803 comp.emacs_int_type, val);
810 comp.emacs_int_type, val);
811 }
812} 804}
813 805
814static gcc_jit_rvalue * 806static gcc_jit_rvalue *
815emit_rvalue_from_lisp_word_tag (Lisp_Word_tag val) 807emit_rvalue_from_lisp_word_tag (Lisp_Word_tag val)
816{ 808{
817 if (val != (long) val) 809 if (val != (long) val)
818 { 810 return emit_rvalue_from_unsigned_long_long (comp.lisp_word_tag_type, val);
819 return emit_rvalue_from_unsigned_long_long (comp.lisp_word_tag_type, val);
820 }
821 else 811 else
822 { 812 return gcc_jit_context_new_rvalue_from_long (comp.ctxt,
823 return gcc_jit_context_new_rvalue_from_long (comp.ctxt, 813 comp.lisp_word_tag_type,
824 comp.lisp_word_tag_type, 814 val);
825 val);
826 }
827} 815}
828 816
829static gcc_jit_rvalue * 817static gcc_jit_rvalue *
@@ -835,15 +823,11 @@ emit_rvalue_from_lisp_word (Lisp_Word val)
835 val); 823 val);
836#else 824#else
837 if (val != (long) val) 825 if (val != (long) val)
838 { 826 return emit_rvalue_from_unsigned_long_long (comp.lisp_word_type, val);
839 return emit_rvalue_from_unsigned_long_long (comp.lisp_word_type, val);
840 }
841 else 827 else
842 { 828 return gcc_jit_context_new_rvalue_from_long (comp.ctxt,
843 return gcc_jit_context_new_rvalue_from_long (comp.ctxt, 829 comp.lisp_word_type,
844 comp.lisp_word_type, 830 val);
845 val);
846 }
847#endif 831#endif
848} 832}
849 833
@@ -895,14 +879,6 @@ emit_XLI (gcc_jit_rvalue *obj)
895 return emit_coerce (comp.emacs_int_type, obj); 879 return emit_coerce (comp.emacs_int_type, obj);
896} 880}
897 881
898static gcc_jit_lvalue *
899emit_lval_XLI (gcc_jit_lvalue *obj)
900{
901 emit_comment ("lval_XLI");
902 return obj;
903}
904
905
906static gcc_jit_rvalue * 882static gcc_jit_rvalue *
907emit_XLP (gcc_jit_rvalue *obj) 883emit_XLP (gcc_jit_rvalue *obj)
908{ 884{
@@ -911,17 +887,6 @@ emit_XLP (gcc_jit_rvalue *obj)
911 return emit_coerce (comp.void_ptr_type, obj); 887 return emit_coerce (comp.void_ptr_type, obj);
912} 888}
913 889
914/* TODO */
915/* static gcc_jit_lvalue * */
916/* emit_lval_XLP (gcc_jit_lvalue *obj) */
917/* { */
918/* emit_comment ("lval_XLP"); */
919
920/* return gcc_jit_lvalue_access_field (obj, */
921/* NULL, */
922/* comp.lisp_obj_as_ptr); */
923/* } */
924
925static gcc_jit_rvalue * 890static gcc_jit_rvalue *
926emit_XUNTAG (gcc_jit_rvalue *a, gcc_jit_type *type, Lisp_Word_tag lisp_word_tag) 891emit_XUNTAG (gcc_jit_rvalue *a, gcc_jit_type *type, Lisp_Word_tag lisp_word_tag)
927{ 892{
@@ -2912,13 +2877,14 @@ define_add1_sub1 (void)
2912 GCC_JIT_BINARY_OP_LOGICAL_AND, 2877 GCC_JIT_BINARY_OP_LOGICAL_AND,
2913 comp.bool_type, 2878 comp.bool_type,
2914 sure_fixnum, 2879 sure_fixnum,
2915 gcc_jit_context_new_comparison (comp.ctxt, 2880 gcc_jit_context_new_comparison (
2916 NULL, 2881 comp.ctxt,
2917 GCC_JIT_COMPARISON_NE, 2882 NULL,
2918 n_fixnum, 2883 GCC_JIT_COMPARISON_NE,
2919 i == 0 2884 n_fixnum,
2920 ? emit_rvalue_from_emacs_int (MOST_POSITIVE_FIXNUM) 2885 i == 0
2921 : emit_rvalue_from_emacs_int (MOST_NEGATIVE_FIXNUM))), 2886 ? emit_rvalue_from_emacs_int (MOST_POSITIVE_FIXNUM)
2887 : emit_rvalue_from_emacs_int (MOST_NEGATIVE_FIXNUM))),
2922 inline_block, 2888 inline_block,
2923 fcall_block); 2889 fcall_block);
2924 2890
@@ -3408,10 +3374,10 @@ DEFUN ("comp--init-ctxt", Fcomp__init_ctxt, Scomp__init_ctxt,
3408 sizeof (EMACS_UINT), 3374 sizeof (EMACS_UINT),
3409 false); 3375 false);
3410#if LISP_WORDS_ARE_POINTERS 3376#if LISP_WORDS_ARE_POINTERS
3411 comp.lisp_X_s = gcc_jit_context_new_opaque_struct (comp.ctxt, 3377 comp.lisp_X =
3412 NULL, 3378 gcc_jit_struct_as_type (gcc_jit_context_new_opaque_struct (comp.ctxt,
3413 "Lisp_X"); 3379 NULL,
3414 comp.lisp_X = gcc_jit_struct_as_type (comp.lisp_X_s); 3380 "Lisp_X"));
3415 comp.lisp_word_type = gcc_jit_type_get_pointer (comp.lisp_X); 3381 comp.lisp_word_type = gcc_jit_type_get_pointer (comp.lisp_X);
3416#else 3382#else
3417 comp.lisp_word_type = comp.emacs_int_type; 3383 comp.lisp_word_type = comp.emacs_int_type;