instructions.h 1.7 KB

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