/* * i386 specific functions for TCC assembler * * Copyright (c) 2001, 2002 Fabrice Bellard * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #define MAX_OPERANDS 3 typedef struct ASMInstr { uint16_t sym; uint16_t opcode; uint16_t instr_type; #define OPC_JMP 0x01 /* jmp operand */ #define OPC_B 0x02 /* only used zith OPC_WL */ #define OPC_WL 0x04 /* accepts w, l or no suffix */ #define OPC_BWL (OPC_B | OPC_WL) /* accepts b, w, l or no suffix */ #define OPC_REG 0x08 /* register is added to opcode */ #define OPC_MODRM 0x10 /* modrm encoding */ #define OPC_FWAIT 0x20 /* add fwait opcode */ #define OPC_TEST 0x40 /* test opcodes */ #define OPC_SHIFT 0x80 /* shift opcodes */ #define OPC_D16 0x0100 /* generate data16 prefix */ #define OPC_ARITH 0x0200 /* arithmetic opcodes */ #define OPC_SHORTJMP 0x0400 /* short jmp operand */ #define OPC_FARITH 0x0800 /* FPU arithmetic opcodes */ #define OPC_GROUP_SHIFT 13 /* in order to compress the operand type, we use specific operands and we or only with EA */ #define OPT_REG8 0 /* warning: value is hardcoded from TOK_ASM_xxx */ #define OPT_REG16 1 /* warning: value is hardcoded from TOK_ASM_xxx */ #define OPT_REG32 2 /* warning: value is hardcoded from TOK_ASM_xxx */ #define OPT_MMX 3 /* warning: value is hardcoded from TOK_ASM_xxx */ #define OPT_SSE 4 /* warning: value is hardcoded from TOK_ASM_xxx */ #define OPT_CR 5 /* warning: value is hardcoded from TOK_ASM_xxx */ #define OPT_TR 6 /* warning: value is hardcoded from TOK_ASM_xxx */ #define OPT_DB 7 /* warning: value is hardcoded from TOK_ASM_xxx */ #define OPT_SEG 8 #define OPT_ST 9 #define OPT_IM8 10 #define OPT_IM8S 11 #define OPT_IM16 12 #define OPT_IM32 13 #define OPT_EAX 14 /* %al, %ax or %eax register */ #define OPT_ST0 15 /* %st(0) register */ #define OPT_CL 16 /* %cl register */ #define OPT_DX 17 /* %dx register */ #define OPT_ADDR 18 /* OP_EA with only offset */ #define OPT_INDIR 19 /* *(expr) */ /* composite types */ #define OPT_COMPOSITE_FIRST 20 #define OPT_IM 20 /* IM8 | IM16 | IM32 */ #define OPT_REG 21 /* REG8 | REG16 | REG32 */ #define OPT_REGW 22 /* REG16 | REG32 */ #define OPT_IMW 23 /* IM16 | IM32 */ /* can be ored with any OPT_xxx */ #define OPT_EA 0x80 uint8_t nb_ops; uint8_t op_type[MAX_OPERANDS]; /* see OP_xxx */ } ASMInstr; typedef struct Operand { uint32_t type; #define OP_REG8 (1 << OPT_REG8) #define OP_REG16 (1 << OPT_REG16) #define OP_REG32 (1 << OPT_REG32) #define OP_MMX (1 << OPT_MMX) #define OP_SSE (1 << OPT_SSE) #define OP_CR (1 << OPT_CR) #define OP_TR (1 << OPT_TR) #define OP_DB (1 << OPT_DB) #define OP_SEG
# module B
type TMyObject* = object
const xyz* = 13
proc q*(x: int): int = 6
proc q*(x: string): string = "8"