%token <intn> INTNUM
%token <flt> FLTNUM
%token <str_val> DIRECTIVE_NAME STRING FILENAME
-%token <int_info> BYTE WORD HWORD DWORD QWORD TWORD DQWORD
+%token <int_info> SIZE_OVERRIDE
%token <int_info> DECLARE_DATA
%token <int_info> RESERVE_SPACE
%token INCBIN EQU TIMES
$$ = $3;
p_arch->module->parse_seg_override(p_arch, $$, $1[0], cur_line);
}
- | BYTE memaddr {
- $$ = $2;
- yasm_ea_set_len($$, 1);
- }
- | HWORD memaddr {
- $$ = $2;
- yasm_ea_set_len($$, p_arch->module->wordsize/2);
- }
- | WORD memaddr {
- $$ = $2;
- yasm_ea_set_len($$, p_arch->module->wordsize);
- }
- | DWORD memaddr {
- $$ = $2;
- yasm_ea_set_len($$, p_arch->module->wordsize*2);
- }
- | QWORD memaddr {
- $$ = $2;
- yasm_ea_set_len($$, p_arch->module->wordsize*4);
- }
+ | SIZE_OVERRIDE memaddr { $$ = $2; yasm_ea_set_len($$, $1); }
| NOSPLIT memaddr { $$ = $2; yasm_ea_set_nosplit($$, 1); }
;
operand: '[' memaddr ']' { $$ = yasm_operand_create_mem($2); }
| expr { $$ = yasm_operand_create_imm($1); }
| SEGREG { $$ = yasm_operand_create_segreg($1[0]); }
- | BYTE operand {
- $$ = $2;
- if ($$->type == YASM_INSN__OPERAND_REG &&
- p_arch->module->get_reg_size(p_arch, $$->data.reg) != 1)
- yasm__error(cur_line, N_("cannot override register size"));
- else
- $$->size = 1;
- }
- | HWORD operand {
- $$ = $2;
- if ($$->type == YASM_INSN__OPERAND_REG &&
- p_arch->module->get_reg_size(p_arch, $$->data.reg) !=
- p_arch->module->wordsize/2)
- yasm__error(cur_line, N_("cannot override register size"));
- else
- $$->size = p_arch->module->wordsize/2;
- }
- | WORD operand {
- $$ = $2;
- if ($$->type == YASM_INSN__OPERAND_REG &&
- p_arch->module->get_reg_size(p_arch, $$->data.reg) !=
- p_arch->module->wordsize)
- yasm__error(cur_line, N_("cannot override register size"));
- else
- $$->size = p_arch->module->wordsize;
- }
- | DWORD operand {
- $$ = $2;
- if ($$->type == YASM_INSN__OPERAND_REG &&
- p_arch->module->get_reg_size(p_arch, $$->data.reg) !=
- p_arch->module->wordsize*2)
- yasm__error(cur_line, N_("cannot override register size"));
- else
- $$->size = p_arch->module->wordsize*2;
- }
- | QWORD operand {
- $$ = $2;
- if ($$->type == YASM_INSN__OPERAND_REG &&
- p_arch->module->get_reg_size(p_arch, $$->data.reg) !=
- p_arch->module->wordsize*4)
- yasm__error(cur_line, N_("cannot override register size"));
- else
- $$->size = p_arch->module->wordsize*4;
- }
- | TWORD operand {
- $$ = $2;
- if ($$->type == YASM_INSN__OPERAND_REG &&
- p_arch->module->get_reg_size(p_arch, $$->data.reg) !=
- p_arch->module->wordsize*5)
- yasm__error(cur_line, N_("cannot override register size"));
- else
- $$->size = p_arch->module->wordsize*5;
- }
- | DQWORD operand {
+ | SIZE_OVERRIDE operand {
$$ = $2;
if ($$->type == YASM_INSN__OPERAND_REG &&
- p_arch->module->get_reg_size(p_arch, $$->data.reg) !=
- p_arch->module->wordsize*8)
+ p_arch->module->get_reg_size(p_arch, $$->data.reg) != $1)
yasm__error(cur_line, N_("cannot override register size"));
else
- $$->size = p_arch->module->wordsize*8;
+ $$->size = $1;
}
| TARGETMOD operand { $$ = $2; $$->targetmod = $1[0]; }
;
}
/* size specifiers */
- B Y T E { lvalp->int_info = 1; RETURN(BYTE); }
- W O R D { lvalp->int_info = 2; RETURN(WORD); }
- D W O R D { lvalp->int_info = 4; RETURN(DWORD); }
- Q W O R D { lvalp->int_info = 8; RETURN(QWORD); }
- T W O R D { lvalp->int_info = 10; RETURN(TWORD); }
- D Q W O R D { lvalp->int_info = 16; RETURN(DQWORD); }
+ B Y T E { lvalp->int_info = 1; RETURN(SIZE_OVERRIDE); }
+ H W O R D {
+ lvalp->int_info = p_arch->module->wordsize/2;
+ RETURN(SIZE_OVERRIDE);
+ }
+ W O R D {
+ lvalp->int_info = p_arch->module->wordsize;
+ RETURN(SIZE_OVERRIDE);
+ }
+ D W O R D {
+ lvalp->int_info = p_arch->module->wordsize*2;
+ RETURN(SIZE_OVERRIDE);
+ }
+ Q W O R D {
+ lvalp->int_info = p_arch->module->wordsize*4;
+ RETURN(SIZE_OVERRIDE);
+ }
+ T W O R D { lvalp->int_info = 10; RETURN(SIZE_OVERRIDE); }
+ D Q W O R D {
+ lvalp->int_info = p_arch->module->wordsize*8;
+ RETURN(SIZE_OVERRIDE);
+ }
/* pseudo-instructions */
D B { lvalp->int_info = 1; RETURN(DECLARE_DATA); }
- D W { lvalp->int_info = 2; RETURN(DECLARE_DATA); }
- D D { lvalp->int_info = 4; RETURN(DECLARE_DATA); }
- D Q { lvalp->int_info = 8; RETURN(DECLARE_DATA); }
+ D H W {
+ lvalp->int_info = p_arch->module->wordsize/2;
+ RETURN(DECLARE_DATA);
+ }
+ D W {
+ lvalp->int_info = p_arch->module->wordsize;
+ RETURN(DECLARE_DATA);
+ }
+ D D {
+ lvalp->int_info = p_arch->module->wordsize*2;
+ RETURN(DECLARE_DATA);
+ }
+ D Q {
+ lvalp->int_info = p_arch->module->wordsize*4;
+ RETURN(DECLARE_DATA);
+ }
D T { lvalp->int_info = 10; RETURN(DECLARE_DATA); }
+ D D Q {
+ lvalp->int_info = p_arch->module->wordsize*8;
+ RETURN(DECLARE_DATA);
+ }
R E S B { lvalp->int_info = 1; RETURN(RESERVE_SPACE); }
- R E S W { lvalp->int_info = 2; RETURN(RESERVE_SPACE); }
- R E S D { lvalp->int_info = 4; RETURN(RESERVE_SPACE); }
- R E S Q { lvalp->int_info = 8; RETURN(RESERVE_SPACE); }
+ R E S H W {
+ lvalp->int_info = p_arch->module->wordsize/2;
+ RETURN(RESERVE_SPACE);
+ }
+ R E S W {
+ lvalp->int_info = p_arch->module->wordsize;
+ RETURN(RESERVE_SPACE);
+ }
+ R E S D {
+ lvalp->int_info = p_arch->module->wordsize*2;
+ RETURN(RESERVE_SPACE);
+ }
+ R E S Q {
+ lvalp->int_info = p_arch->module->wordsize*4;
+ RETURN(RESERVE_SPACE);
+ }
R E S T { lvalp->int_info = 10; RETURN(RESERVE_SPACE); }
+ R E S D Q {
+ lvalp->int_info = p_arch->module->wordsize*8;
+ RETURN(RESERVE_SPACE);
+ }
I N C B I N { RETURN(INCBIN); }