| 1 | /* Copyright (C) 2001, 2009, 2012, 2013 Free Software Foundation, Inc. |
| 2 | * |
| 3 | * This library is free software; you can redistribute it and/or |
| 4 | * modify it under the terms of the GNU Lesser General Public License |
| 5 | * as published by the Free Software Foundation; either version 3 of |
| 6 | * the License, or (at your option) any later version. |
| 7 | * |
| 8 | * This library is distributed in the hope that it will be useful, but |
| 9 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 11 | * Lesser General Public License for more details. |
| 12 | * |
| 13 | * You should have received a copy of the GNU Lesser General Public |
| 14 | * License along with this library; if not, write to the Free Software |
| 15 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
| 16 | * 02110-1301 USA |
| 17 | */ |
| 18 | |
| 19 | #ifndef _SCM_INSTRUCTIONS_H_ |
| 20 | #define _SCM_INSTRUCTIONS_H_ |
| 21 | |
| 22 | #include <libguile.h> |
| 23 | #include <libguile/vm-operations.h> |
| 24 | |
| 25 | #ifdef BUILDING_LIBGUILE |
| 26 | |
| 27 | enum scm_opcode |
| 28 | { |
| 29 | #define ENUM(opcode, tag, name, meta) scm_op_##tag = opcode, |
| 30 | FOR_EACH_VM_OPERATION(ENUM) |
| 31 | #undef ENUM |
| 32 | }; |
| 33 | |
| 34 | #define SCM_PACK_OP_24(op,arg) (scm_op_##op | (arg) << 8) |
| 35 | #define SCM_PACK_OP_8_8_8(op,a,b,c) SCM_PACK_OP_24 (op, (a) | ((b) << 8) | ((c) << 16)) |
| 36 | #define SCM_PACK_OP_8_16(op,a,b) SCM_PACK_OP_24 (op, (a) | (b) << 8) |
| 37 | #define SCM_PACK_OP_16_8(op,a,b) SCM_PACK_OP_24 (op, (a) | (b) << 16) |
| 38 | #define SCM_PACK_OP_12_12(op,a,b) SCM_PACK_OP_24 (op, (a) | (b) << 12) |
| 39 | #define SCM_PACK_OP_ARG_8_24(a,b) ((a) | ((b) << 8)) |
| 40 | |
| 41 | #define SCM_VM_NUM_INSTRUCTIONS (1<<8) |
| 42 | #define SCM_VM_INSTRUCTION_MASK (SCM_VM_NUM_INSTRUCTIONS-1) |
| 43 | |
| 44 | #endif /* BUILDING_LIBGUILE */ |
| 45 | |
| 46 | SCM_INTERNAL SCM scm_instruction_list (void); |
| 47 | |
| 48 | SCM_INTERNAL void scm_bootstrap_instructions (void); |
| 49 | SCM_INTERNAL void scm_init_instructions (void); |
| 50 | |
| 51 | #endif /* _SCM_INSTRUCTIONS_H_ */ |
| 52 | |
| 53 | /* |
| 54 | Local Variables: |
| 55 | c-file-style: "gnu" |
| 56 | End: |
| 57 | */ |