Back to index

plt-scheme  4.2.1
core-common.h
Go to the documentation of this file.
00001 /******************************** -*- C -*- ****************************
00002  *
00003  *     Platform-independent layer support
00004  *
00005  ***********************************************************************/
00006 
00007 
00008 /***********************************************************************
00009  *
00010  * Copyright 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
00011  * Written by Paolo Bonzini.
00012  *
00013  * This file is part of GNU lightning.
00014  *
00015  * GNU lightning is free software; you can redistribute it and/or modify it
00016  * under the terms of the GNU Lesser General Public License as published
00017  * by the Free Software Foundation; either version 2.1, or (at your option)
00018  * any later version.
00019  * 
00020  * GNU lightning is distributed in the hope that it will be useful, but 
00021  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
00022  * or  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
00023  * License for more details.
00024  * 
00025  * You should have received a copy of the GNU Lesser General Public License
00026  * along with GNU lightning; see the file COPYING.LESSER; if not, write to the
00027  * Free Software Foundation, 59 Temple Place - Suite 330, Boston,
00028  * MA 02111-1307, USA.
00029  *
00030  ***********************************************************************/
00031 
00032 
00033 #ifndef __lightning_core_common_h
00034 #define __lightning_core_common_h_
00035 
00036 /* jit_code: could be a union of many possible function 
00037    pointer types.  Returned by jit_get_ip().
00038  */
00039 typedef union jit_code {    
00040   char         *ptr;
00041 } jit_code;
00042 
00043 typedef struct {
00044   union {
00045     jit_insn             *pc;
00046     _uc                  *uc_pc;
00047     _us                  *us_pc;
00048     _ui                  *ui_pc;
00049     _ul                  *ul_pc;
00050     jit_code             code;
00051   }                       x;
00052   struct jit_fp              *fp;
00053   struct jit_local_state jitl;
00054 } jit_state;
00055 
00056 #if 0
00057 # ifdef jit_init
00058 static jit_state                   _jit = jit_init ();
00059 # else
00060 static jit_state                   _jit;
00061 # endif
00062 #endif
00063 
00064 #define JIT_NOREG                  (-1)
00065 #define JIT_R0                            JIT_R(0)
00066 #define JIT_R1                            JIT_R(1)
00067 #define JIT_R2                            JIT_R(2)
00068 #define JIT_V0                            JIT_V(0)
00069 #define JIT_V1                            JIT_V(1)
00070 #define JIT_V2                            JIT_V(2)
00071 
00072 #define _jitl                      _jit.jitl
00073 
00074 #define       jit_get_ip()                (_jit.x.code)
00075 #define       jit_set_ip(ptr)                    (_jit.x.pc = (ptr), jit_get_ip ())
00076 #define       jit_get_label()                    (_jit.x.pc)
00077 #define       jit_forward()               (_jit.x.pc)
00078 
00079 #define       jit_field(struc, f)         ( ((long) (&((struc *) 8)->f) ) - 8)
00080 #define       jit_ptr_field(struc_p, f)   ( ((long) (&((struc_p) 8)->f) ) - 8)
00081 
00082 /* realignment via N-byte no-ops */
00083 
00084 #ifndef jit_align
00085 #define jit_align(n)
00086 #endif
00087 
00088 
00089 #ifndef jit_fill_delay_after
00090 #define jit_fill_delay_after(branch)      (branch)
00091 #endif
00092 
00093 #define jit_delay(insn, branch)           ((insn), jit_fill_delay_after(branch))
00094 
00095 
00096 /* ALU synonyms */
00097 #define jit_addi_ui(d, rs, is)            jit_addi_i((d), (rs), (is)) 
00098 #define jit_addr_ui(d, s1, s2)            jit_addr_i((d), (s1), (s2))
00099 #define jit_addci_ui(d, rs, is)           jit_addci_i((d), (rs), (is))       
00100 #define jit_addcr_ui(d, s1, s2)           jit_addcr_i((d), (s1), (s2))
00101 #define jit_addxi_ui(d, rs, is)           jit_addxi_i((d), (rs), (is))       
00102 #define jit_addxr_ui(d, s1, s2)           jit_addxr_i((d), (s1), (s2))
00103 #define jit_andi_ui(d, rs, is)            jit_andi_i((d), (rs), (is)) 
00104 #define jit_andr_ui(d, s1, s2)            jit_andr_i((d), (s1), (s2))
00105 #define jit_lshi_ui(d, rs, is)            jit_lshi_i((d), (rs), (is)) 
00106 #define jit_lshr_ui(d, s1, s2)            jit_lshr_i((d), (s1), (s2))
00107 #define jit_movi_ui(d, rs)         jit_movi_i((d), (rs))
00108 #define jit_movr_ui(d, rs)         jit_movr_i((d), (rs))
00109 #define jit_ori_ui(d, rs, is)             jit_ori_i((d), (rs), (is))  
00110 #define jit_orr_ui(d, s1, s2)             jit_orr_i((d), (s1), (s2))
00111 #define jit_rsbi_ui(d, rs, is)            jit_rsbi_i((d), (rs), (is)) 
00112 #define jit_rsbr_ui(d, s1, s2)            jit_rsbr_i((d), (s1), (s2))
00113 #define jit_subi_ui(d, rs, is)            jit_subi_i((d), (rs), (is)) 
00114 #define jit_subr_ui(d, s1, s2)            jit_subr_i((d), (s1), (s2))
00115 #define jit_subci_ui(d, rs, is)           jit_subci_i((d), (rs), (is))       
00116 #define jit_subcr_ui(d, s1, s2)           jit_subcr_i((d), (s1), (s2))
00117 #define jit_subxi_ui(d, rs, is)           jit_subxi_i((d), (rs), (is))       
00118 #define jit_subxr_ui(d, s1, s2)           jit_subxr_i((d), (s1), (s2))
00119 #define jit_xori_ui(d, rs, is)            jit_xori_i((d), (rs), (is)) 
00120 #define jit_xorr_ui(d, s1, s2)            jit_xorr_i((d), (s1), (s2))
00121 
00122 #define jit_addi_ul(d, rs, is)            jit_addi_l((d), (rs), (is)) 
00123 #define jit_addr_ul(d, s1, s2)            jit_addr_l((d), (s1), (s2))
00124 #define jit_addci_ul(d, rs, is)           jit_addci_l((d), (rs), (is))       
00125 #define jit_addcr_ul(d, s1, s2)           jit_addcr_l((d), (s1), (s2))
00126 #define jit_addxi_ul(d, rs, is)           jit_addxi_l((d), (rs), (is))       
00127 #define jit_addxr_ul(d, s1, s2)           jit_addxr_l((d), (s1), (s2))
00128 #define jit_andi_ul(d, rs, is)            jit_andi_l((d), (rs), (is)) 
00129 #define jit_andr_ul(d, s1, s2)            jit_andr_l((d), (s1), (s2))
00130 #define jit_lshi_ul(d, rs, is)            jit_lshi_l((d), (rs), (is)) 
00131 #define jit_lshr_ul(d, s1, s2)            jit_lshr_l((d), (s1), (s2))
00132 #define jit_movi_ul(d, rs)         jit_movi_l((d), (rs))
00133 #define jit_movr_ul(d, rs)         jit_movr_l((d), (rs))
00134 #define jit_ori_ul(d, rs, is)             jit_ori_l((d), (rs), (is))  
00135 #define jit_orr_ul(d, s1, s2)             jit_orr_l((d), (s1), (s2))
00136 #define jit_rsbi_ul(d, rs, is)            jit_rsbi_l((d), (rs), (is)) 
00137 #define jit_rsbr_ul(d, s1, s2)            jit_rsbr_l((d), (s1), (s2))
00138 #define jit_subi_ul(d, rs, is)            jit_subi_l((d), (rs), (is)) 
00139 #define jit_subr_ul(d, s1, s2)            jit_subr_l((d), (s1), (s2))
00140 #define jit_subci_ul(d, rs, is)           jit_subci_l((d), (rs), (is))       
00141 #define jit_subcr_ul(d, s1, s2)           jit_subcr_l((d), (s1), (s2))
00142 #define jit_subxi_ui(d, rs, is)           jit_subxi_i((d), (rs), (is))       
00143 #define jit_subxi_ul(d, rs, is)           jit_subxi_l((d), (rs), (is))       
00144 #define jit_subxr_ui(d, s1, s2)           jit_subxr_i((d), (s1), (s2))
00145 #define jit_subxr_ul(d, s1, s2)           jit_subxr_i((d), (s1), (s2))
00146 #define jit_xori_ul(d, rs, is)            jit_xori_l((d), (rs), (is)) 
00147 #define jit_xorr_ul(d, s1, s2)            jit_xorr_l((d), (s1), (s2))
00148 
00149 #define jit_addr_p(d, s1, s2)             jit_addr_ul((d), (s1),            (s2))
00150 #define jit_addi_p(d, rs, is)             jit_addi_ul((d), (rs), (long) (is))
00151 #define jit_movr_p(d, rs)          jit_movr_ul((d),              (rs))
00152 #define jit_subr_p(d, s1, s2)             jit_subr_ul((d), (s1),        (s2))
00153 #define jit_subi_p(d, rs, is)             jit_subi_ul((d), (rs), (long) (is))
00154 #define jit_rsbi_p(d, rs, is)             jit_rsbi_ul((d), (rs), (long) (is))
00155 
00156 #ifndef jit_movi_p
00157 #define jit_movi_p(d, is)          (jit_movi_ul((d),       (long) (is)), _jit.x.pc)
00158 #endif
00159 
00160 #define jit_patch(pv)                     jit_patch_at ((pv), (_jit.x.pc))
00161 
00162 #ifndef jit_addci_i
00163 #define jit_addci_i(d, rs, is)            jit_addi_i((d), (rs), (is)) 
00164 #define jit_addcr_i(d, s1, s2)            jit_addr_i((d), (s1), (s2))
00165 #define jit_addci_l(d, rs, is)            jit_addi_l((d), (rs), (is)) 
00166 #define jit_addcr_l(d, s1, s2)            jit_addr_l((d), (s1), (s2))
00167 #endif
00168 
00169 #ifndef jit_subcr_i
00170 #define jit_subcr_i(d, s1, s2)            jit_subr_i((d), (s1), (s2))
00171 #endif
00172 
00173 /* NEG is not mandatory -- pick an appropriate implementation */
00174 #ifndef jit_negr_i
00175 # ifdef JIT_RZERO
00176 #  define jit_negr_i(d, rs)        jit_subr_i((d), JIT_RZERO, (rs))
00177 #  define jit_negr_l(d, rs)        jit_subr_l((d), JIT_RZERO, (rs))
00178 # else /* !JIT_RZERO */
00179 #  ifndef jit_rsbi_i
00180 #   define jit_negr_i(d, rs)              (jit_xori_i((d), (rs), -1), jit_addi_l((d), (d), 1))
00181 #   define jit_negr_l(d, rs)              (jit_xori_l((d), (rs), -1), jit_addi_l((d), (d), 1))
00182 #  else /* jit_rsbi_i */
00183 #   define jit_negr_i(d, rs)              jit_rsbi_i((d), (rs), 0)
00184 #   define jit_negr_l(d, rs)              jit_rsbi_l((d), (rs), 0)
00185 #  endif /* jit_rsbi_i */
00186 # endif /* !JIT_RZERO */
00187 #endif /* !jit_negr_i */
00188 
00189 /* RSB is not mandatory */
00190 #ifndef jit_rsbi_i
00191 # define jit_rsbi_i(d, rs, is)            (jit_subi_i((d), (rs), (is)), jit_negr_i((d), (d)))
00192 
00193 # ifndef jit_rsbi_l
00194 #  define jit_rsbi_l(d, rs, is)           (jit_subi_l((d), (rs), (is)), jit_negr_l((d), (d)))
00195 # endif
00196 #endif
00197 
00198 /* Common 'shortcut' implementations */
00199 #define jit_subi_i(d, rs, is)             jit_addi_i((d), (rs), -(is))
00200 #define jit_subi_l(d, rs, is)             jit_addi_l((d), (rs), -(is))
00201 #define jit_subci_i(d, rs, is)            jit_addci_i((d), (rs), -(is))
00202 #define jit_subci_l(d, rs, is)            jit_addci_l((d), (rs), -(is))
00203 #define jit_rsbr_f(d, s1, s2)             jit_subr_f((d), (s2), (s1))
00204 #define jit_rsbr_d(d, s1, s2)             jit_subr_d((d), (s2), (s1))
00205 #define jit_rsbr_i(d, s1, s2)             jit_subr_i((d), (s2), (s1))
00206 #define jit_rsbr_l(d, s1, s2)             jit_subr_l((d), (s2), (s1))
00207 #define jit_rsbr_p(d, s1, s2)             jit_subr_p((d), (s2), (s1))
00208 
00209 /* Unary */
00210 #define jit_notr_c(d, rs)          jit_xori_c((d), (rs), 255)
00211 #define jit_notr_uc(d, rs)         jit_xori_c((d), (rs), 255)
00212 #define jit_notr_s(d, rs)          jit_xori_s((d), (rs), 65535)
00213 #define jit_notr_us(d, rs)         jit_xori_s((d), (rs), 65535)
00214 #define jit_notr_i(d, rs)          jit_xori_i((d), (rs), ~0)
00215 #define jit_notr_ui(d, rs)         jit_xori_i((d), (rs), ~0)
00216 #define jit_notr_l(d, rs)          jit_xori_l((d), (rs), ~0L)
00217 #define jit_notr_ul(d, rs)         jit_xori_l((d), (rs), ~0L)
00218 
00219 #ifndef jit_extr_c_ui
00220 #define jit_extr_c_ui(d, rs)              jit_andi_ui((d), (rs), 0xFF)
00221 #endif
00222 #ifndef jit_extr_s_ui
00223 #define jit_extr_s_ui(d, rs)              jit_andi_ui((d), (rs), 0xFFFF)
00224 #endif
00225 #ifndef jit_extr_c_i
00226 #define jit_extr_c_i(d, rs)        (jit_lshi_i((d), (rs), 24), jit_rshi_i((d), (d), 24))
00227 #endif
00228 #ifndef jit_extr_s_i
00229 #define jit_extr_s_i(d, rs)        (jit_lshi_i((d), (rs), 16), jit_rshi_i((d), (d), 16))
00230 #endif
00231 
00232 #ifdef jit_addi_l /* sizeof(long) != sizeof(int) */
00233 #ifndef jit_extr_c_l
00234 #define jit_extr_c_l(d, rs)        (jit_lshi_l((d), (rs), 56), jit_rshi_l((d), (d), 56))
00235 #endif
00236 #ifndef jit_extr_s_l
00237 #define jit_extr_s_l(d, rs)        (jit_lshi_l((d), (rs), 48), jit_rshi_l((d), (d), 48))
00238 #endif
00239 #ifndef jit_extr_i_l
00240 #define jit_extr_i_l(d, rs)        (jit_lshi_l((d), (rs), 32), jit_rshi_l((d), (d), 32))
00241 #endif
00242 #ifndef jit_extr_c_ul
00243 #define jit_extr_c_ul(d, rs)              jit_andi_l((d), (rs), 0xFF)
00244 #endif
00245 #ifndef jit_extr_s_ul
00246 #define jit_extr_s_ul(d, rs)              jit_andi_l((d), (rs), 0xFFFF)
00247 #endif
00248 #ifndef jit_extr_i_ul
00249 #define jit_extr_i_ul(d, rs)              jit_andi_l((d), (rs), 0xFFFFFFFFUL)
00250 #endif
00251 #endif
00252 
00253 #define jit_extr_c_s(d, rs)        jit_extr_c_i((d), (rs))
00254 #define jit_extr_c_us(d, rs)              jit_extr_c_ui((d), (rs))
00255 #define jit_extr_uc_s(d, rs)              jit_extr_uc_i((d), (rs))
00256 #define jit_extr_uc_us(d, rs)             jit_extr_uc_ui((d), (rs))
00257 #define jit_extr_uc_i(d, rs)              jit_extr_c_ui((d), (rs))
00258 #define jit_extr_uc_ui(d, rs)             jit_extr_c_ui((d), (rs))
00259 #define jit_extr_us_i(d, rs)              jit_extr_s_ui((d), (rs))
00260 #define jit_extr_us_ui(d, rs)             jit_extr_s_ui((d), (rs))
00261 #define jit_extr_uc_l(d, rs)              jit_extr_c_ul((d), (rs))
00262 #define jit_extr_uc_ul(d, rs)             jit_extr_c_ul((d), (rs))
00263 #define jit_extr_us_l(d, rs)              jit_extr_s_ul((d), (rs))
00264 #define jit_extr_us_ul(d, rs)             jit_extr_s_ul((d), (rs))
00265 #define jit_extr_ui_l(d, rs)              jit_extr_i_ul((d), (rs))
00266 #define jit_extr_ui_ul(d, rs)             jit_extr_i_ul((d), (rs))
00267 
00268 
00269 /* NTOH/HTON is not mandatory for big endian architectures */
00270 #ifndef jit_ntoh_ui /* big endian */
00271 #define jit_ntoh_ui(d, rs)         ((d) == (rs) ? (void)0 : jit_movr_i((d), (rs)))
00272 #define jit_ntoh_us(d, rs)         ((d) == (rs) ? (void)0 : jit_movr_i((d), (rs)))
00273 #endif /* big endian */
00274 
00275 /* hton is a synonym for ntoh */
00276 #define jit_hton_ui(d, rs)         jit_ntoh_ui((d), (rs))
00277 #define jit_hton_us(d, rs)         jit_ntoh_us((d), (rs))
00278 
00279 /* Stack synonyms */
00280 #define jit_pushr_ui(rs)           jit_pushr_i(rs)
00281 #define jit_popr_ui(rs)                   jit_popr_i(rs)              
00282 #define jit_pushr_ul(rs)           jit_pushr_l(rs)
00283 #define jit_popr_ul(rs)                   jit_popr_l(rs)              
00284 #define jit_pushr_p(rs)                   jit_pushr_ul(rs)
00285 #define jit_popr_p(rs)                    jit_popr_ul(rs)             
00286 
00287 #define jit_prepare(nint)          jit_prepare_i((nint))
00288 #define jit_pusharg_c(rs)          jit_pusharg_i(rs)
00289 #define jit_pusharg_s(rs)          jit_pusharg_i(rs)
00290 #define jit_pusharg_uc(rs)         jit_pusharg_i(rs)
00291 #define jit_pusharg_us(rs)         jit_pusharg_i(rs)
00292 #define jit_pusharg_ui(rs)         jit_pusharg_i(rs)
00293 #define jit_pusharg_ul(rs)         jit_pusharg_l(rs)
00294 #define jit_pusharg_p(rs)          jit_pusharg_ul(rs)
00295 
00296 /* Memory synonyms */
00297 
00298 #ifdef JIT_RZERO
00299 #ifndef jit_ldi_c
00300 #define jit_ldi_c(rd, is)          jit_ldxi_c((rd), JIT_RZERO, (is))         
00301 #define jit_sti_c(id, rs)          jit_stxi_c((id), JIT_RZERO, (rs))         
00302 #define jit_ldi_s(rd, is)          jit_ldxi_s((rd), JIT_RZERO, (is))         
00303 #define jit_sti_s(id, rs)          jit_stxi_s((id), JIT_RZERO, (rs))         
00304 #define jit_ldi_i(rd, is)          jit_ldxi_i((rd), JIT_RZERO, (is))         
00305 #define jit_sti_i(id, rs)          jit_stxi_i((id), JIT_RZERO, (rs))         
00306 #define jit_ldi_l(rd, is)          jit_ldxi_l((rd), JIT_RZERO, (is))         
00307 #define jit_sti_l(id, rs)          jit_stxi_l((id), JIT_RZERO, (rs))         
00308 #define jit_ldi_uc(rd, is)         jit_ldxi_uc((rd), JIT_RZERO, (is))        
00309 #define jit_ldi_us(rd, is)         jit_ldxi_us((rd), JIT_RZERO, (is))        
00310 #define jit_ldi_ui(rd, is)         jit_ldxi_ui((rd), JIT_RZERO, (is))        
00311 #define jit_ldi_ul(rd, is)         jit_ldxi_ul((rd), JIT_RZERO, (is))        
00312 #endif
00313 
00314 #ifndef jit_ldr_c
00315 #define jit_ldr_c(rd, rs)          jit_ldxr_c((rd), JIT_RZERO, (rs))         
00316 #define jit_str_c(rd, rs)          jit_stxr_c(JIT_RZERO, (rd), (rs))         
00317 #define jit_ldr_s(rd, rs)          jit_ldxr_s((rd), JIT_RZERO, (rs))         
00318 #define jit_str_s(rd, rs)          jit_stxr_s(JIT_RZERO, (rd), (rs))         
00319 #define jit_ldr_i(rd, rs)          jit_ldxr_i((rd), JIT_RZERO, (rs))         
00320 #define jit_str_i(rd, rs)          jit_stxr_i(JIT_RZERO, (rd), (rs))         
00321 #define jit_ldr_l(rd, rs)          jit_ldxr_l((rd), JIT_RZERO, (rs))         
00322 #define jit_str_l(rd, rs)          jit_stxr_l(JIT_RZERO, (rd), (rs))         
00323 #define jit_ldr_uc(rd, rs)         jit_ldxr_uc((rd), JIT_RZERO, (rs))        
00324 #define jit_ldr_us(rd, rs)         jit_ldxr_us((rd), JIT_RZERO, (rs))        
00325 #define jit_ldr_ui(rd, rs)         jit_ldxr_ui((rd), JIT_RZERO, (rs))        
00326 #define jit_ldr_ul(rd, rs)         jit_ldxr_ul((rd), JIT_RZERO, (rs))        
00327 #endif
00328 #endif
00329 
00330 #define jit_str_uc(rd, rs)         jit_str_c((rd), (rs))
00331 #define jit_sti_uc(id, rs)         jit_sti_c((id), (rs))
00332 #define jit_stxr_uc(d1, d2, rs)           jit_stxr_c((d1), (d2), (rs))
00333 #define jit_stxi_uc(id, rd, is)           jit_stxi_c((id), (rd), (is))
00334 
00335 #define jit_str_us(rd, rs)         jit_str_s((rd), (rs))
00336 #define jit_sti_us(id, rs)         jit_sti_s((id), (rs))
00337 #define jit_stxr_us(d1, d2, rs)           jit_stxr_s((d1), (d2), (rs))
00338 #define jit_stxi_us(id, rd, is)           jit_stxi_s((id), (rd), (is))
00339 
00340 #define jit_str_ui(rd, rs)         jit_str_i((rd), (rs))
00341 #define jit_sti_ui(id, rs)         jit_sti_i((id), (rs))
00342 #define jit_stxr_ui(d1, d2, rs)           jit_stxr_i((d1), (d2), (rs))
00343 #define jit_stxi_ui(id, rd, is)           jit_stxi_i((id), (rd), (is))
00344 
00345 #define jit_str_ul(rd, rs)         jit_str_l((rd), (rs))
00346 #define jit_sti_ul(id, rs)         jit_sti_l((id), (rs))
00347 #define jit_stxr_ul(d1, d2, rs)           jit_stxr_l((d1), (d2), (rs))
00348 #define jit_stxi_ul(id, rd, is)           jit_stxi_l((id), (rd), (is))
00349 
00350 #define jit_str_p(rd, rs)          jit_str_l((rd), (rs))
00351 #define jit_sti_p(id, rs)          jit_sti_l((id), (rs))
00352 #define jit_stxr_p(d1, d2, rs)            jit_stxr_l((d1), (d2), (rs))
00353 #define jit_stxi_p(id, rd, is)            jit_stxi_l((id), (rd), (is))
00354 
00355 #define jit_ldr_p(rd, rs)          jit_ldr_l((rd), (rs))
00356 #define jit_ldi_p(rd, is)          jit_ldi_l((rd), (is))
00357 #define jit_ldxr_p(rd, s1, s2)            jit_ldxr_l((rd), (s1), (s2))
00358 #define jit_ldxi_p(rd, rs, is)            jit_ldxi_l((rd), (rs), (is))
00359 
00360 
00361 /* Boolean & branch synonyms */
00362 #define jit_eqr_ui(d, s1, s2)             jit_eqr_i((d), (s1), (s2))
00363 #define jit_eqi_ui(d, rs, is)             jit_eqi_i((d), (rs), (is))
00364 #define jit_ner_ui(d, s1, s2)             jit_ner_i((d), (s1), (s2))
00365 #define jit_nei_ui(d, rs, is)             jit_nei_i((d), (rs), (is))
00366 
00367 #define jit_eqr_ul(d, s1, s2)             jit_eqr_l((d), (s1), (s2))
00368 #define jit_eqi_ul(d, rs, is)             jit_eqi_l((d), (rs), (is))
00369 #define jit_ner_ul(d, s1, s2)             jit_ner_l((d), (s1), (s2))
00370 #define jit_nei_ul(d, rs, is)             jit_nei_l((d), (rs), (is))
00371 
00372 #define jit_beqr_ui(label, s1, s2) jit_beqr_i((label), (s1), (s2))
00373 #define jit_beqi_ui(label, rs, is) jit_beqi_i((label), (rs), (is))
00374 #define jit_bner_ui(label, s1, s2) jit_bner_i((label), (s1), (s2))
00375 #define jit_bnei_ui(label, rs, is) jit_bnei_i((label), (rs), (is))
00376 #define jit_bmcr_ui(label, s1, s2) jit_bmcr_i((label), (s1), (s2))
00377 #define jit_bmci_ui(label, rs, is) jit_bmci_i((label), (rs), (is))
00378 #define jit_bmsr_ui(label, s1, s2) jit_bmsr_i((label), (s1), (s2))
00379 #define jit_bmsi_ui(label, rs, is) jit_bmsi_i((label), (rs), (is))
00380 
00381 #define jit_beqr_ul(label, s1, s2) jit_beqr_l((label), (s1), (s2))
00382 #define jit_beqi_ul(label, rs, is) jit_beqi_l((label), (rs), (is))
00383 #define jit_bner_ul(label, s1, s2) jit_bner_l((label), (s1), (s2))
00384 #define jit_bnei_ul(label, rs, is) jit_bnei_l((label), (rs), (is))
00385 #define jit_bmcr_ul(label, s1, s2) jit_bmcr_l((label), (s1), (s2))
00386 #define jit_bmci_ul(label, rs, is) jit_bmci_l((label), (rs), (is))
00387 #define jit_bmsr_ul(label, s1, s2) jit_bmsr_l((label), (s1), (s2))
00388 #define jit_bmsi_ul(label, rs, is) jit_bmsi_l((label), (rs), (is))
00389 
00390 #define jit_ltr_p(d, s1, s2)              jit_ltr_ul((d), (s1), (s2))
00391 #define jit_lti_p(d, rs, is)              jit_lti_ul((d), (rs), (is))
00392 #define jit_ler_p(d, s1, s2)              jit_ler_ul((d), (s1), (s2))
00393 #define jit_lei_p(d, rs, is)              jit_lei_ul((d), (rs), (is))
00394 #define jit_gtr_p(d, s1, s2)              jit_gtr_ul((d), (s1), (s2))
00395 #define jit_gti_p(d, rs, is)              jit_gti_ul((d), (rs), (is))
00396 #define jit_ger_p(d, s1, s2)              jit_ger_ul((d), (s1), (s2))
00397 #define jit_gei_p(d, rs, is)              jit_gei_ul((d), (rs), (is))
00398 #define jit_eqr_p(d, s1, s2)              jit_eqr_ul((d), (s1), (s2))
00399 #define jit_eqi_p(d, rs, is)              jit_eqi_ul((d), (rs), (is))
00400 #define jit_ner_p(d, s1, s2)              jit_ner_ul((d), (s1), (s2))
00401 #define jit_nei_p(d, rs, is)              jit_nei_ul((d), (rs), (is))
00402 
00403 #define jit_bltr_p(label, s1, s2)  jit_bltr_ul((label), (s1), (s2))
00404 #define jit_blti_p(label, rs, is)  jit_blti_ul((label), (rs), (is))
00405 #define jit_bler_p(label, s1, s2)  jit_bler_ul((label), (s1), (s2))
00406 #define jit_blei_p(label, rs, is)  jit_blei_ul((label), (rs), (is))
00407 #define jit_bgtr_p(label, s1, s2)  jit_bgtr_ul((label), (s1), (s2))
00408 #define jit_bgti_p(label, rs, is)  jit_bgti_ul((label), (rs), (is))
00409 #define jit_bger_p(label, s1, s2)  jit_bger_ul((label), (s1), (s2))
00410 #define jit_bgei_p(label, rs, is)  jit_bgei_ul((label), (rs), (is))
00411 #define jit_beqr_p(label, s1, s2)  jit_beqr_ul((label), (s1), (s2))
00412 #define jit_beqi_p(label, rs, is)  jit_beqi_ul((label), (rs), (is))
00413 #define jit_bner_p(label, s1, s2)  jit_bner_ul((label), (s1), (s2))
00414 #define jit_bnei_p(label, rs, is)  jit_bnei_ul((label), (rs), (is))
00415 
00416 #define jit_retval_ui(rd)          jit_retval_i((rd))
00417 #define jit_retval_uc(rd)          jit_retval_i((rd))
00418 #define jit_retval_us(rd)          jit_retval_i((rd))
00419 #define jit_retval_ul(rd)          jit_retval_l((rd))
00420 #define jit_retval_p(rd)           jit_retval_ul((rd))
00421 #define jit_retval_c(rd)           jit_retval_i((rd))
00422 #define jit_retval_s(rd)           jit_retval_i((rd))
00423 
00424 /* This was a bug, but we keep it.  */
00425 #define jit_retval(rd)                    jit_retval_l ((rd))
00426 
00427 #ifndef jit_finish
00428 #define jit_finish(sub)                   jit_calli(sub)
00429 #endif
00430 
00431 #ifndef jit_finishr
00432 #define jit_finishr(reg)           jit_callr(reg)
00433 #endif
00434 
00435 #ifndef jit_prolog
00436 #define jit_prolog(numargs)
00437 #endif
00438 
00439 #ifndef jit_leaf
00440 #define jit_leaf(numargs)          jit_prolog(numargs)
00441 #endif
00442 
00443 #ifndef jit_getarg_c
00444 #if !defined(JIT_FP) || defined(JIT_X86_64)
00445 #define jit_getarg_c(reg, ofs)            jit_extr_c_i  ((reg), jit_arg_reg(ofs))
00446 #define jit_getarg_i(reg, ofs)            jit_movr_i    ((reg), jit_arg_reg(ofs))
00447 #define jit_getarg_l(reg, ofs)            jit_movr_l    ((reg), jit_arg_reg(ofs))
00448 #define jit_getarg_p(reg, ofs)            jit_movr_p    ((reg), jit_arg_reg(ofs))
00449 #define jit_getarg_s(reg, ofs)            jit_extr_s_i  ((reg), jit_arg_reg(ofs))
00450 #define jit_getarg_uc(reg, ofs)           jit_extr_uc_ui((reg), jit_arg_reg(ofs))
00451 #define jit_getarg_ui(reg, ofs)           jit_movr_ui   ((reg), jit_arg_reg(ofs))
00452 #define jit_getarg_ul(reg, ofs)           jit_extr_uc_ul((reg), jit_arg_reg(ofs))
00453 #define jit_getarg_us(reg, ofs)           jit_extr_us_ul((reg), jit_arg_reg(ofs))
00454 #else
00455 #define jit_getarg_c(reg, ofs)            jit_ldxi_c((reg), JIT_FP, (ofs));
00456 #define jit_getarg_uc(reg, ofs)           jit_ldxi_uc((reg), JIT_FP, (ofs));
00457 #define jit_getarg_s(reg, ofs)            jit_ldxi_s((reg), JIT_FP, (ofs));
00458 #define jit_getarg_us(reg, ofs)           jit_ldxi_us((reg), JIT_FP, (ofs));
00459 #define jit_getarg_i(reg, ofs)            jit_ldxi_i((reg), JIT_FP, (ofs));
00460 #define jit_getarg_ui(reg, ofs)           jit_ldxi_ui((reg), JIT_FP, (ofs));
00461 #define jit_getarg_l(reg, ofs)            jit_ldxi_l((reg), JIT_FP, (ofs));
00462 #define jit_getarg_ul(reg, ofs)           jit_ldxi_ul((reg), JIT_FP, (ofs));
00463 #define jit_getarg_p(reg, ofs)            jit_ldxi_p((reg), JIT_FP, (ofs));
00464 #endif
00465 #endif
00466 
00467 /* Removed the long == int cases, because they aren't the same
00468    for x86_64, and we want to catch missing ones. */
00469 
00470 #endif /* __lightning_core_common_h_ */