github.com/goccy/go-jit@v0.0.0-20200514131505-ff78d45cf6af/internal/ccall/jit-interp-opcodes.ops (about)

     1  %{
     2  /*
     3   * jit-interp-opcode.c - Information about interpreter specific JIT opcodes.
     4   *
     5   * Copyright (C) 2004  Southern Storm Software, Pty Ltd.
     6   *
     7   * This file is part of the libjit library.
     8   *
     9   * The libjit library is free software: you can redistribute it and/or
    10   * modify it under the terms of the GNU Lesser General Public License
    11   * as published by the Free Software Foundation, either version 2.1 of
    12   * the License, or (at your option) any later version.
    13   *
    14   * The libjit library is distributed in the hope that it will be useful,
    15   * but WITHOUT ANY WARRANTY; without even the implied warranty of
    16   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    17   * Lesser General Public License for more details.
    18   *
    19   * You should have received a copy of the GNU Lesser General Public
    20   * License along with the libjit library.  If not, see
    21   * <http://www.gnu.org/licenses/>.
    22   */
    23  
    24  #include "jit-internal.h"
    25  #include "jit-interp-opcode.h"
    26  #include "jit-rules.h"
    27  
    28  #if defined(JIT_BACKEND_INTERP)
    29  
    30  %}
    31  
    32  %[
    33  /*
    34   * jit-interp-opcode.h - List of interpreter specific opcodes for
    35   *			 JIT instructions.
    36   *
    37   * Copyright (C) 2004  Southern Storm Software, Pty Ltd.
    38   *
    39   * The libjit library is free software: you can redistribute it and/or
    40   * modify it under the terms of the GNU Lesser General Public License
    41   * as published by the Free Software Foundation, either version 2.1 of
    42   * the License, or (at your option) any later version.
    43   *
    44   * The libjit library is distributed in the hope that it will be useful,
    45   * but WITHOUT ANY WARRANTY; without even the implied warranty of
    46   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    47   * Lesser General Public License for more details.
    48   *
    49   * You should have received a copy of the GNU Lesser General Public
    50   * License along with the libjit library.  If not, see
    51   * <http://www.gnu.org/licenses/>.
    52   */
    53  
    54  #ifndef	_JIT_INTERP_OPCODE_H
    55  #define	_JIT_INTERP_OPCODE_H
    56  
    57  #include <jit/jit-defs.h>
    58  
    59  #ifdef	__cplusplus
    60  extern	"C" {
    61  #endif
    62  
    63  %]
    64  
    65  opcodes(JIT_INTERP_OP_,
    66  	"jit_opcode_info_t const _jit_interp_opcodes[JIT_INTERP_OP_NUM_OPCODES]",
    67  	"JIT_OP_NUM_OPCODES")
    68  {
    69  	/*
    70  	 * Argument variable access opcodes.
    71  	 */
    72  	op_def("lda_0_sbyte") { "JIT_OPCODE_NINT_ARG" }
    73  	op_def("lda_0_ubyte") { "JIT_OPCODE_NINT_ARG" }
    74  	op_def("lda_0_short") { "JIT_OPCODE_NINT_ARG" }
    75  	op_def("lda_0_ushort") { "JIT_OPCODE_NINT_ARG" }
    76  	op_def("lda_0_int") { "JIT_OPCODE_NINT_ARG" }
    77  	op_def("lda_0_long") { "JIT_OPCODE_NINT_ARG" }
    78  	op_def("lda_0_float32") { "JIT_OPCODE_NINT_ARG" }
    79  	op_def("lda_0_float64") { "JIT_OPCODE_NINT_ARG" }
    80  	op_def("lda_0_nfloat") { "JIT_OPCODE_NINT_ARG" }
    81  	op_def("ldaa_0") { "JIT_OPCODE_NINT_ARG" }
    82  	op_def("lda_1_sbyte") { "JIT_OPCODE_NINT_ARG" }
    83  	op_def("lda_1_ubyte") { "JIT_OPCODE_NINT_ARG" }
    84  	op_def("lda_1_short") { "JIT_OPCODE_NINT_ARG" }
    85  	op_def("lda_1_ushort") { "JIT_OPCODE_NINT_ARG" }
    86  	op_def("lda_1_int") { "JIT_OPCODE_NINT_ARG" }
    87  	op_def("lda_1_long") { "JIT_OPCODE_NINT_ARG" }
    88  	op_def("lda_1_float32") { "JIT_OPCODE_NINT_ARG" }
    89  	op_def("lda_1_float64") { "JIT_OPCODE_NINT_ARG" }
    90  	op_def("lda_1_nfloat") { "JIT_OPCODE_NINT_ARG" }
    91  	op_def("ldaa_1") { "JIT_OPCODE_NINT_ARG" }
    92  	op_def("lda_2_sbyte") { "JIT_OPCODE_NINT_ARG" }
    93  	op_def("lda_2_ubyte") { "JIT_OPCODE_NINT_ARG" }
    94  	op_def("lda_2_short") { "JIT_OPCODE_NINT_ARG" }
    95  	op_def("lda_2_ushort") { "JIT_OPCODE_NINT_ARG" }
    96  	op_def("lda_2_int") { "JIT_OPCODE_NINT_ARG" }
    97  	op_def("lda_2_long") { "JIT_OPCODE_NINT_ARG" }
    98  	op_def("lda_2_float32") { "JIT_OPCODE_NINT_ARG" }
    99  	op_def("lda_2_float64") { "JIT_OPCODE_NINT_ARG" }
   100  	op_def("lda_2_nfloat") { "JIT_OPCODE_NINT_ARG" }
   101  	op_def("ldaa_2") { "JIT_OPCODE_NINT_ARG" }
   102  	op_def("sta_0_byte") { "JIT_OPCODE_NINT_ARG" }
   103  	op_def("sta_0_short") { "JIT_OPCODE_NINT_ARG" }
   104  	op_def("sta_0_int") { "JIT_OPCODE_NINT_ARG" }
   105  	op_def("sta_0_long") { "JIT_OPCODE_NINT_ARG" }
   106  	op_def("sta_0_float32") { "JIT_OPCODE_NINT_ARG" }
   107  	op_def("sta_0_float64") { "JIT_OPCODE_NINT_ARG" }
   108  	op_def("sta_0_nfloat") { "JIT_OPCODE_NINT_ARG" }
   109  	/*
   110  	 * Local variable frame access opcodes.
   111  	 */
   112  	op_def("ldl_0_sbyte") { "JIT_OPCODE_NINT_ARG" }
   113  	op_def("ldl_0_ubyte") { "JIT_OPCODE_NINT_ARG" }
   114  	op_def("ldl_0_short") { "JIT_OPCODE_NINT_ARG" }
   115  	op_def("ldl_0_ushort") { "JIT_OPCODE_NINT_ARG" }
   116  	op_def("ldl_0_int") { "JIT_OPCODE_NINT_ARG" }
   117  	op_def("ldl_0_long") { "JIT_OPCODE_NINT_ARG" }
   118  	op_def("ldl_0_float32") { "JIT_OPCODE_NINT_ARG" }
   119  	op_def("ldl_0_float64") { "JIT_OPCODE_NINT_ARG" }
   120  	op_def("ldl_0_nfloat") { "JIT_OPCODE_NINT_ARG" }
   121  	op_def("ldla_0") { "JIT_OPCODE_NINT_ARG" }
   122  	op_def("ldl_1_sbyte") { "JIT_OPCODE_NINT_ARG" }
   123  	op_def("ldl_1_ubyte") { "JIT_OPCODE_NINT_ARG" }
   124  	op_def("ldl_1_short") { "JIT_OPCODE_NINT_ARG" }
   125  	op_def("ldl_1_ushort") { "JIT_OPCODE_NINT_ARG" }
   126  	op_def("ldl_1_int") { "JIT_OPCODE_NINT_ARG" }
   127  	op_def("ldl_1_long") { "JIT_OPCODE_NINT_ARG" }
   128  	op_def("ldl_1_float32") { "JIT_OPCODE_NINT_ARG" }
   129  	op_def("ldl_1_float64") { "JIT_OPCODE_NINT_ARG" }
   130  	op_def("ldl_1_nfloat") { "JIT_OPCODE_NINT_ARG" }
   131  	op_def("ldla_1") { "JIT_OPCODE_NINT_ARG" }
   132  	op_def("ldl_2_sbyte") { "JIT_OPCODE_NINT_ARG" }
   133  	op_def("ldl_2_ubyte") { "JIT_OPCODE_NINT_ARG" }
   134  	op_def("ldl_2_short") { "JIT_OPCODE_NINT_ARG" }
   135  	op_def("ldl_2_ushort") { "JIT_OPCODE_NINT_ARG" }
   136  	op_def("ldl_2_int") { "JIT_OPCODE_NINT_ARG" }
   137  	op_def("ldl_2_long") { "JIT_OPCODE_NINT_ARG" }
   138  	op_def("ldl_2_float32") { "JIT_OPCODE_NINT_ARG" }
   139  	op_def("ldl_2_float64") { "JIT_OPCODE_NINT_ARG" }
   140  	op_def("ldl_2_nfloat") { "JIT_OPCODE_NINT_ARG" }
   141  	op_def("ldla_2") { "JIT_OPCODE_NINT_ARG" }
   142  	op_def("stl_0_byte") { "JIT_OPCODE_NINT_ARG" }
   143  	op_def("stl_0_short") { "JIT_OPCODE_NINT_ARG" }
   144  	op_def("stl_0_int") { "JIT_OPCODE_NINT_ARG" }
   145  	op_def("stl_0_long") { "JIT_OPCODE_NINT_ARG" }
   146  	op_def("stl_0_float32") { "JIT_OPCODE_NINT_ARG" }
   147  	op_def("stl_0_float64") { "JIT_OPCODE_NINT_ARG" }
   148  	op_def("stl_0_nfloat") { "JIT_OPCODE_NINT_ARG" }
   149  	/*
   150  	 * Load constant values.
   151  	 */
   152  	op_def("ldc_0_int") { "JIT_OPCODE_NINT_ARG" }
   153  	op_def("ldc_1_int") { "JIT_OPCODE_NINT_ARG" }
   154  	op_def("ldc_2_int") { "JIT_OPCODE_NINT_ARG" }
   155  	op_def("ldc_0_long") { "JIT_OPCODE_CONST_LONG" }
   156  	op_def("ldc_1_long") { "JIT_OPCODE_CONST_LONG" }
   157  	op_def("ldc_2_long") { "JIT_OPCODE_CONST_LONG" }
   158  	op_def("ldc_0_float32") { "JIT_OPCODE_CONST_FLOAT32" }
   159  	op_def("ldc_1_float32") { "JIT_OPCODE_CONST_FLOAT32" }
   160  	op_def("ldc_2_float32") { "JIT_OPCODE_CONST_FLOAT32" }
   161  	op_def("ldc_0_float64") { "JIT_OPCODE_CONST_FLOAT64" }
   162  	op_def("ldc_1_float64") { "JIT_OPCODE_CONST_FLOAT64" }
   163  	op_def("ldc_2_float64") { "JIT_OPCODE_CONST_FLOAT64" }
   164  	op_def("ldc_0_nfloat") { "JIT_OPCODE_CONST_NFLOAT" }
   165  	op_def("ldc_1_nfloat") { "JIT_OPCODE_CONST_NFLOAT" }
   166  	op_def("ldc_2_nfloat") { "JIT_OPCODE_CONST_NFLOAT" }
   167  	/*
   168  	 * Load return value.
   169  	 */
   170  	op_def("ldr_0_int") { }
   171  	op_def("ldr_0_long") { }
   172  	op_def("ldr_0_float32") { }
   173  	op_def("ldr_0_float64") { }
   174  	op_def("ldr_0_nfloat") { }
   175  	/*
   176  	 * Stack management.
   177  	 */
   178  	op_def("pop") { }
   179  	op_def("pop_2") { }
   180  	op_def("pop_3") { }
   181  	/*
   182  	 * Marker opcode for the end of a function.
   183  	 */
   184  	op_def("end_marker") { }
   185  }
   186  
   187  %[
   188  
   189  /*
   190   * Opcode version.  Should be increased whenever new opcodes
   191   * are added to this list or the public list in "jit-opcode.h".
   192   * This value is written to ELF binaries, to ensure that code
   193   * for one version of libjit is not inadvertantly used in another.
   194   */
   195  #define	JIT_OPCODE_VERSION					0
   196  
   197  /*
   198   * Additional opcode definition flags.
   199   */
   200  #define	JIT_OPCODE_INTERP_ARGS_MASK			0x7E000000
   201  #define	JIT_OPCODE_NINT_ARG					0x02000000
   202  #define	JIT_OPCODE_NINT_ARG_TWO				0x04000000
   203  #define	JIT_OPCODE_CONST_LONG				0x06000000
   204  #define	JIT_OPCODE_CONST_FLOAT32			0x08000000
   205  #define	JIT_OPCODE_CONST_FLOAT64			0x0A000000
   206  #define	JIT_OPCODE_CONST_NFLOAT				0x0C000000
   207  #define	JIT_OPCODE_CALL_INDIRECT_ARGS		0x0E000000
   208  
   209  extern jit_opcode_info_t const _jit_interp_opcodes[JIT_INTERP_OP_NUM_OPCODES];
   210  
   211  #ifdef	__cplusplus
   212  };
   213  #endif
   214  
   215  #endif /* _JIT_INTERP_OPCODE_H */
   216  %]
   217  
   218  %{
   219  #endif /* defined(JIT_BACKEND_INTERP) */
   220  %}