X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=deps%2Flightning%2Finclude%2Flightning%2Fjit_private.h;h=d0420b8b044ff58c694d34d4765821dea08aecb5;hb=24d91c0d04f99eed9a89e8d180a067e13ce8a0b2;hp=4925a86433ebd53df80c7faa7b5db5480e8f5792;hpb=ba3814c189d3bd2332b66fb6c633a7d028e618fe;p=pcsx_rearmed.git diff --git a/deps/lightning/include/lightning/jit_private.h b/deps/lightning/include/lightning/jit_private.h index 4925a864..d0420b8b 100644 --- a/deps/lightning/include/lightning/jit_private.h +++ b/deps/lightning/include/lightning/jit_private.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2012-2019 Free Software Foundation, Inc. + * Copyright (C) 2012-2022 Free Software Foundation, Inc. * * This file is part of GNU lightning. * @@ -150,6 +150,13 @@ typedef jit_uint64_t jit_regset_t; # define JIT_RET _A0 # define JIT_FRET _FA0 typedef jit_uint64_t jit_regset_t; +#elif defined(__loongarch__) +# define JIT_RA0 _A0 +# define JIT_FA0 _FA0 +# define JIT_SP _SP +# define JIT_RET _A0 +# define JIT_FRET _FA0 +typedef jit_uint64_t jit_regset_t; #endif #define jit_data(u,v,w) _jit_data(_jit,u,v,w) @@ -365,6 +372,8 @@ typedef struct jit_register jit_register_t; # if DISASSEMBLER typedef struct jit_data_info jit_data_info_t; # endif +#elif __riscv +typedef struct jit_const jit_const_t; #endif union jit_data { @@ -414,6 +423,9 @@ struct jit_block { jit_node_t *label; jit_regset_t reglive; jit_regset_t regmask; + jit_bool_t again; /* Flag need to rebuild regset masks + * due to changes in live and unknown + * state. */ }; struct jit_value { @@ -436,6 +448,12 @@ struct jit_data_info { jit_uword_t code; /* pointer in code buffer */ jit_word_t length; /* length of constant vector */ }; +#elif __riscv && __WORDSIZE == 64 +struct jit_const { + jit_word_t value; + jit_word_t address; + jit_const_t *next; +}; #endif struct jit_function { @@ -492,7 +510,7 @@ struct jit_compiler { jit_int32_t breg; /* base register for prolog/epilog */ #endif #if __mips__ || __ia64__ || __alpha__ || \ - (__sparc__ && __WORDSIZE == 64) || __riscv + (__sparc__ && __WORDSIZE == 64) || __riscv || __loongarch__ jit_int32_t carry; #define jit_carry _jitc->carry #endif @@ -595,6 +613,27 @@ struct jit_compiler { jit_word_t length; } prolog; jit_bool_t jump; +#elif __riscv && __WORDSIZE == 64 + struct { + /* Hash table for constants to be resolved and patched */ + struct { + jit_const_t **table; /* very simple hash table */ + jit_word_t size; /* number of vectors in table */ + jit_word_t count; /* number of distinct entries */ + } hash; + struct { + jit_const_t **ptr; /* keep a single pointer */ + jit_const_t *list; /* free list */ + jit_word_t length; /* length of pool */ + } pool; + /* Linear list for constants that cannot be encoded easily */ + struct { + jit_word_t *instrs; /* list of direct movi instructions */ + jit_word_t *values; /* list of direct movi constants */ + jit_word_t offset; /* offset in instrs/values vector */ + jit_word_t length; /* length of instrs/values vector */ + } vector; + } consts; #endif #if GET_JIT_SIZE /* Temporary storage to calculate instructions length */