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