1 #ifndef INLINEASM_H 2 #define INLINEASM_H 3 4 struct gas_operand; 5 6 struct inline_instr { 7 int type; 8 #define INLINSTR_REAL 1 /* real instruction */ 9 #define INLINSTR_ASM 2 /* assembler directive */ 10 #define INLINSTR_LABEL 3 /* label */ 11 char *name; 12 struct gas_operand *operands[3]; 13 int postfix; 14 struct inline_instr *next; 15 }; 16 17 struct inline_asm_io { 18 char *constraints; 19 int index; 20 /* 21 * It may happen that the same vreg is used for both an input and 22 * an output expression, so we need a second ``struct reg *'' to 23 * record the backing register. input becomes vreg->preg, output 24 * becomes outreg 25 */ 26 struct reg *outreg; 27 struct reg *inreg; 28 struct expr *expr; 29 struct vreg *vreg; 30 struct inline_asm_io *next; 31 }; 32 33 struct reg; 34 struct clobbered_reg { 35 struct reg *reg; 36 struct clobbered_reg *next; 37 }; 38 39 struct inline_asm_stmt { 40 /*char *code;*/ 41 struct inline_instr *code; 42 int extended; 43 struct gas_token *toklist; 44 struct inline_asm_io *input; 45 struct inline_asm_io *output; 46 int n_inputs; 47 int n_outputs; 48 struct clobbered_reg *clobbered; 49 }; 50 51 struct token; 52 struct gas_token; 53 54 struct inline_asm_stmt *parse_inline_asm(struct token **); 55 char *parse_asm_varname(struct token **); 56 57 #include <stdio.h> 58 59 void 60 inline_instr_to_nasm(FILE *out, struct inline_instr *); 61 void 62 inline_instr_to_gas(FILE *out, struct inline_instr *); 63 64 #define TO_GAS 1 65 #define TO_NASM 2 66 67 struct gas_token { 68 int type; 69 #define GAS_SEPARATOR 1001 70 #define GAS_DOTIDENT 1002 71 #define GAS_IDENT 1003 72 #define GAS_DOLLAR 1004 73 #define GAS_STRING 1005 74 #define GAS_OCTAL 1020 75 #define GAS_HEXA 1021 76 #define GAS_DECIMAL 1022 77 #define GAS_FORWARD_LABEL 1030 78 #define GAS_BACKWARD_LABEL 1031 79 #define GAS_NUMBER(x) (x == GAS_OCTAL || x == GAS_HEXA || x == GAS_DECIMAL) 80 int lineno; 81 int idata; 82 void *data; 83 void *data2; 84 char *ascii; 85 struct gas_token *next; 86 }; 87 88 89 struct gas_operand { 90 #define ITEM_REG 1 91 #define ITEM_NUMBER 2 92 #define ITEM_VARIABLE 3 93 #define ITEM_OUTPUT 4 94 #define ITEM_INPUT 5 95 #define ITEM_LABEL 6 96 #define ITEM_SUBREG_B 7 97 #define ITEM_SUBREG_H 8 98 #define ITEM_SUBREG_W 9 99 int addr_mode; 100 #define ADDR_ABSOLUTE 1 101 #define ADDR_INDIRECT 2 102 #define ADDR_SCALED 3 103 #define ADDR_DISPLACE 4 104 #define ADDR_SCALED_DISPLACE 5 105 void *items[4]; 106 int item_types[4]; 107 }; 108 109 #endif 110 111