diff options
Diffstat (limited to 'x86/gen')
| -rw-r--r-- | x86/gen/ast.hgen | 26 | ||||
| -rw-r--r-- | x86/gen/fold.hgen | 26 | ||||
| -rw-r--r-- | x86/gen/herdtools_ast_to_shallow_ast.hgen | 28 | ||||
| -rw-r--r-- | x86/gen/herdtools_types_to_shallow_types.hgen | 93 | ||||
| -rw-r--r-- | x86/gen/lexer.hgen | 399 | ||||
| -rw-r--r-- | x86/gen/lexer_intel.hgen | 161 | ||||
| -rw-r--r-- | x86/gen/map.hgen | 26 | ||||
| -rw-r--r-- | x86/gen/parser.hgen | 600 | ||||
| -rw-r--r-- | x86/gen/parser_intel.hgen | 601 | ||||
| -rw-r--r-- | x86/gen/pretty.hgen | 50 | ||||
| -rw-r--r-- | x86/gen/sail_trans_out.hgen | 1 | ||||
| -rw-r--r-- | x86/gen/shallow_ast_to_herdtools_ast.hgen | 27 | ||||
| -rw-r--r-- | x86/gen/shallow_types_to_herdtools_types.hgen | 97 | ||||
| -rw-r--r-- | x86/gen/token_types.hgen | 29 | ||||
| -rw-r--r-- | x86/gen/tokens.hgen | 28 | ||||
| -rw-r--r-- | x86/gen/trans_sail.hgen | 28 | ||||
| -rw-r--r-- | x86/gen/types.hgen | 134 | ||||
| -rw-r--r-- | x86/gen/types_sail_trans_out.hgen | 1 | ||||
| -rw-r--r-- | x86/gen/types_trans_sail.hgen | 61 |
19 files changed, 0 insertions, 2416 deletions
diff --git a/x86/gen/ast.hgen b/x86/gen/ast.hgen deleted file mode 100644 index 83488eda..00000000 --- a/x86/gen/ast.hgen +++ /dev/null @@ -1,26 +0,0 @@ -| `X86BINOP of bool * x86Binop * x86Size * x86Dest_src -| `X86BITOP of bool * x86Bitop * x86Size * x86Bit_offset -| `X86CALL of x86Imm_rm -| `X86CLC -| `X86CMC -| `X86CMPXCHG of bool * x86Size * x86Rm * reg -| `X86DIV of x86Size * x86Rm -| `X86JCC of x86Cond * bit64 -| `X86JMP of x86Rm -| `X86LEA of x86Size * x86Dest_src -| `X86LEAVE -| `X86LOOP of x86Cond * bit64 -| `X86MFENCE -| `X86MONOP of bool * x86Monop * x86Size * x86Rm -| `X86MOV of x86Cond * x86Size * x86Dest_src -| `X86MOVSX of x86Size * x86Dest_src * x86Size -| `X86MOVZX of x86Size * x86Dest_src * x86Size -| `X86MUL of x86Size * x86Rm -| `X86NOP -| `X86POP of x86Rm -| `X86PUSH of x86Imm_rm -| `X86RET of bit64 -| `X86SET of x86Cond * bool * x86Rm -| `X86STC -| `X86XADD of bool * x86Size * x86Rm * reg -| `X86XCHG of bool * x86Size * x86Rm * reg diff --git a/x86/gen/fold.hgen b/x86/gen/fold.hgen deleted file mode 100644 index df546a13..00000000 --- a/x86/gen/fold.hgen +++ /dev/null @@ -1,26 +0,0 @@ -| `X86BINOP (_, _, _, ds) -> fold_dest_src ds c -| `X86BITOP (_, _, _, bo) -> fold_bit_offset bo c -| `X86CALL irm -> fold_imm_rm irm c -| `X86CLC -> c -| `X86CMC -> c -| `X86CMPXCHG (_, _, rm, r) -> fold_rm rm (fold_reg r c) -| `X86DIV (_, rm) -> fold_rm rm c -| `X86JCC _ -> c -| `X86JMP rm -> fold_rm rm c -| `X86LEA (_, ds) -> fold_dest_src ds c -| `X86LEAVE -> c -| `X86LOOP _ -> c -| `X86MFENCE -> c -| `X86MONOP (_, _, _, rm) -> fold_rm rm c -| `X86MOV (_, _, ds) -> fold_dest_src ds c -| `X86MOVSX (_, ds, _) -> fold_dest_src ds c -| `X86MOVZX (_, ds, _) -> fold_dest_src ds c -| `X86MUL (_, rm) -> fold_rm rm c -| `X86NOP -> c -| `X86POP rm -> fold_rm rm c -| `X86PUSH irm -> fold_imm_rm irm c -| `X86RET _ -> c -| `X86SET (_, _, rm) -> fold_rm rm c -| `X86STC -> c -| `X86XADD (_, _, rm, r) -> fold_rm rm (fold_reg r c) -| `X86XCHG (_, _, rm, r) -> fold_rm rm (fold_reg r c) diff --git a/x86/gen/herdtools_ast_to_shallow_ast.hgen b/x86/gen/herdtools_ast_to_shallow_ast.hgen deleted file mode 100644 index c709ee6c..00000000 --- a/x86/gen/herdtools_ast_to_shallow_ast.hgen +++ /dev/null @@ -1,28 +0,0 @@ -| `X86BINOP(locked, binop, sz, dest_src) -> Binop (translate_bool locked, translate_binop binop, translate_size sz, translate_dest_src dest_src) -| `X86BITOP(locked, op, sz, bo) -> Bitop (translate_bool locked, translate_bitop op, translate_size sz, translate_bitoffset bo) -| `X86CALL (imm_rm) -> CALL (translate_imm_rm imm_rm) -| `X86CLC -> CLC -| `X86CMC -> CMC -| `X86CMPXCHG (locked, sz, rm , reg) -> CMPXCHG (translate_bool locked, translate_size sz, translate_rm rm, translate_reg reg) -| `X86DIV (sz, rm) -> X86_DIV (translate_size sz, translate_rm rm) -| `X86StopFetching -> HLT -| `X86JCC (cond, imm64) -> Jcc (translate_cond cond, translate_imm64 imm64) -| `X86JMP (rm) -> JMP (translate_rm rm) -| `X86LEA (sz, dest_src) -> LEA (translate_size sz, translate_dest_src dest_src) -| `X86LEAVE -> LEAVE -| `X86LOOP (cond, imm64) -> LOOP (translate_cond cond, translate_imm64 imm64) -| `X86MFENCE -> MFENCE -| `X86MONOP (locked, monop, sz, rm) -> Monop (translate_bool locked, translate_monop monop, translate_size sz, translate_rm rm) -| `X86MOV (cond, sz, dest_src) -> MOV (translate_cond cond, translate_size sz, translate_dest_src dest_src) -| `X86MOVSX (sz1, dest_src, sz2) -> MOVSX (translate_size sz1, translate_dest_src dest_src, translate_size sz2) -| `X86MOVZX (sz1, dest_src, sz2) -> MOVZX (translate_size sz1, translate_dest_src dest_src, translate_size sz2) -| `X86MUL (sz, rm) -> X86_MUL (translate_size sz, translate_rm rm) -| `X86NOP -> NOP (Nat_big_num.of_int 0) -| `X86POP (rm) -> POP (translate_rm rm) -| `X86PUSH (imm_rm) -> PUSH (translate_imm_rm imm_rm) -| `X86RET (imm64) -> RET (translate_imm64 imm64) -| `X86SET (cond, b, rm) -> SET (translate_cond cond, translate_bool b, translate_rm rm) -| `X86STC -> STC -| `X86XADD (locked, sz, rm, reg) -> XADD (translate_bool locked, translate_size sz, translate_rm rm, translate_reg reg) -| `X86XCHG (locked, sz, rm, reg) -> XCHG (translate_bool locked, translate_size sz, translate_rm rm, translate_reg reg) - diff --git a/x86/gen/herdtools_types_to_shallow_types.hgen b/x86/gen/herdtools_types_to_shallow_types.hgen deleted file mode 100644 index 44e16991..00000000 --- a/x86/gen/herdtools_types_to_shallow_types.hgen +++ /dev/null @@ -1,93 +0,0 @@ -let is_inc = false - -let translate_bool = function - | true -> Sail_values.B1 - | false -> Sail_values.B0 - -let translate_binop = function - | X86ADD -> X86_Add - | X86OR -> X86_Or - | X86ADC -> X86_Adc - | X86SBB -> X86_Sbb - | X86AND -> X86_And - | X86SUB -> X86_Sub - | X86XOR -> X86_Xor - | X86CMP -> X86_Cmp - | X86ROL -> X86_Rol - | X86ROR -> X86_Ror - | X86RCL -> X86_Rcl - | X86RCR -> X86_Rcr - | X86SHL -> X86_Shl - | X86SHR -> X86_Shr - | X86TEST -> X86_Test - | X86SAR -> X86_Sar - -let translate_bitop = function - | X86Btc -> Btc - | X86Bts -> Bts - | X86Btr -> Btr - -let translate_size = function - | X86S8(high) -> Sz8 (translate_bool high) - | X86S16 -> Sz16 - | X86S32 -> Sz32 - | X86S64 -> Sz64 - -let translate_reg r = Nat_big_num.of_int (reg_to_int r) - -let translate_scale s = - Sail_values.to_vec0 is_inc (Nat_big_num.of_int 2, Nat_big_num.of_int s) - -let translate_imm64 i = Sail_values.to_vec0 is_inc (Nat_big_num.of_int 64, i) - -let translate_msi = function - | Some (scale, reg) -> Some (translate_scale scale, translate_reg reg) - | None -> None - -let translate_base = function - | X86HGenBase.NoBase -> X86_embed_types.NoBase - | X86HGenBase.RegBase(r) -> X86_embed_types.RegBase (translate_reg r) - | X86HGenBase.RipBase -> X86_embed_types.RipBase - -let translate_rm = function - | X86HGenBase.Reg (r) -> X86_embed_types.X86_Reg (translate_reg r) - | X86HGenBase.Mem (m_si, base, imm) -> X86_embed_types.Mem (translate_msi m_si, translate_base base, translate_imm64 imm) - | X86HGenBase.Sym (s) -> X86_embed_types.Mem (None, X86_embed_types.NoBase, translate_imm64 Nat_big_num.zero) - -let translate_dest_src = function - | X86HGenBase.R_rm (reg, rm) -> X86_embed_types.R_rm (translate_reg reg, translate_rm rm) - | X86HGenBase.Rm_i (rm, imm64) -> X86_embed_types.Rm_i (translate_rm rm, translate_imm64 imm64) - | X86HGenBase.Rm_r (rm, reg) -> X86_embed_types.Rm_r (translate_rm rm, translate_reg reg) - -let translate_imm_rm = function - | X86HGenBase.Imm (imm) -> X86_embed_types.Imm (translate_imm64 imm) - | X86HGenBase.Rm (rm) -> X86_embed_types.Rm (translate_rm rm) - -let translate_bitoffset = function - | X86HGenBase.Bit_rm_imm (rm, imm) -> Bit_rm_imm (translate_rm rm, translate_imm64 (Nat_big_num.of_int imm)) - | X86HGenBase.Bit_rm_r (rm, r) -> Bit_rm_r (translate_rm rm, translate_reg r) - -let translate_cond = function - | X86O -> X86_O - | X86NO -> X86_NO - | X86B -> X86_B - | X86NB -> X86_NB - | X86E -> X86_E - | X86NE -> X86_NE - | X86NA -> X86_NA - | X86A -> X86_A - | X86S -> X86_S - | X86NS -> X86_NS - | X86P -> X86_P - | X86NP -> X86_NP - | X86L -> X86_L - | X86NL -> X86_NL - | X86NG -> X86_NG - | X86G -> X86_G - | X86ALWAYS -> X86_ALWAYS - -let translate_monop = function - | X86DEC -> X86_Dec - | X86INC -> X86_Inc - | X86NOT -> X86_Not - | X86NEG -> X86_Neg diff --git a/x86/gen/lexer.hgen b/x86/gen/lexer.hgen deleted file mode 100644 index 56944e6d..00000000 --- a/x86/gen/lexer.hgen +++ /dev/null @@ -1,399 +0,0 @@ -"addb" , BINOP { txt = "ADDB"; op = X86ADD; sz = X86BYTE }; -"orb" , BINOP { txt = "ORB"; op = X86OR; sz = X86BYTE }; -"adcb" , BINOP { txt = "ADCB"; op = X86ADC; sz = X86BYTE }; -"sbbb" , BINOP { txt = "SBBB"; op = X86SBB; sz = X86BYTE }; -"andb" , BINOP { txt = "ANDB"; op = X86AND; sz = X86BYTE }; -"subb" , BINOP { txt = "SUBB"; op = X86SUB; sz = X86BYTE }; -"xorb" , BINOP { txt = "XORB"; op = X86XOR; sz = X86BYTE }; -"cmpb" , BINOP { txt = "CMPB"; op = X86CMP; sz = X86BYTE }; -"rolb" , BINOP { txt = "ROLB"; op = X86ROL; sz = X86BYTE }; -"rorb" , BINOP { txt = "RORB"; op = X86ROR; sz = X86BYTE }; -"shlb" , BINOP { txt = "SHLB"; op = X86SHL; sz = X86BYTE }; -"shrb" , BINOP { txt = "SHRB"; op = X86SHR; sz = X86BYTE }; -"testb" , BINOP { txt = "TESTB"; op = X86TEST; sz = X86BYTE }; -"sarb" , BINOP { txt = "SARB"; op = X86SAR; sz = X86BYTE }; -"addw" , BINOP { txt = "ADDW"; op = X86ADD; sz = X86WORD }; -"orw" , BINOP { txt = "ORW"; op = X86OR; sz = X86WORD }; -"adcw" , BINOP { txt = "ADCW"; op = X86ADC; sz = X86WORD }; -"sbbw" , BINOP { txt = "SBBW"; op = X86SBB; sz = X86WORD }; -"andw" , BINOP { txt = "ANDW"; op = X86AND; sz = X86WORD }; -"subw" , BINOP { txt = "SUBW"; op = X86SUB; sz = X86WORD }; -"xorw" , BINOP { txt = "XORW"; op = X86XOR; sz = X86WORD }; -"cmpw" , BINOP { txt = "CMPW"; op = X86CMP; sz = X86WORD }; -"rolw" , BINOP { txt = "ROLW"; op = X86ROL; sz = X86WORD }; -"rorw" , BINOP { txt = "RORW"; op = X86ROR; sz = X86WORD }; -"shlw" , BINOP { txt = "SHLW"; op = X86SHL; sz = X86WORD }; -"shrw" , BINOP { txt = "SHRW"; op = X86SHR; sz = X86WORD }; -"testw" , BINOP { txt = "TESTW"; op = X86TEST; sz = X86WORD }; -"sarw" , BINOP { txt = "SARW"; op = X86SAR; sz = X86WORD }; -"addl" , BINOP { txt = "ADDL"; op = X86ADD; sz = X86LONG }; -"orl" , BINOP { txt = "ORL"; op = X86OR; sz = X86LONG }; -"adcl" , BINOP { txt = "ADCL"; op = X86ADC; sz = X86LONG }; -"sbbl" , BINOP { txt = "SBBL"; op = X86SBB; sz = X86LONG }; -"andl" , BINOP { txt = "ANDL"; op = X86AND; sz = X86LONG }; -"subl" , BINOP { txt = "SUBL"; op = X86SUB; sz = X86LONG }; -"xorl" , BINOP { txt = "XORL"; op = X86XOR; sz = X86LONG }; -"cmpl" , BINOP { txt = "CMPL"; op = X86CMP; sz = X86LONG }; -"roll" , BINOP { txt = "ROLL"; op = X86ROL; sz = X86LONG }; -"rorl" , BINOP { txt = "RORL"; op = X86ROR; sz = X86LONG }; -"shll" , BINOP { txt = "SHLL"; op = X86SHL; sz = X86LONG }; -"shrl" , BINOP { txt = "SHRL"; op = X86SHR; sz = X86LONG }; -"testl" , BINOP { txt = "TESTL"; op = X86TEST; sz = X86LONG }; -"sarl" , BINOP { txt = "SARL"; op = X86SAR; sz = X86LONG }; -"addq" , BINOP { txt = "ADDQ"; op = X86ADD; sz = X86QUAD }; -"orq" , BINOP { txt = "ORQ"; op = X86OR; sz = X86QUAD }; -"adcq" , BINOP { txt = "ADCQ"; op = X86ADC; sz = X86QUAD }; -"sbbq" , BINOP { txt = "SBBQ"; op = X86SBB; sz = X86QUAD }; -"andq" , BINOP { txt = "ANDQ"; op = X86AND; sz = X86QUAD }; -"subq" , BINOP { txt = "SUBQ"; op = X86SUB; sz = X86QUAD }; -"xorq" , BINOP { txt = "XORQ"; op = X86XOR; sz = X86QUAD }; -"cmpq" , BINOP { txt = "CMPQ"; op = X86CMP; sz = X86QUAD }; -"rolq" , BINOP { txt = "ROLQ"; op = X86ROL; sz = X86QUAD }; -"rorq" , BINOP { txt = "RORQ"; op = X86ROR; sz = X86QUAD }; -"shlq" , BINOP { txt = "SHLQ"; op = X86SHL; sz = X86QUAD }; -"shrq" , BINOP { txt = "SHRQ"; op = X86SHR; sz = X86QUAD }; -"testq" , BINOP { txt = "TESTQ"; op = X86TEST; sz = X86QUAD }; -"sarq" , BINOP { txt = "SARQ"; op = X86SAR; sz = X86QUAD }; -"add" , BINOP { txt = "ADDQ"; op = X86ADD; sz = X86NONE }; -"or" , BINOP { txt = "OR"; op = X86OR; sz = X86NONE }; -"adc" , BINOP { txt = "ADC"; op = X86ADC; sz = X86NONE }; -"sbb" , BINOP { txt = "SBB"; op = X86SBB; sz = X86NONE }; -"and" , BINOP { txt = "AND"; op = X86AND; sz = X86NONE }; -"sub" , BINOP { txt = "SUB"; op = X86SUB; sz = X86NONE }; -"xor" , BINOP { txt = "XOR"; op = X86XOR; sz = X86NONE }; -"cmp" , BINOP { txt = "CMP"; op = X86CMP; sz = X86NONE }; -"rol" , BINOP { txt = "ROL"; op = X86ROL; sz = X86NONE }; -"ror" , BINOP { txt = "ROR"; op = X86ROR; sz = X86NONE }; -"shl" , BINOP { txt = "SHL"; op = X86SHL; sz = X86NONE }; -"shr" , BINOP { txt = "SHR"; op = X86SHR; sz = X86NONE }; -"test" , BINOP { txt = "TEST"; op = X86TEST; sz = X86NONE }; -"sar" , BINOP { txt = "SAR"; op = X86SAR; sz = X86NONE }; -"btcw" , BITOP { txt = "BTSW"; op = X86Btc; sz = X86WORD }; -"btsw" , BITOP { txt = "BTCW"; op = X86Bts; sz = X86WORD }; -"btrw" , BITOP { txt = "BTRW"; op = X86Btr; sz = X86WORD }; -"btcl" , BITOP { txt = "BTSL"; op = X86Btc; sz = X86LONG }; -"btsl" , BITOP { txt = "BTCL"; op = X86Bts; sz = X86LONG }; -"btrl" , BITOP { txt = "BTRL"; op = X86Btr; sz = X86LONG }; -"btcq" , BITOP { txt = "BTSQ"; op = X86Btc; sz = X86QUAD }; -"btsq" , BITOP { txt = "BTCQ"; op = X86Bts; sz = X86QUAD }; -"btrq" , BITOP { txt = "BTRQ"; op = X86Btr; sz = X86QUAD }; -"btc" , BITOP { txt = "BTS"; op = X86Btc; sz = X86NONE }; -"bts" , BITOP { txt = "BTC"; op = X86Bts; sz = X86NONE }; -"btr" , BITOP { txt = "BTR"; op = X86Btr; sz = X86NONE }; -"call" , CALL { txt = "CALL" }; -"clc" , CLC { txt = "CLC" }; -"cmc" , CMC { txt = "CMC" }; -"cmpxchgb" , CMPXCHG { txt = "CMPXCHGB"; sz = X86BYTE }; -"cmpxchgw" , CMPXCHG { txt = "CMPXCHGW"; sz = X86WORD }; -"cmpxchgl" , CMPXCHG { txt = "CMPXCHGL"; sz = X86LONG }; -"cmpxchgq" , CMPXCHG { txt = "CMPXCHGQ"; sz = X86QUAD }; -"cmpxchg" , CMPXCHG { txt = "CMPXCHG"; sz = X86NONE }; -"divb" , DIV { txt = "DIVB"; sz = X86BYTE }; -"divw" , DIV { txt = "DIVW"; sz = X86WORD }; -"divl" , DIV { txt = "DIVL"; sz = X86LONG }; -"divq" , DIV { txt = "DIVQ"; sz = X86QUAD }; -"div" , DIV { txt = "DIV"; sz = X86NONE }; -"jo" , JCC { txt = "JO"; cond = X86O }; -"jb" , JCC { txt = "JB"; cond = X86B }; -"jc" , JCC { txt = "JC"; cond = X86B }; -"jnae" , JCC { txt = "JNAE"; cond = X86B }; -"je" , JCC { txt = "JE"; cond = X86E }; -"jz" , JCC { txt = "JZ"; cond = X86E }; -"ja" , JCC { txt = "JA"; cond = X86A }; -"jnbe" , JCC { txt = "JNBE"; cond = X86A }; -"js" , JCC { txt = "JS"; cond = X86S }; -"jp" , JCC { txt = "JP"; cond = X86P }; -"jpe" , JCC { txt = "JPE"; cond = X86P }; -"jl" , JCC { txt = "JL"; cond = X86L }; -"jnge" , JCC { txt = "JNGE"; cond = X86L }; -"jg" , JCC { txt = "JG"; cond = X86G }; -"jnle" , JCC { txt = "JNLE"; cond = X86G }; -"jno" , JCC { txt = "JNO"; cond = X86NO }; -"jnb" , JCC { txt = "JNB"; cond = X86NB }; -"jnc" , JCC { txt = "JNC"; cond = X86NB }; -"jae" , JCC { txt = "JAE"; cond = X86NB }; -"jne" , JCC { txt = "JNE"; cond = X86NE }; -"jnz" , JCC { txt = "JNZ"; cond = X86NE }; -"jna" , JCC { txt = "JNA"; cond = X86NA }; -"jbe" , JCC { txt = "JBE"; cond = X86NA }; -"jns" , JCC { txt = "JNS"; cond = X86NS }; -"jnp" , JCC { txt = "JNP"; cond = X86NP }; -"jpo" , JCC { txt = "JPO"; cond = X86NP }; -"jnl" , JCC { txt = "JNL"; cond = X86NL }; -"jge" , JCC { txt = "JGE"; cond = X86NL }; -"jng" , JCC { txt = "JNG"; cond = X86NG }; -"jle" , JCC { txt = "JLE"; cond = X86NG }; -"jmp" , JMP { txt = "JMP" }; -"leaw" , LEA { txt = "LEAW"; sz = X86BYTE }; -"leal" , LEA { txt = "LEAL"; sz = X86LONG }; -"leaq" , LEA { txt = "LEAQ"; sz = X86QUAD }; -"lea" , LEA { txt = "LEA"; sz = X86NONE }; -"leave" , LEAVE { txt = "LEAVE" }; -"loopo" , LOOP { txt = "LOOPO"; cond = X86O }; -"loopb" , LOOP { txt = "LOOPB"; cond = X86B }; -"loopc" , LOOP { txt = "LOOPC"; cond = X86B }; -"loopnae" , LOOP { txt = "LOOPNAE"; cond = X86B }; -"loope" , LOOP { txt = "LOOPE"; cond = X86E }; -"loopz" , LOOP { txt = "LOOPZ"; cond = X86E }; -"loopa" , LOOP { txt = "LOOPA"; cond = X86A }; -"loopnbe" , LOOP { txt = "LOOPNBE"; cond = X86A }; -"loops" , LOOP { txt = "LOOPS"; cond = X86S }; -"loopp" , LOOP { txt = "LOOPP"; cond = X86P }; -"looppe" , LOOP { txt = "LOOPPE"; cond = X86P }; -"loopl" , LOOP { txt = "LOOPL"; cond = X86L }; -"loopnge" , LOOP { txt = "LOOPNGE"; cond = X86L }; -"loopg" , LOOP { txt = "LOOPG"; cond = X86G }; -"loopnle" , LOOP { txt = "LOOPNLE"; cond = X86G }; -"loopno" , LOOP { txt = "LOOPNO"; cond = X86NO }; -"loopnb" , LOOP { txt = "LOOPNB"; cond = X86NB }; -"loopnc" , LOOP { txt = "LOOPNC"; cond = X86NB }; -"loopae" , LOOP { txt = "LOOPAE"; cond = X86NB }; -"loopne" , LOOP { txt = "LOOPNE"; cond = X86NE }; -"loopnz" , LOOP { txt = "LOOPNZ"; cond = X86NE }; -"loopna" , LOOP { txt = "LOOPNA"; cond = X86NA }; -"loopbe" , LOOP { txt = "LOOPBE"; cond = X86NA }; -"loopns" , LOOP { txt = "LOOPNS"; cond = X86NS }; -"loopnp" , LOOP { txt = "LOOPNP"; cond = X86NP }; -"looppo" , LOOP { txt = "LOOPPO"; cond = X86NP }; -"loopnl" , LOOP { txt = "LOOPNL"; cond = X86NL }; -"loopge" , LOOP { txt = "LOOPGE"; cond = X86NL }; -"loopng" , LOOP { txt = "LOOPNG"; cond = X86NG }; -"loople" , LOOP { txt = "LOOPLE"; cond = X86NG }; -"mfence" , MFENCE { txt = "MFENCE" }; -"decb" , MONOP { txt = "DECB"; op = X86DEC; sz = X86BYTE }; -"incb" , MONOP { txt = "INCB"; op = X86INC; sz = X86BYTE }; -"notb" , MONOP { txt = "NOTB"; op = X86NOT; sz = X86BYTE }; -"negb" , MONOP { txt = "NEGB"; op = X86NEG; sz = X86BYTE }; -"decw" , MONOP { txt = "DECW"; op = X86DEC; sz = X86WORD }; -"incw" , MONOP { txt = "INCW"; op = X86INC; sz = X86WORD }; -"notw" , MONOP { txt = "NOTW"; op = X86NOT; sz = X86WORD }; -"negw" , MONOP { txt = "NEGW"; op = X86NEG; sz = X86WORD }; -"decl" , MONOP { txt = "DECL"; op = X86DEC; sz = X86LONG }; -"incl" , MONOP { txt = "INCL"; op = X86INC; sz = X86LONG }; -"notl" , MONOP { txt = "NOTL"; op = X86NOT; sz = X86LONG }; -"negl" , MONOP { txt = "NEGL"; op = X86NEG; sz = X86LONG }; -"decq" , MONOP { txt = "DECQ"; op = X86DEC; sz = X86QUAD }; -"incq" , MONOP { txt = "INCQ"; op = X86INC; sz = X86QUAD }; -"notq" , MONOP { txt = "NOTQ"; op = X86NOT; sz = X86QUAD }; -"negq" , MONOP { txt = "NEGQ"; op = X86NEG; sz = X86QUAD }; -"dec" , MONOP { txt = "DEC"; op = X86DEC; sz = X86NONE }; -"inc" , MONOP { txt = "INC"; op = X86INC; sz = X86NONE }; -"not" , MONOP { txt = "NOT"; op = X86NOT; sz = X86NONE }; -"neg" , MONOP { txt = "NEG"; op = X86NEG; sz = X86NONE }; -"cmovow" , CMOV { txt = "CMOVOW"; cond = X86O; sz = X86WORD }; -"cmovbw" , CMOV { txt = "CMOVBW"; cond = X86B; sz = X86WORD }; -"cmovcw" , CMOV { txt = "CMOVCW"; cond = X86B; sz = X86WORD }; -"cmovnaew" , CMOV { txt = "CMOVNAEW"; cond = X86B; sz = X86WORD }; -"cmovew" , CMOV { txt = "CMOVEW"; cond = X86E; sz = X86WORD }; -"cmovzw" , CMOV { txt = "CMOVZW"; cond = X86E; sz = X86WORD }; -"cmovaw" , CMOV { txt = "CMOVAW"; cond = X86A; sz = X86WORD }; -"cmovnbew" , CMOV { txt = "CMOVNBEW"; cond = X86A; sz = X86WORD }; -"cmovsw" , CMOV { txt = "CMOVSW"; cond = X86S; sz = X86WORD }; -"cmovpw" , CMOV { txt = "CMOVPW"; cond = X86P; sz = X86WORD }; -"cmovpew" , CMOV { txt = "CMOVPEW"; cond = X86P; sz = X86WORD }; -"cmovlw" , CMOV { txt = "CMOVLW"; cond = X86L; sz = X86WORD }; -"cmovngew" , CMOV { txt = "CMOVNGEW"; cond = X86L; sz = X86WORD }; -"cmovgw" , CMOV { txt = "CMOVGW"; cond = X86G; sz = X86WORD }; -"cmovnlew" , CMOV { txt = "CMOVNLEW"; cond = X86G; sz = X86WORD }; -"cmovnow" , CMOV { txt = "CMOVNOW"; cond = X86NO; sz = X86WORD }; -"cmovnbw" , CMOV { txt = "CMOVNBW"; cond = X86NB; sz = X86WORD }; -"cmovncw" , CMOV { txt = "CMOVNCW"; cond = X86NB; sz = X86WORD }; -"cmovaew" , CMOV { txt = "CMOVAEW"; cond = X86NB; sz = X86WORD }; -"cmovnew" , CMOV { txt = "CMOVNEW"; cond = X86NE; sz = X86WORD }; -"cmovnzw" , CMOV { txt = "CMOVNZW"; cond = X86NE; sz = X86WORD }; -"cmovnaw" , CMOV { txt = "CMOVNAW"; cond = X86NA; sz = X86WORD }; -"cmovbew" , CMOV { txt = "CMOVBEW"; cond = X86NA; sz = X86WORD }; -"cmovnsw" , CMOV { txt = "CMOVNSW"; cond = X86NS; sz = X86WORD }; -"cmovnpw" , CMOV { txt = "CMOVNPW"; cond = X86NP; sz = X86WORD }; -"cmovpow" , CMOV { txt = "CMOVPOW"; cond = X86NP; sz = X86WORD }; -"cmovnlw" , CMOV { txt = "CMOVNLW"; cond = X86NL; sz = X86WORD }; -"cmovgew" , CMOV { txt = "CMOVGEW"; cond = X86NL; sz = X86WORD }; -"cmovngw" , CMOV { txt = "CMOVNGW"; cond = X86NG; sz = X86WORD }; -"cmovlew" , CMOV { txt = "CMOVLEW"; cond = X86NG; sz = X86WORD }; -"cmovol" , CMOV { txt = "CMOVOL"; cond = X86O; sz = X86LONG }; -"cmovbl" , CMOV { txt = "CMOVBL"; cond = X86B; sz = X86LONG }; -"cmovcl" , CMOV { txt = "CMOVCL"; cond = X86B; sz = X86LONG }; -"cmovnael" , CMOV { txt = "CMOVNAEL"; cond = X86B; sz = X86LONG }; -"cmovel" , CMOV { txt = "CMOVEL"; cond = X86E; sz = X86LONG }; -"cmovzl" , CMOV { txt = "CMOVZL"; cond = X86E; sz = X86LONG }; -"cmoval" , CMOV { txt = "CMOVAL"; cond = X86A; sz = X86LONG }; -"cmovnbel" , CMOV { txt = "CMOVNBEL"; cond = X86A; sz = X86LONG }; -"cmovsl" , CMOV { txt = "CMOVSL"; cond = X86S; sz = X86LONG }; -"cmovpl" , CMOV { txt = "CMOVPL"; cond = X86P; sz = X86LONG }; -"cmovpel" , CMOV { txt = "CMOVPEL"; cond = X86P; sz = X86LONG }; -"cmovll" , CMOV { txt = "CMOVLL"; cond = X86L; sz = X86LONG }; -"cmovngel" , CMOV { txt = "CMOVNGEL"; cond = X86L; sz = X86LONG }; -"cmovgl" , CMOV { txt = "CMOVGL"; cond = X86G; sz = X86LONG }; -"cmovnlel" , CMOV { txt = "CMOVNLEL"; cond = X86G; sz = X86LONG }; -"cmovnol" , CMOV { txt = "CMOVNOL"; cond = X86NO; sz = X86LONG }; -"cmovnbl" , CMOV { txt = "CMOVNBL"; cond = X86NB; sz = X86LONG }; -"cmovncl" , CMOV { txt = "CMOVNCL"; cond = X86NB; sz = X86LONG }; -"cmovael" , CMOV { txt = "CMOVAEL"; cond = X86NB; sz = X86LONG }; -"cmovnel" , CMOV { txt = "CMOVNEL"; cond = X86NE; sz = X86LONG }; -"cmovnzl" , CMOV { txt = "CMOVNZL"; cond = X86NE; sz = X86LONG }; -"cmovnal" , CMOV { txt = "CMOVNAL"; cond = X86NA; sz = X86LONG }; -"cmovbel" , CMOV { txt = "CMOVBEL"; cond = X86NA; sz = X86LONG }; -"cmovnsl" , CMOV { txt = "CMOVNSL"; cond = X86NS; sz = X86LONG }; -"cmovnpl" , CMOV { txt = "CMOVNPL"; cond = X86NP; sz = X86LONG }; -"cmovpol" , CMOV { txt = "CMOVPOL"; cond = X86NP; sz = X86LONG }; -"cmovnll" , CMOV { txt = "CMOVNLL"; cond = X86NL; sz = X86LONG }; -"cmovgel" , CMOV { txt = "CMOVGEL"; cond = X86NL; sz = X86LONG }; -"cmovngl" , CMOV { txt = "CMOVNGL"; cond = X86NG; sz = X86LONG }; -"cmovlel" , CMOV { txt = "CMOVLEL"; cond = X86NG; sz = X86LONG }; -"cmovoq" , CMOV { txt = "CMOVOQ"; cond = X86O; sz = X86QUAD }; -"cmovbq" , CMOV { txt = "CMOVBQ"; cond = X86B; sz = X86QUAD }; -"cmovcq" , CMOV { txt = "CMOVCQ"; cond = X86B; sz = X86QUAD }; -"cmovnaeq" , CMOV { txt = "CMOVNAEQ"; cond = X86B; sz = X86QUAD }; -"cmoveq" , CMOV { txt = "CMOVEQ"; cond = X86E; sz = X86QUAD }; -"cmovzq" , CMOV { txt = "CMOVZQ"; cond = X86E; sz = X86QUAD }; -"cmovaq" , CMOV { txt = "CMOVAQ"; cond = X86A; sz = X86QUAD }; -"cmovnbeq" , CMOV { txt = "CMOVNBEQ"; cond = X86A; sz = X86QUAD }; -"cmovsq" , CMOV { txt = "CMOVSQ"; cond = X86S; sz = X86QUAD }; -"cmovpq" , CMOV { txt = "CMOVPQ"; cond = X86P; sz = X86QUAD }; -"cmovpeq" , CMOV { txt = "CMOVPEQ"; cond = X86P; sz = X86QUAD }; -"cmovlq" , CMOV { txt = "CMOVLQ"; cond = X86L; sz = X86QUAD }; -"cmovngeq" , CMOV { txt = "CMOVNGEQ"; cond = X86L; sz = X86QUAD }; -"cmovgq" , CMOV { txt = "CMOVGQ"; cond = X86G; sz = X86QUAD }; -"cmovnleq" , CMOV { txt = "CMOVNLEQ"; cond = X86G; sz = X86QUAD }; -"cmovnoq" , CMOV { txt = "CMOVNOQ"; cond = X86NO; sz = X86QUAD }; -"cmovnbq" , CMOV { txt = "CMOVNBQ"; cond = X86NB; sz = X86QUAD }; -"cmovncq" , CMOV { txt = "CMOVNCQ"; cond = X86NB; sz = X86QUAD }; -"cmovaeq" , CMOV { txt = "CMOVAEQ"; cond = X86NB; sz = X86QUAD }; -"cmovneq" , CMOV { txt = "CMOVNEQ"; cond = X86NE; sz = X86QUAD }; -"cmovnzq" , CMOV { txt = "CMOVNZQ"; cond = X86NE; sz = X86QUAD }; -"cmovnaq" , CMOV { txt = "CMOVNAQ"; cond = X86NA; sz = X86QUAD }; -"cmovbeq" , CMOV { txt = "CMOVBEQ"; cond = X86NA; sz = X86QUAD }; -"cmovnsq" , CMOV { txt = "CMOVNSQ"; cond = X86NS; sz = X86QUAD }; -"cmovnpq" , CMOV { txt = "CMOVNPQ"; cond = X86NP; sz = X86QUAD }; -"cmovpoq" , CMOV { txt = "CMOVPOQ"; cond = X86NP; sz = X86QUAD }; -"cmovnlq" , CMOV { txt = "CMOVNLQ"; cond = X86NL; sz = X86QUAD }; -"cmovgeq" , CMOV { txt = "CMOVGEQ"; cond = X86NL; sz = X86QUAD }; -"cmovngq" , CMOV { txt = "CMOVNGQ"; cond = X86NG; sz = X86QUAD }; -"cmovleq" , CMOV { txt = "CMOVLEQ"; cond = X86NG; sz = X86QUAD }; -"cmovo" , CMOV { txt = "CMOVO"; cond = X86O; sz = X86NONE }; -"cmovb" , CMOV { txt = "CMOVB"; cond = X86B; sz = X86NONE }; -"cmovc" , CMOV { txt = "CMOVC"; cond = X86B; sz = X86NONE }; -"cmovnae" , CMOV { txt = "CMOVNAE"; cond = X86B; sz = X86NONE }; -"cmove" , CMOV { txt = "CMOVE"; cond = X86E; sz = X86NONE }; -"cmovz" , CMOV { txt = "CMOVZ"; cond = X86E; sz = X86NONE }; -"cmova" , CMOV { txt = "CMOVA"; cond = X86A; sz = X86NONE }; -"cmovnbe" , CMOV { txt = "CMOVNBE"; cond = X86A; sz = X86NONE }; -"cmovs" , CMOV { txt = "CMOVS"; cond = X86S; sz = X86NONE }; -"cmovp" , CMOV { txt = "CMOVP"; cond = X86P; sz = X86NONE }; -"cmovpe" , CMOV { txt = "CMOVPE"; cond = X86P; sz = X86NONE }; -"cmovl" , CMOV { txt = "CMOVL"; cond = X86L; sz = X86NONE }; -"cmovnge" , CMOV { txt = "CMOVNGE"; cond = X86L; sz = X86NONE }; -"cmovg" , CMOV { txt = "CMOVG"; cond = X86G; sz = X86NONE }; -"cmovnle" , CMOV { txt = "CMOVNLE"; cond = X86G; sz = X86NONE }; -"cmovno" , CMOV { txt = "CMOVNO"; cond = X86NO; sz = X86NONE }; -"cmovnb" , CMOV { txt = "CMOVNB"; cond = X86NB; sz = X86NONE }; -"cmovnc" , CMOV { txt = "CMOVNC"; cond = X86NB; sz = X86NONE }; -"cmovae" , CMOV { txt = "CMOVAE"; cond = X86NB; sz = X86NONE }; -"cmovne" , CMOV { txt = "CMOVNE"; cond = X86NE; sz = X86NONE }; -"cmovnz" , CMOV { txt = "CMOVNZ"; cond = X86NE; sz = X86NONE }; -"cmovna" , CMOV { txt = "CMOVNA"; cond = X86NA; sz = X86NONE }; -"cmovbe" , CMOV { txt = "CMOVBE"; cond = X86NA; sz = X86NONE }; -"cmovns" , CMOV { txt = "CMOVNS"; cond = X86NS; sz = X86NONE }; -"cmovnp" , CMOV { txt = "CMOVNP"; cond = X86NP; sz = X86NONE }; -"cmovpo" , CMOV { txt = "CMOVPO"; cond = X86NP; sz = X86NONE }; -"cmovnl" , CMOV { txt = "CMOVNL"; cond = X86NL; sz = X86NONE }; -"cmovge" , CMOV { txt = "CMOVGE"; cond = X86NL; sz = X86NONE }; -"cmovng" , CMOV { txt = "CMOVNG"; cond = X86NG; sz = X86NONE }; -"cmovle" , CMOV { txt = "CMOVLE"; cond = X86NG; sz = X86NONE }; -"movb" , MOV { txt = "MOVB"; sz = X86BYTE }; -"movw" , MOV { txt = "MOVW"; sz = X86WORD }; -"movl" , MOV { txt = "MOVL"; sz = X86LONG }; -"movq" , MOV { txt = "MOVQ"; sz = X86QUAD }; -"mov" , MOV { txt = "MOV"; sz = X86NONE }; -"movabs" , MOV { txt = "MOVABS"; sz = X86QUAD }; -"movsbw" , MOVSX { txt = "MOVSBW"; sz1 = X86BYTE; sz2 = X86WORD }; -"movsbl" , MOVSX { txt = "MOVSBL"; sz1 = X86BYTE; sz2 = X86LONG }; -"movsbq" , MOVSX { txt = "MOVSBQ"; sz1 = X86BYTE; sz2 = X86QUAD }; -"movswl" , MOVSX { txt = "MOVSWL"; sz1 = X86WORD; sz2 = X86LONG }; -"movswq" , MOVSX { txt = "MOVSWQ"; sz1 = X86WORD; sz2 = X86QUAD }; -"movslq" , MOVSX { txt = "MOVSWQ"; sz1 = X86LONG; sz2 = X86QUAD }; -"movzbw" , MOVZX { txt = "MOVZBW"; sz1 = X86BYTE; sz2 = X86WORD }; -"movzbl" , MOVZX { txt = "MOVZBL"; sz1 = X86BYTE; sz2 = X86LONG }; -"movzbq" , MOVZX { txt = "MOVZBQ"; sz1 = X86BYTE; sz2 = X86QUAD }; -"movzwl" , MOVZX { txt = "MOVZWL"; sz1 = X86WORD; sz2 = X86LONG }; -"movzwq" , MOVZX { txt = "MOVZWQ"; sz1 = X86WORD; sz2 = X86QUAD }; -"mulb" , MUL { txt = "MULB"; sz = X86BYTE }; -"mulw" , MUL { txt = "MULW"; sz = X86WORD }; -"mull" , MUL { txt = "MULL"; sz = X86LONG }; -"mulq" , MUL { txt = "MULQ"; sz = X86QUAD }; -"mul" , MUL { txt = "MUL"; sz = X86NONE }; -"nop" , NOP { txt = "NOP" }; -"pop" , POP { txt = "POP" }; -"push" , PUSH { txt = "PUSH" }; -"ret" , PUSH { txt = "RET" }; -"setob" , SET { txt = "SETOB"; cond = X86O }; -"setbb" , SET { txt = "SETBB"; cond = X86B }; -"setcb" , SET { txt = "SETCB"; cond = X86B }; -"setnaeb" , SET { txt = "SETNAEB"; cond = X86B }; -"seteb" , SET { txt = "SETEB"; cond = X86E }; -"setzb" , SET { txt = "SETZB"; cond = X86E }; -"setab" , SET { txt = "SETAB"; cond = X86A }; -"setnbeb" , SET { txt = "SETNBEB"; cond = X86A }; -"setsb" , SET { txt = "SETSB"; cond = X86S }; -"setpb" , SET { txt = "SETPB"; cond = X86P }; -"setpeb" , SET { txt = "SETPEB"; cond = X86P }; -"setlb" , SET { txt = "SETLB"; cond = X86L }; -"setngeb" , SET { txt = "SETNGEB"; cond = X86L }; -"setgb" , SET { txt = "SETGB"; cond = X86G }; -"setnleb" , SET { txt = "SETNLEB"; cond = X86G }; -"setnob" , SET { txt = "SETNOB"; cond = X86NO }; -"setnbb" , SET { txt = "SETNBB"; cond = X86NB }; -"setncb" , SET { txt = "SETNCB"; cond = X86NB }; -"setaeb" , SET { txt = "SETAEB"; cond = X86NB }; -"setneb" , SET { txt = "SETNEB"; cond = X86NE }; -"setnzb" , SET { txt = "SETNZB"; cond = X86NE }; -"setnab" , SET { txt = "SETNAB"; cond = X86NA }; -"setbeb" , SET { txt = "SETBEB"; cond = X86NA }; -"setnsb" , SET { txt = "SETNSB"; cond = X86NS }; -"setnpb" , SET { txt = "SETNPB"; cond = X86NP }; -"setpob" , SET { txt = "SETPOB"; cond = X86NP }; -"setnlb" , SET { txt = "SETNLB"; cond = X86NL }; -"setgeb" , SET { txt = "SETGEB"; cond = X86NL }; -"setngb" , SET { txt = "SETNGB"; cond = X86NG }; -"setleb" , SET { txt = "SETLEB"; cond = X86NG }; -"seto" , SET { txt = "SETO"; cond = X86O }; -"setb" , SET { txt = "SETB"; cond = X86B }; -"setc" , SET { txt = "SETC"; cond = X86B }; -"setnae" , SET { txt = "SETNAE"; cond = X86B }; -"sete" , SET { txt = "SETE"; cond = X86E }; -"setz" , SET { txt = "SETZ"; cond = X86E }; -"seta" , SET { txt = "SETA"; cond = X86A }; -"setnbe" , SET { txt = "SETNBE"; cond = X86A }; -"sets" , SET { txt = "SETS"; cond = X86S }; -"setp" , SET { txt = "SETP"; cond = X86P }; -"setpe" , SET { txt = "SETPE"; cond = X86P }; -"setl" , SET { txt = "SETL"; cond = X86L }; -"setnge" , SET { txt = "SETNGE"; cond = X86L }; -"setg" , SET { txt = "SETG"; cond = X86G }; -"setnle" , SET { txt = "SETNLE"; cond = X86G }; -"setno" , SET { txt = "SETNO"; cond = X86NO }; -"setnb" , SET { txt = "SETNB"; cond = X86NB }; -"setnc" , SET { txt = "SETNC"; cond = X86NB }; -"setae" , SET { txt = "SETAE"; cond = X86NB }; -"setne" , SET { txt = "SETNE"; cond = X86NE }; -"setnz" , SET { txt = "SETNZ"; cond = X86NE }; -"setna" , SET { txt = "SETNA"; cond = X86NA }; -"setbe" , SET { txt = "SETBE"; cond = X86NA }; -"setns" , SET { txt = "SETNS"; cond = X86NS }; -"setnp" , SET { txt = "SETNP"; cond = X86NP }; -"setpo" , SET { txt = "SETPO"; cond = X86NP }; -"setnl" , SET { txt = "SETNL"; cond = X86NL }; -"setge" , SET { txt = "SETGE"; cond = X86NL }; -"setng" , SET { txt = "SETNG"; cond = X86NG }; -"setle" , SET { txt = "SETLE"; cond = X86NG }; -"stc" , STC { txt = "STC" }; -"xaddb" , XADD { txt = "XADDB"; sz = X86BYTE }; -"xaddw" , XADD { txt = "XADDW"; sz = X86WORD }; -"xaddl" , XADD { txt = "XADDL"; sz = X86LONG }; -"xaddq" , XADD { txt = "XADDQ"; sz = X86QUAD }; -"xadd" , XADD { txt = "XADD"; sz = X86NONE }; -"xchgb" , XCHG { txt = "XCHGB"; sz = X86BYTE }; -"xchgw" , XCHG { txt = "XCHGW"; sz = X86WORD }; -"xchgl" , XCHG { txt = "XCHGL"; sz = X86LONG }; -"xchgq" , XCHG { txt = "XCHGQ"; sz = X86QUAD }; -"xchg" , XCHG { txt = "XCHG"; sz = X86NONE }; diff --git a/x86/gen/lexer_intel.hgen b/x86/gen/lexer_intel.hgen deleted file mode 100644 index e1854a14..00000000 --- a/x86/gen/lexer_intel.hgen +++ /dev/null @@ -1,161 +0,0 @@ -"add" , BINOP { txt = "ADDQ"; op = X86ADD; sz = X86NONE }; -"or" , BINOP { txt = "OR"; op = X86OR; sz = X86NONE }; -"adc" , BINOP { txt = "ADC"; op = X86ADC; sz = X86NONE }; -"sbb" , BINOP { txt = "SBB"; op = X86SBB; sz = X86NONE }; -"and" , BINOP { txt = "AND"; op = X86AND; sz = X86NONE }; -"sub" , BINOP { txt = "SUB"; op = X86SUB; sz = X86NONE }; -"xor" , BINOP { txt = "XOR"; op = X86XOR; sz = X86NONE }; -"cmp" , BINOP { txt = "CMP"; op = X86CMP; sz = X86NONE }; -"rol" , BINOP { txt = "ROL"; op = X86ROL; sz = X86NONE }; -"ror" , BINOP { txt = "ROR"; op = X86ROR; sz = X86NONE }; -"shl" , BINOP { txt = "SHL"; op = X86SHL; sz = X86NONE }; -"shr" , BINOP { txt = "SHR"; op = X86SHR; sz = X86NONE }; -"test" , BINOP { txt = "TEST"; op = X86TEST; sz = X86NONE }; -"sar" , BINOP { txt = "SAR"; op = X86SAR; sz = X86NONE }; -"btc" , BITOP { txt = "BTS"; op = X86Btc; sz = X86NONE }; -"bts" , BITOP { txt = "BTC"; op = X86Bts; sz = X86NONE }; -"btr" , BITOP { txt = "BTR"; op = X86Btr; sz = X86NONE }; -"call" , CALL { txt = "CALL" }; -"clc" , CLC { txt = "CLC" }; -"cmc" , CMC { txt = "CMC" }; -"cmpxchg" , CMPXCHG { txt = "CMPXCHG"; sz = X86NONE }; -"div" , DIV { txt = "DIV"; sz = X86NONE }; -"jo" , JCC { txt = "JO"; cond = X86O }; -"jb" , JCC { txt = "JB"; cond = X86B }; -"jc" , JCC { txt = "JC"; cond = X86B }; -"jnae" , JCC { txt = "JNAE"; cond = X86B }; -"je" , JCC { txt = "JE"; cond = X86E }; -"jz" , JCC { txt = "JZ"; cond = X86E }; -"ja" , JCC { txt = "JA"; cond = X86A }; -"jnbe" , JCC { txt = "JNBE"; cond = X86A }; -"js" , JCC { txt = "JS"; cond = X86S }; -"jp" , JCC { txt = "JP"; cond = X86P }; -"jpe" , JCC { txt = "JPE"; cond = X86P }; -"jl" , JCC { txt = "JL"; cond = X86L }; -"jnge" , JCC { txt = "JNGE"; cond = X86L }; -"jg" , JCC { txt = "JG"; cond = X86G }; -"jnle" , JCC { txt = "JNLE"; cond = X86G }; -"jno" , JCC { txt = "JNO"; cond = X86NO }; -"jnb" , JCC { txt = "JNB"; cond = X86NB }; -"jnc" , JCC { txt = "JNC"; cond = X86NB }; -"jae" , JCC { txt = "JAE"; cond = X86NB }; -"jne" , JCC { txt = "JNE"; cond = X86NE }; -"jnz" , JCC { txt = "JNZ"; cond = X86NE }; -"jna" , JCC { txt = "JNA"; cond = X86NA }; -"jbe" , JCC { txt = "JBE"; cond = X86NA }; -"jns" , JCC { txt = "JNS"; cond = X86NS }; -"jnp" , JCC { txt = "JNP"; cond = X86NP }; -"jpo" , JCC { txt = "JPO"; cond = X86NP }; -"jnl" , JCC { txt = "JNL"; cond = X86NL }; -"jge" , JCC { txt = "JGE"; cond = X86NL }; -"jng" , JCC { txt = "JNG"; cond = X86NG }; -"jle" , JCC { txt = "JLE"; cond = X86NG }; -"jmp" , JMP { txt = "JMP" }; -"lea" , LEA { txt = "LEA"; sz = X86NONE }; -"leave" , LEAVE { txt = "LEAVE" }; -"loopo" , LOOP { txt = "LOOPO"; cond = X86O }; -"loopb" , LOOP { txt = "LOOPB"; cond = X86B }; -"loopc" , LOOP { txt = "LOOPC"; cond = X86B }; -"loopnae" , LOOP { txt = "LOOPNAE"; cond = X86B }; -"loope" , LOOP { txt = "LOOPE"; cond = X86E }; -"loopz" , LOOP { txt = "LOOPZ"; cond = X86E }; -"loopa" , LOOP { txt = "LOOPA"; cond = X86A }; -"loopnbe" , LOOP { txt = "LOOPNBE"; cond = X86A }; -"loops" , LOOP { txt = "LOOPS"; cond = X86S }; -"loopp" , LOOP { txt = "LOOPP"; cond = X86P }; -"looppe" , LOOP { txt = "LOOPPE"; cond = X86P }; -"loopl" , LOOP { txt = "LOOPL"; cond = X86L }; -"loopnge" , LOOP { txt = "LOOPNGE"; cond = X86L }; -"loopg" , LOOP { txt = "LOOPG"; cond = X86G }; -"loopnle" , LOOP { txt = "LOOPNLE"; cond = X86G }; -"loopno" , LOOP { txt = "LOOPNO"; cond = X86NO }; -"loopnb" , LOOP { txt = "LOOPNB"; cond = X86NB }; -"loopnc" , LOOP { txt = "LOOPNC"; cond = X86NB }; -"loopae" , LOOP { txt = "LOOPAE"; cond = X86NB }; -"loopne" , LOOP { txt = "LOOPNE"; cond = X86NE }; -"loopnz" , LOOP { txt = "LOOPNZ"; cond = X86NE }; -"loopna" , LOOP { txt = "LOOPNA"; cond = X86NA }; -"loopbe" , LOOP { txt = "LOOPBE"; cond = X86NA }; -"loopns" , LOOP { txt = "LOOPNS"; cond = X86NS }; -"loopnp" , LOOP { txt = "LOOPNP"; cond = X86NP }; -"looppo" , LOOP { txt = "LOOPPO"; cond = X86NP }; -"loopnl" , LOOP { txt = "LOOPNL"; cond = X86NL }; -"loopge" , LOOP { txt = "LOOPGE"; cond = X86NL }; -"loopng" , LOOP { txt = "LOOPNG"; cond = X86NG }; -"loople" , LOOP { txt = "LOOPLE"; cond = X86NG }; -"mfence" , MFENCE { txt = "MFENCE" }; -"dec" , MONOP { txt = "DEC"; op = X86DEC; sz = X86NONE }; -"inc" , MONOP { txt = "INC"; op = X86INC; sz = X86NONE }; -"not" , MONOP { txt = "NOT"; op = X86NOT; sz = X86NONE }; -"neg" , MONOP { txt = "NEG"; op = X86NEG; sz = X86NONE }; -"cmovo" , CMOV { txt = "CMOVO"; cond = X86O; sz = X86NONE }; -"cmovb" , CMOV { txt = "CMOVB"; cond = X86B; sz = X86NONE }; -"cmovc" , CMOV { txt = "CMOVC"; cond = X86B; sz = X86NONE }; -"cmovnae" , CMOV { txt = "CMOVNAE"; cond = X86B; sz = X86NONE }; -"cmove" , CMOV { txt = "CMOVE"; cond = X86E; sz = X86NONE }; -"cmovz" , CMOV { txt = "CMOVZ"; cond = X86E; sz = X86NONE }; -"cmova" , CMOV { txt = "CMOVA"; cond = X86A; sz = X86NONE }; -"cmovnbe" , CMOV { txt = "CMOVNBE"; cond = X86A; sz = X86NONE }; -"cmovs" , CMOV { txt = "CMOVS"; cond = X86S; sz = X86NONE }; -"cmovp" , CMOV { txt = "CMOVP"; cond = X86P; sz = X86NONE }; -"cmovpe" , CMOV { txt = "CMOVPE"; cond = X86P; sz = X86NONE }; -"cmovl" , CMOV { txt = "CMOVL"; cond = X86L; sz = X86NONE }; -"cmovnge" , CMOV { txt = "CMOVNGE"; cond = X86L; sz = X86NONE }; -"cmovg" , CMOV { txt = "CMOVG"; cond = X86G; sz = X86NONE }; -"cmovnle" , CMOV { txt = "CMOVNLE"; cond = X86G; sz = X86NONE }; -"cmovno" , CMOV { txt = "CMOVNO"; cond = X86NO; sz = X86NONE }; -"cmovnb" , CMOV { txt = "CMOVNB"; cond = X86NB; sz = X86NONE }; -"cmovnc" , CMOV { txt = "CMOVNC"; cond = X86NB; sz = X86NONE }; -"cmovae" , CMOV { txt = "CMOVAE"; cond = X86NB; sz = X86NONE }; -"cmovne" , CMOV { txt = "CMOVNE"; cond = X86NE; sz = X86NONE }; -"cmovnz" , CMOV { txt = "CMOVNZ"; cond = X86NE; sz = X86NONE }; -"cmovna" , CMOV { txt = "CMOVNA"; cond = X86NA; sz = X86NONE }; -"cmovbe" , CMOV { txt = "CMOVBE"; cond = X86NA; sz = X86NONE }; -"cmovns" , CMOV { txt = "CMOVNS"; cond = X86NS; sz = X86NONE }; -"cmovnp" , CMOV { txt = "CMOVNP"; cond = X86NP; sz = X86NONE }; -"cmovpo" , CMOV { txt = "CMOVPO"; cond = X86NP; sz = X86NONE }; -"cmovnl" , CMOV { txt = "CMOVNL"; cond = X86NL; sz = X86NONE }; -"cmovge" , CMOV { txt = "CMOVGE"; cond = X86NL; sz = X86NONE }; -"cmovng" , CMOV { txt = "CMOVNG"; cond = X86NG; sz = X86NONE }; -"cmovle" , CMOV { txt = "CMOVLE"; cond = X86NG; sz = X86NONE }; -"mov" , MOV { txt = "MOV"; sz = X86NONE }; -"movsx" , MOVSX { txt = "MOVSBW"; sz1 = X86NONE; sz2 = X86NONE }; -"movzx" , MOVZX { txt = "MOVZBW"; sz1 = X86NONE; sz2 = X86NONE }; -"mul" , MUL { txt = "MUL"; sz = X86NONE }; -"nop" , NOP { txt = "NOP" }; -"pop" , POP { txt = "POP" }; -"push" , PUSH { txt = "PUSH" }; -"ret" , PUSH { txt = "RET" }; -"seto" , SET { txt = "SETO"; cond = X86O }; -"setb" , SET { txt = "SETB"; cond = X86B }; -"setc" , SET { txt = "SETC"; cond = X86B }; -"setnae" , SET { txt = "SETNAE"; cond = X86B }; -"sete" , SET { txt = "SETE"; cond = X86E }; -"setz" , SET { txt = "SETZ"; cond = X86E }; -"seta" , SET { txt = "SETA"; cond = X86A }; -"setnbe" , SET { txt = "SETNBE"; cond = X86A }; -"sets" , SET { txt = "SETS"; cond = X86S }; -"setp" , SET { txt = "SETP"; cond = X86P }; -"setpe" , SET { txt = "SETPE"; cond = X86P }; -"setl" , SET { txt = "SETL"; cond = X86L }; -"setnge" , SET { txt = "SETNGE"; cond = X86L }; -"setg" , SET { txt = "SETG"; cond = X86G }; -"setnle" , SET { txt = "SETNLE"; cond = X86G }; -"setno" , SET { txt = "SETNO"; cond = X86NO }; -"setnb" , SET { txt = "SETNB"; cond = X86NB }; -"setnc" , SET { txt = "SETNC"; cond = X86NB }; -"setae" , SET { txt = "SETAE"; cond = X86NB }; -"setne" , SET { txt = "SETNE"; cond = X86NE }; -"setnz" , SET { txt = "SETNZ"; cond = X86NE }; -"setna" , SET { txt = "SETNA"; cond = X86NA }; -"setbe" , SET { txt = "SETBE"; cond = X86NA }; -"setns" , SET { txt = "SETNS"; cond = X86NS }; -"setnp" , SET { txt = "SETNP"; cond = X86NP }; -"setpo" , SET { txt = "SETPO"; cond = X86NP }; -"setnl" , SET { txt = "SETNL"; cond = X86NL }; -"setge" , SET { txt = "SETGE"; cond = X86NL }; -"setng" , SET { txt = "SETNG"; cond = X86NG }; -"setle" , SET { txt = "SETLE"; cond = X86NG }; -"stc" , STC { txt = "STC" }; -"xadd" , XADD { txt = "XADD"; sz = X86NONE }; -"xchg" , XCHG { txt = "XCHG"; sz = X86NONE }; diff --git a/x86/gen/map.hgen b/x86/gen/map.hgen deleted file mode 100644 index 843e8832..00000000 --- a/x86/gen/map.hgen +++ /dev/null @@ -1,26 +0,0 @@ -| `X86BINOP (locked, bop, sz, ds) -> `X86BINOP (locked, bop, sz, map_dest_src ds) -| `X86BITOP (locked, bop, sz, bo) -> `X86BITOP (locked, bop, sz, map_bit_offset bo) -| `X86CALL irm -> `X86CALL (map_imm_rm irm) -| `X86CLC -> `X86CLC -| `X86CMC -> `X86CMC -| `X86CMPXCHG (locked, sz, rm, r) -> `X86CMPXCHG (locked, sz, map_rm rm, map_reg r) -| `X86DIV (sz, rm) -> `X86DIV (sz, map_rm rm) -| `X86JCC x -> `X86JCC x -| `X86JMP rm -> `X86JMP (map_rm rm) -| `X86LEA (sz, ds) -> `X86LEA (sz, map_dest_src ds) -| `X86LEAVE -> `X86LEAVE -| `X86LOOP x -> `X86LOOP x -| `X86MFENCE -> `X86MFENCE -| `X86MONOP (locked, mop, sz, rm) -> `X86MONOP (locked, mop, sz, map_rm rm) -| `X86MOV (cnd, sz, ds) -> `X86MOV (cnd, sz, map_dest_src ds) -| `X86MOVSX (sz1, ds, sz2) -> `X86MOVSX (sz1, map_dest_src ds, sz2) -| `X86MOVZX (sz1, ds, sz2) -> `X86MOVZX (sz1, map_dest_src ds, sz2) -| `X86MUL (sz, rm) -> `X86MUL (sz, map_rm rm) -| `X86NOP -> `X86NOP -| `X86POP rm -> `X86POP (map_rm rm) -| `X86PUSH irm -> `X86PUSH (map_imm_rm irm) -| `X86RET i -> `X86RET i -| `X86SET (cnd, b, rm) -> `X86SET (cnd, b, map_rm rm) -| `X86STC -> `X86STC -| `X86XADD (locked, sz, rm, r) -> `X86XADD (locked, sz, map_rm rm, map_reg r) -| `X86XCHG (locked, sz, rm, r) -> `X86XCHG (locked, sz, map_rm rm, map_reg r) diff --git a/x86/gen/parser.hgen b/x86/gen/parser.hgen deleted file mode 100644 index b3c9dc72..00000000 --- a/x86/gen/parser.hgen +++ /dev/null @@ -1,600 +0,0 @@ -| BINOP imm COMMA addr - { `X86BINOP (false, $1.op, suffix_size $1.sz, Rm_i ($4, bit64_of_int $2)) } -| LOCK BINOP imm COMMA addr - { check_binop_lockable $2.op - ; `X86BINOP (true, $2.op, suffix_size $2.sz, Rm_i ($5, bit64_of_int $3)) } -| BINOP imm COMMA breg - { check_size ($1.sz, X86BYTE) - ; `X86BINOP (false, $1.op, X86S8 ($4.high), Rm_i (Reg (IReg ($4.reg)), bit64_of_int $2)) - } -| BINOP breg COMMA breg - { check_size ($1.sz, X86BYTE) - ; check_byte_regs ($2, $4) - ; `X86BINOP (false, $1.op, X86S8 ($4.high), Rm_r (Reg (IReg ($4.reg)), IReg ($2.reg))) - } -| BINOP addr COMMA breg - { check_size ($1.sz, X86BYTE) - ; `X86BINOP (false, $1.op, X86S8 ($4.high), R_rm (IReg ($4.reg), $2)) - } -| BINOP breg COMMA addr - { check_size ($1.sz, X86BYTE) - ; `X86BINOP (false, $1.op, X86S8 ($2.high), Rm_r ($4, IReg ($2.reg))) - } -| LOCK BINOP breg COMMA addr - { check_binop_lockable $2.op - ; check_size ($2.sz, X86BYTE) - ; `X86BINOP (true, $2.op, X86S8 ($3.high), Rm_r ($5, IReg ($3.reg))) - } -| BINOP imm COMMA wreg - { check_size ($1.sz, X86WORD) - ; `X86BINOP (false, $1.op, X86S16, Rm_i (Reg $4, bit64_of_int $2)) - } -| BINOP wreg COMMA wreg - { check_size ($1.sz, X86WORD) - ; `X86BINOP (false, $1.op, X86S16, Rm_r (Reg $4, $2)) - } -| BINOP addr COMMA wreg - { check_size ($1.sz, X86WORD) - ; `X86BINOP (false, $1.op, X86S16, R_rm ($4, $2)) - } -| BINOP wreg COMMA addr - { check_size ($1.sz, X86WORD) - ; `X86BINOP (false, $1.op, X86S16, Rm_r ($4, $2)) - } -| LOCK BINOP wreg COMMA addr - { check_binop_lockable $2.op - ; check_size ($2.sz, X86WORD) - ; `X86BINOP (true, $2.op, X86S16, Rm_r ($5, $3)) - } -| BINOP imm COMMA lreg - { check_size ($1.sz, X86LONG) - ; `X86BINOP (false, $1.op, X86S32, Rm_i (Reg $4, bit64_of_int $2)) - } -| BINOP lreg COMMA lreg - { check_size ($1.sz, X86LONG) - ; `X86BINOP (false, $1.op, X86S32, Rm_r (Reg $4, $2)) - } -| BINOP addr COMMA lreg - { check_size ($1.sz, X86LONG) - ; `X86BINOP (false, $1.op, X86S32, R_rm ($4, $2)) - } -| BINOP lreg COMMA addr - { check_size ($1.sz, X86LONG) - ; `X86BINOP (false, $1.op, X86S32, Rm_r ($4, $2)) - } -| LOCK BINOP lreg COMMA addr - { check_binop_lockable $2.op - ; check_size ($2.sz, X86LONG) - ; `X86BINOP (true, $2.op, X86S32, Rm_r ($5, $3)) - } -| BINOP imm COMMA qreg - { check_size ($1.sz, X86QUAD) - ; `X86BINOP (false, $1.op, X86S64, Rm_i (Reg $4, bit64_of_int $2)) - } -| BINOP qreg COMMA qreg - { check_size ($1.sz, X86QUAD) - ; `X86BINOP (false, $1.op, X86S64, Rm_r (Reg $4, $2)) - } -| BINOP addr COMMA qreg - { check_size ($1.sz, X86QUAD) - ; `X86BINOP (false, $1.op, X86S64, R_rm ($4, $2)) - } -| BINOP qreg COMMA addr - { check_size ($1.sz, X86QUAD) - ; `X86BINOP (false, $1.op, X86S64, Rm_r ($4, $2)) - } -| LOCK BINOP qreg COMMA addr - { check_binop_lockable $2.op - ; check_size ($2.sz, X86QUAD) - ; `X86BINOP (true, $2.op, X86S64, Rm_r ($5, $3)) - } -| BITOP imm COMMA addr - { `X86BITOP (false, $1.op, suffix_size $1.sz, Bit_rm_imm ($4, $2)) - } -| LOCK BITOP imm COMMA addr - { `X86BITOP (true, $2.op, suffix_size $2.sz, Bit_rm_imm ($5, $3)) - } -| BITOP imm COMMA wreg - { check_size ($1.sz, X86WORD) - ; `X86BITOP (false, $1.op, X86S16, Bit_rm_imm (Reg $4, $2)) - } -| LOCK BITOP imm COMMA wreg - { check_size ($2.sz, X86WORD) - ; `X86BITOP (true, $2.op, X86S16, Bit_rm_imm (Reg $5, $3)) - } -| BITOP wreg COMMA wreg - { check_size ($1.sz, X86WORD) - ; `X86BITOP (true, $1.op, X86S16, Bit_rm_r (Reg $4, $2)) - } -| LOCK BITOP wreg COMMA wreg - { check_size ($2.sz, X86WORD) - ; `X86BITOP (false, $2.op, X86S16, Bit_rm_r (Reg $5, $3)) - } -| BITOP wreg COMMA addr - { check_size ($1.sz, X86WORD) - ; `X86BITOP (false, $1.op, X86S16, Bit_rm_r ($4, $2)) - } -| LOCK BITOP wreg COMMA addr - { check_size ($2.sz, X86WORD) - ; `X86BITOP (true, $2.op, X86S16, Bit_rm_r ($5, $3)) - } -| BITOP imm COMMA lreg - { check_size ($1.sz, X86LONG) - ; `X86BITOP (false, $1.op, X86S32, Bit_rm_imm (Reg $4, $2)) - } -| LOCK BITOP imm COMMA lreg - { check_size ($2.sz, X86LONG) - ; `X86BITOP (true, $2.op, X86S32, Bit_rm_imm (Reg $5, $3)) - } -| BITOP lreg COMMA lreg - { check_size ($1.sz, X86LONG) - ; `X86BITOP (false, $1.op, X86S32, Bit_rm_r (Reg $4, $2)) - } -| LOCK BITOP lreg COMMA lreg - { check_size ($2.sz, X86LONG) - ; `X86BITOP (true, $2.op, X86S32, Bit_rm_r (Reg $5, $3)) - } -| BITOP lreg COMMA addr - { check_size ($1.sz, X86LONG) - ; `X86BITOP (false, $1.op, X86S32, Bit_rm_r ($4, $2)) - } -| LOCK BITOP lreg COMMA addr - { check_size ($2.sz, X86LONG) - ; `X86BITOP (true, $2.op, X86S32, Bit_rm_r ($5, $3)) - } -| BITOP imm COMMA qreg - { check_size ($1.sz, X86QUAD) - ; `X86BITOP (false, $1.op, X86S64, Bit_rm_imm (Reg $4, $2)) - } -| LOCK BITOP imm COMMA qreg - { check_size ($2.sz, X86QUAD) - ; `X86BITOP (true, $2.op, X86S64, Bit_rm_imm (Reg $5, $3)) - } -| BITOP qreg COMMA qreg - { check_size ($1.sz, X86QUAD) - ; `X86BITOP (false, $1.op, X86S64, Bit_rm_r (Reg $4, $2)) - } -| LOCK BITOP qreg COMMA qreg - { check_size ($2.sz, X86QUAD) - ; `X86BITOP (true, $2.op, X86S64, Bit_rm_r (Reg $5, $3)) - } -| BITOP qreg COMMA addr - { check_size ($1.sz, X86QUAD) - ; `X86BITOP (false, $1.op, X86S64, Bit_rm_r ($4, $2)) - } -| LOCK BITOP qreg COMMA addr - { check_size ($2.sz, X86QUAD) - ; `X86BITOP (true, $2.op, X86S64, Bit_rm_r ($5, $3)) - } -| CALL big_imm - { `X86CALL (Imm $2) } -| CALL addr - { `X86CALL (Rm $2) } -| CALL qreg - { `X86CALL (Rm (Reg $2)) } -| CLC - { `X86CLC } -| CMC - { `X86CMC } -| CMOV addr COMMA wreg - { check_size ($1.sz, X86WORD) - ; `X86MOV ($1.cond, X86S16, R_rm ($4, $2)) - } -| CMOV addr COMMA lreg - { check_size ($1.sz, X86LONG) - ; `X86MOV ($1.cond, X86S32, R_rm ($4, $2)) - } -| CMOV addr COMMA qreg - { check_size ($1.sz, X86QUAD) - ; `X86MOV ($1.cond, X86S64, R_rm ($4, $2)) - } -| CMOV wreg COMMA wreg - { check_size ($1.sz, X86WORD) - ; `X86MOV ($1.cond, X86S16, R_rm ($4, Reg $2)) - } -| CMOV lreg COMMA lreg - { check_size ($1.sz, X86LONG) - ; `X86MOV ($1.cond, X86S32, R_rm ($4, Reg $2)) - } -| CMOV qreg COMMA qreg - { check_size ($1.sz, X86QUAD) - ; `X86MOV ($1.cond, X86S64, R_rm ($4, Reg $2)) - } -| CMPXCHG breg COMMA breg - { check_size ($1.sz, X86BYTE) - ; check_byte_regs ($2, $4) - ; `X86CMPXCHG (false, X86S8 ($2.high), Reg (IReg ($4.reg)), IReg ($2.reg)) - } -| CMPXCHG breg COMMA addr - { check_size ($1.sz, X86BYTE) - ; `X86CMPXCHG (false, X86S8 ($2.high), $4, IReg ($2.reg)) - } -| LOCK CMPXCHG breg COMMA addr - { check_size ($2.sz, X86BYTE) - ; `X86CMPXCHG (true, X86S8 ($3.high), $5, IReg ($3.reg)) - } -| CMPXCHG wreg COMMA wreg - { check_size ($1.sz, X86WORD) - ; `X86CMPXCHG (false, X86S16, Reg $4, $2) - } -| CMPXCHG wreg COMMA addr - { check_size ($1.sz, X86WORD) - ; `X86CMPXCHG (false, X86S16, $4, $2) - } -| LOCK CMPXCHG wreg COMMA addr - { check_size ($2.sz, X86WORD) - ; `X86CMPXCHG (true, X86S16, $5, $3) - } -| CMPXCHG lreg COMMA lreg - { check_size ($1.sz, X86LONG) - ; `X86CMPXCHG (false, X86S32, Reg $4, $2) - } -| CMPXCHG lreg COMMA addr - { check_size ($1.sz, X86LONG) - ; `X86CMPXCHG (false, X86S32, $4, $2) - } -| LOCK CMPXCHG lreg COMMA addr - { check_size ($2.sz, X86LONG) - ; `X86CMPXCHG (true, X86S32, $5, $3) - } -| CMPXCHG qreg COMMA qreg - { check_size ($1.sz, X86QUAD) - ; `X86CMPXCHG (false, X86S64, Reg $4, $2) - } -| CMPXCHG qreg COMMA addr - { check_size ($1.sz, X86QUAD) - ; `X86CMPXCHG (false, X86S64, $4, $2) - } -| LOCK CMPXCHG qreg COMMA addr - { check_size ($2.sz, X86QUAD) - ; `X86CMPXCHG (true, X86S64, $5, $3) - } -| DIV addr - { `X86DIV (suffix_size $1.sz, $2) } -| DIV breg - { check_size ($1.sz, X86BYTE) - ; `X86DIV (X86S8 ($2.high), Reg (IReg ($2.reg))) - } -| DIV wreg - { check_size ($1.sz, X86WORD) - ; `X86DIV (X86S16, Reg $2) - } -| DIV lreg - { check_size ($1.sz, X86LONG) - ; `X86DIV (X86S32, Reg $2) - } -| DIV qreg - { check_size ($1.sz, X86QUAD) - ; `X86DIV (X86S64, Reg $2) - } -| JCC big_num - { `X86JCC ($1.cond, $2) } -| JMP big_num - { `X86JCC (X86ALWAYS, $2) } -| JMP addr - { `X86JMP $2 } -| JMP qreg - { `X86JMP (Reg $2) } -| LEA addr COMMA wreg - { check_size ($1.sz, X86WORD) - ; `X86LEA (X86S16, R_rm ($4, $2)) - } -| LEA addr COMMA lreg - { check_size ($1.sz, X86LONG) - ; `X86LEA (X86S32, R_rm ($4, $2)) - } -| LEA addr COMMA qreg - { check_size ($1.sz, X86QUAD) - ; `X86LEA (X86S64, R_rm ($4, $2)) - } -| LEAVE - { `X86LEAVE } -| LOOP big_num - { `X86LOOP ($1.cond, $2) } -| MFENCE - { `X86MFENCE } -| MONOP addr - { `X86MONOP (false, $1.op, suffix_size $1.sz, $2) } -| LOCK MONOP addr - { `X86MONOP (true, $2.op, suffix_size $2.sz, $3) } -| MONOP breg - { check_size ($1.sz, X86BYTE) - ; `X86MONOP (false, $1.op, X86S8 ($2.high), Reg (IReg $2.reg)) - } -| MONOP wreg - { check_size ($1.sz, X86WORD) - ; `X86MONOP (false, $1.op, X86S16, Reg $2) - } -| MONOP lreg - { check_size ($1.sz, X86LONG) - ; `X86MONOP (false, $1.op, X86S32, Reg $2) - } -| MONOP qreg - { check_size ($1.sz, X86QUAD) - ; `X86MONOP (false, $1.op, X86S64, Reg $2) - } -| MOV big_imm COMMA addr - { `X86MOV (X86ALWAYS, suffix_size $1.sz, Rm_i ($4, $2)) } -| MOV imm COMMA breg - { check_size ($1.sz, X86BYTE) - ; `X86MOV (X86ALWAYS, X86S8 ($4.high), Rm_i (Reg (IReg $4.reg), bit64_of_int $2)) - } -| MOV breg COMMA breg - { check_size ($1.sz, X86BYTE) - ; check_byte_regs ($2, $4) - ; `X86MOV (X86ALWAYS, X86S8 ($4.high), Rm_r (Reg (IReg $4.reg), (IReg $2.reg))) - } -| MOV addr COMMA breg - { check_size ($1.sz, X86BYTE) - ; `X86MOV (X86ALWAYS, X86S8 ($4.high), R_rm (IReg $4.reg, $2)) - } -| MOV breg COMMA addr - { check_size ($1.sz, X86BYTE) - ; `X86MOV (X86ALWAYS, X86S8 ($2.high), Rm_r ($4, IReg $2.reg)) - } -| MOV imm COMMA wreg - { check_size ($1.sz, X86WORD) - ; `X86MOV (X86ALWAYS, X86S16, Rm_i (Reg $4, bit64_of_int $2)) - } -| MOV wreg COMMA wreg - { check_size ($1.sz, X86WORD) - ; `X86MOV (X86ALWAYS, X86S16, Rm_r (Reg $4, $2)) - } -| MOV addr COMMA wreg - { check_size ($1.sz, X86WORD) - ; `X86MOV (X86ALWAYS, X86S16, R_rm ($4, $2)) - } -| MOV wreg COMMA addr - { check_size ($1.sz, X86WORD) - ; `X86MOV (X86ALWAYS, X86S16, Rm_r ($4, $2)) - } -| MOV imm COMMA lreg - { check_size ($1.sz, X86LONG) - ; `X86MOV (X86ALWAYS, X86S32, Rm_i (Reg $4, bit64_of_int $2)) - } -| MOV lreg COMMA lreg - { check_size ($1.sz, X86LONG) - ; `X86MOV (X86ALWAYS, X86S32, Rm_r (Reg $4, $2)) - } -| MOV addr COMMA lreg - { check_size ($1.sz, X86LONG) - ; `X86MOV (X86ALWAYS, X86S32, R_rm ($4, $2)) - } -| MOV lreg COMMA addr - { check_size ($1.sz, X86LONG) - ; `X86MOV (X86ALWAYS, X86S32, Rm_r ($4, $2)) - } -| MOV big_imm COMMA qreg - { check_size ($1.sz, X86QUAD) - ; `X86MOV (X86ALWAYS, X86S64, Rm_i (Reg $4, $2)) - } -| MOV qreg COMMA qreg - { check_size ($1.sz, X86QUAD) - ; if $1.txt = "MOVABS" then failwith "movabs expects and immediate" else () - ; `X86MOV (X86ALWAYS, X86S64, Rm_r (Reg $4, $2)) - } -| MOV addr COMMA qreg - { check_size ($1.sz, X86QUAD) - ; if $1.txt = "MOVABS" then failwith "movabs expects and immediate" else () - ; `X86MOV (X86ALWAYS, X86S64, R_rm ($4, $2)) - } -| MOV qreg COMMA addr - { check_size ($1.sz, X86QUAD) - ; if $1.txt = "MOVABS" then failwith "movabs expects and immediate" else () - ; `X86MOV (X86ALWAYS, X86S64, Rm_r ($4, $2)) - } -| MOVSX breg COMMA wreg - { check_size ($1.sz1, X86BYTE) - ; check_size ($1.sz2, X86WORD) - ; `X86MOVSX (X86S16, R_rm ($4, Reg (IReg $2.reg)), X86S8 $2.high) - } -| MOVSX breg COMMA lreg - { check_size ($1.sz1, X86BYTE) - ; check_size ($1.sz2, X86LONG) - ; `X86MOVSX (X86S32, R_rm ($4, Reg (IReg $2.reg)), X86S8 $2.high) - } -| MOVSX breg COMMA qreg - { check_size ($1.sz1, X86BYTE) - ; check_size ($1.sz2, X86QUAD) - ; `X86MOVSX (X86S64, R_rm ($4, Reg (IReg $2.reg)), X86S8 $2.high) - } -| MOVSX wreg COMMA lreg - { check_size ($1.sz1, X86WORD) - ; check_size ($1.sz2, X86LONG) - ; `X86MOVSX (X86S32, R_rm ($4, Reg $2), X86S16) - } -| MOVSX wreg COMMA qreg - { check_size ($1.sz1, X86WORD) - ; check_size ($1.sz2, X86QUAD) - ; `X86MOVSX (X86S64, R_rm ($4, Reg $2), X86S16) - } -| MOVSX lreg COMMA qreg - { check_size ($1.sz1, X86LONG) - ; check_size ($1.sz2, X86QUAD) - ; `X86MOVSX (X86S64, R_rm ($4, Reg $2), X86S32) - } -| MOVSX addr COMMA wreg - { check_size ($1.sz2, X86WORD) - ; `X86MOVSX (X86S16, R_rm ($4, $2), suffix_size $1.sz1) - } -| MOVSX addr COMMA lreg - { check_size ($1.sz2, X86LONG) - ; `X86MOVSX (X86S32, R_rm ($4, $2), suffix_size $1.sz1) - } -| MOVSX addr COMMA qreg - { check_size ($1.sz2, X86QUAD) - ; `X86MOVSX (X86S64, R_rm ($4, $2), suffix_size $1.sz1) - } -| MOVZX breg COMMA wreg - { check_size ($1.sz1, X86BYTE) - ; check_size ($1.sz2, X86WORD) - ; `X86MOVZX (X86S16, R_rm ($4, Reg (IReg $2.reg)), X86S8 $2.high) - } -| MOVZX breg COMMA lreg - { check_size ($1.sz1, X86BYTE) - ; check_size ($1.sz2, X86LONG) - ; `X86MOVZX (X86S32, R_rm ($4, Reg (IReg $2.reg)), X86S8 $2.high) - } -| MOVZX breg COMMA qreg - { check_size ($1.sz1, X86BYTE) - ; check_size ($1.sz2, X86QUAD) - ; `X86MOVZX (X86S64, R_rm ($4, Reg (IReg $2.reg)), X86S8 $2.high) - } -| MOVZX wreg COMMA lreg - { check_size ($1.sz1, X86WORD) - ; check_size ($1.sz2, X86LONG) - ; `X86MOVZX (X86S32, R_rm ($4, Reg $2), X86S16) - } -| MOVZX wreg COMMA qreg - { check_size ($1.sz1, X86WORD) - ; check_size ($1.sz2, X86QUAD) - ; `X86MOVZX (X86S64, R_rm ($4, Reg $2), X86S16) - } -| MOVZX addr COMMA wreg - { check_size ($1.sz2, X86WORD) - ; `X86MOVZX (X86S16, R_rm ($4, $2), suffix_size $1.sz1) - } -| MOVZX addr COMMA lreg - { check_size ($1.sz2, X86LONG) - ; `X86MOVZX (X86S32, R_rm ($4, $2), suffix_size $1.sz1) - } -| MOVZX addr COMMA qreg - { check_size ($1.sz2, X86QUAD) - ; `X86MOVZX (X86S64, R_rm ($4, $2), suffix_size $1.sz1) - } -| MUL addr - { `X86MUL (suffix_size $1.sz, $2) } -| MUL breg - { check_size ($1.sz, X86BYTE) - ; `X86MUL (X86S8 ($2.high), Reg (IReg $2.reg)) - } -| MUL wreg - { check_size ($1.sz, X86WORD) - ; `X86MUL (X86S16, Reg $2) - } -| MUL lreg - { check_size ($1.sz, X86LONG) - ; `X86MUL (X86S32, Reg $2) - } -| MUL qreg - { check_size ($1.sz, X86QUAD) - ; `X86MUL (X86S64, Reg $2) - } -| NOP - { `X86NOP } -| POP qreg - { `X86POP (Reg $2) } -| POP addr - { `X86POP $2 } -| PUSH big_imm - { `X86PUSH (Imm $2) } -| PUSH addr - { `X86PUSH (Rm $2) } -| PUSH qreg - { `X86PUSH (Rm (Reg $2)) } -| RET big_imm - { `X86RET $2 } -| SET breg - { `X86SET ($1.cond, $2.high, Reg (IReg $2.reg)) } -| SET addr - { `X86SET ($1.cond, false, $2) } -| STC - { `X86STC } -| XADD breg COMMA breg - { check_size ($1.sz, X86BYTE) - ; check_byte_regs ($2, $4) - ; `X86XADD (false, X86S8 ($2.high), Reg (IReg $4.reg), (IReg $2.reg)) - } -| XADD breg COMMA addr - { check_size ($1.sz, X86BYTE) - ; `X86XADD (false, X86S8 ($2.high), $4, (IReg $2.reg)) - } -| LOCK XADD breg COMMA addr - { check_size ($2.sz, X86BYTE) - ; `X86XADD (true, X86S8 ($3.high), $5, (IReg $3.reg)) - } -| XADD wreg COMMA wreg - { check_size ($1.sz, X86WORD) - ; `X86XADD (false, X86S16, Reg $4, $2) - } -| XADD wreg COMMA addr - { check_size ($1.sz, X86WORD) - ; `X86XADD (false, X86S16, $4, $2) - } -| LOCK XADD wreg COMMA addr - { check_size ($2.sz, X86WORD) - ; `X86XADD (true, X86S16, $5, $3) - } -| XADD lreg COMMA lreg - { check_size ($1.sz, X86LONG) - ; `X86XADD (false, X86S32, Reg $4, $2) - } -| XADD lreg COMMA addr - { check_size ($1.sz, X86LONG) - ; `X86XADD (false, X86S32, $4, $2) - } -| LOCK XADD lreg COMMA addr - { check_size ($2.sz, X86LONG) - ; `X86XADD (true, X86S32, $5, $3) - } -| XADD qreg COMMA qreg - { check_size ($1.sz, X86QUAD) - ; `X86XADD (false, X86S64, Reg $4, $2) - } -| XADD qreg COMMA addr - { check_size ($1.sz, X86QUAD) - ; `X86XADD (false, X86S64, $4, $2) - } -| LOCK XADD qreg COMMA addr - { check_size ($2.sz, X86QUAD) - ; `X86XADD (true, X86S64, $5, $3) - } -| XCHG breg COMMA breg - { check_size ($1.sz, X86BYTE) - ; check_byte_regs ($2, $4) - ; `X86XCHG (false, X86S8 ($2.high), Reg (IReg $4.reg), IReg $2.reg) - } -| XCHG breg COMMA addr - { check_size ($1.sz, X86BYTE) - ; `X86XCHG (false, X86S8 ($2.high), $4, (IReg $2.reg)) - } -| LOCK XCHG breg COMMA addr - { check_size ($2.sz, X86BYTE) - ; `X86XCHG (true, X86S8 ($3.high), $5, (IReg $3.reg)) - } -| XCHG wreg COMMA wreg - { check_size ($1.sz, X86WORD) - ; `X86XCHG (false, X86S16, Reg $4, $2) - } -| XCHG wreg COMMA addr - { check_size ($1.sz, X86WORD) - ; `X86XCHG (false, X86S16, $4, $2) - } -| LOCK XCHG wreg COMMA addr - { check_size ($2.sz, X86WORD) - ; `X86XCHG (true, X86S16, $5, $3) - } -| XCHG lreg COMMA lreg - { check_size ($1.sz, X86LONG) - ; `X86XCHG (false, X86S32, Reg $4, $2) - } -| XCHG lreg COMMA addr - { check_size ($1.sz, X86LONG) - ; `X86XCHG (false, X86S32, $4, $2) - } -| LOCK XCHG lreg COMMA addr - { check_size ($2.sz, X86LONG) - ; `X86XCHG (true, X86S32, $5, $3) - } -| XCHG qreg COMMA qreg - { check_size ($1.sz, X86QUAD) - ; `X86XCHG (false, X86S64, Reg $4, $2) - } -| XCHG qreg COMMA addr - { check_size ($1.sz, X86QUAD) - ; `X86XCHG (false, X86S64, $4, $2) - } -| LOCK XCHG qreg COMMA addr - { check_size ($2.sz, X86QUAD) - ; `X86XCHG (true, X86S64, $5, $3) - } diff --git a/x86/gen/parser_intel.hgen b/x86/gen/parser_intel.hgen deleted file mode 100644 index 72fa0ede..00000000 --- a/x86/gen/parser_intel.hgen +++ /dev/null @@ -1,601 +0,0 @@ -| BINOP addr COMMA imm - { `X86BINOP (false, $1.op, suffix_size $1.sz, Rm_i ($2, bit64_of_int $4)) - (* XXX size is ambigious -- should require anotation *) } -| LOCK BINOP addr COMMA imm - { check_binop_lockable $2.op - ; `X86BINOP (true, $2.op, suffix_size $2.sz, Rm_i ($3, bit64_of_int $5)) } -| BINOP breg COMMA imm - { check_size ($1.sz, X86BYTE) - ; `X86BINOP (false, $1.op, X86S8 ($2.high), Rm_i (Reg (IReg ($2.reg)), bit64_of_int $4)) - } -| BINOP breg COMMA breg - { check_size ($1.sz, X86BYTE) - ; check_byte_regs ($2, $4) - ; `X86BINOP (false, $1.op, X86S8 ($2.high), Rm_r (Reg (IReg ($2.reg)), IReg ($4.reg))) - } -| BINOP addr COMMA breg - { check_size ($1.sz, X86BYTE) - ; `X86BINOP (false, $1.op, X86S8 ($4.high), Rm_r ($2, IReg ($4.reg))) - } -| LOCK BINOP addr COMMA breg - { check_binop_lockable $2.op; - check_size ($2.sz, X86BYTE) - ; `X86BINOP (true, $2.op, X86S8 ($5.high), Rm_r ($3, IReg ($5.reg))) - } -| BINOP breg COMMA addr - { check_size ($1.sz, X86BYTE) - ; `X86BINOP (false, $1.op, X86S8 ($2.high), R_rm (IReg ($2.reg), $4)) - } -| BINOP wreg COMMA imm - { check_size ($1.sz, X86WORD) - ; `X86BINOP (false, $1.op, X86S16, Rm_i (Reg $2, bit64_of_int $4)) - } -| BINOP wreg COMMA wreg - { check_size ($1.sz, X86WORD) - ; `X86BINOP (false, $1.op, X86S16, Rm_r (Reg $2, $4)) - } -| BINOP addr COMMA wreg - { check_size ($1.sz, X86WORD) - ; `X86BINOP (false, $1.op, X86S16, Rm_r ($2, $4)) - } -| LOCK BINOP addr COMMA wreg - { check_binop_lockable $2.op; - check_size ($2.sz, X86WORD) - ; `X86BINOP (true, $2.op, X86S16, Rm_r ($3, $5)) - } -| BINOP wreg COMMA addr - { check_size ($1.sz, X86WORD) - ; `X86BINOP (false, $1.op, X86S16, R_rm ($2, $4)) - } -| BINOP lreg COMMA imm - { check_size ($1.sz, X86LONG) - ; `X86BINOP (false, $1.op, X86S32, Rm_i (Reg $2, bit64_of_int $4)) - } -| BINOP lreg COMMA lreg - { check_size ($1.sz, X86LONG) - ; `X86BINOP (false, $1.op, X86S32, Rm_r (Reg $2, $4)) - } -| BINOP addr COMMA lreg - { check_size ($1.sz, X86LONG) - ; `X86BINOP (false, $1.op, X86S32, Rm_r ($2, $4)) - } -| LOCK BINOP addr COMMA lreg - { check_binop_lockable $2.op; - check_size ($2.sz, X86LONG) - ; `X86BINOP (true, $2.op, X86S32, Rm_r ($3, $5)) - } -| BINOP lreg COMMA addr - { check_size ($1.sz, X86LONG) - ; `X86BINOP (false, $1.op, X86S32, R_rm ($2, $4)) - } -| BINOP qreg COMMA imm - { check_size ($1.sz, X86QUAD) - ; `X86BINOP (false, $1.op, X86S64, Rm_i (Reg $2, bit64_of_int $4)) - } -| BINOP qreg COMMA qreg - { check_size ($1.sz, X86QUAD) - ; `X86BINOP (false, $1.op, X86S64, Rm_r (Reg $2, $4)) - } -| BINOP addr COMMA qreg - { check_size ($1.sz, X86QUAD) - ; `X86BINOP (false, $1.op, X86S64, Rm_r ($2, $4)) - } -| LOCK BINOP addr COMMA qreg - { check_binop_lockable $2.op; - check_size ($2.sz, X86QUAD) - ; `X86BINOP (true, $2.op, X86S64, Rm_r ($3, $5)) - } -| BINOP qreg COMMA addr - { check_size ($1.sz, X86QUAD) - ; `X86BINOP (false, $1.op, X86S64, R_rm ($2, $4)) - } -| BITOP addr COMMA imm - { `X86BITOP (false, $1.op, suffix_size $1.sz, Bit_rm_imm ($2, $4)) - } -| LOCK BITOP addr COMMA imm - { `X86BITOP (true, $2.op, suffix_size $2.sz, Bit_rm_imm ($3, $5)) - } -| BITOP wreg COMMA imm - { check_size ($1.sz, X86WORD) - ; `X86BITOP (false, $1.op, X86S16, Bit_rm_imm (Reg $2, $4)) - } -| LOCK BITOP wreg COMMA imm - { check_size ($2.sz, X86WORD) - ; `X86BITOP (true, $2.op, X86S16, Bit_rm_imm (Reg $3, $5)) - } -| BITOP wreg COMMA wreg - { check_size ($1.sz, X86WORD) - ; `X86BITOP (true, $1.op, X86S16, Bit_rm_r (Reg $2, $4)) - } -| LOCK BITOP wreg COMMA wreg - { check_size ($2.sz, X86WORD) - ; `X86BITOP (false, $2.op, X86S16, Bit_rm_r (Reg $3, $5)) - } -| BITOP addr COMMA wreg - { check_size ($1.sz, X86WORD) - ; `X86BITOP (false, $1.op, X86S16, Bit_rm_r ($2, $4)) - } -| LOCK BITOP addr COMMA wreg - { check_size ($2.sz, X86WORD) - ; `X86BITOP (true, $2.op, X86S16, Bit_rm_r ($3, $5)) - } -| BITOP lreg COMMA imm - { check_size ($1.sz, X86LONG) - ; `X86BITOP (false, $1.op, X86S32, Bit_rm_imm (Reg $2, $4)) - } -| LOCK BITOP lreg COMMA imm - { check_size ($2.sz, X86LONG) - ; `X86BITOP (true, $2.op, X86S32, Bit_rm_imm (Reg $3, $5)) - } -| BITOP lreg COMMA lreg - { check_size ($1.sz, X86LONG) - ; `X86BITOP (false, $1.op, X86S32, Bit_rm_r (Reg $2, $4)) - } -| LOCK BITOP lreg COMMA lreg - { check_size ($2.sz, X86LONG) - ; `X86BITOP (true, $2.op, X86S32, Bit_rm_r (Reg $3, $5)) - } -| BITOP addr COMMA lreg - { check_size ($1.sz, X86LONG) - ; `X86BITOP (false, $1.op, X86S32, Bit_rm_r ($2, $4)) - } -| LOCK BITOP addr COMMA lreg - { check_size ($2.sz, X86LONG) - ; `X86BITOP (true, $2.op, X86S32, Bit_rm_r ($3, $5)) - } -| BITOP qreg COMMA imm - { check_size ($1.sz, X86QUAD) - ; `X86BITOP (false, $1.op, X86S64, Bit_rm_imm (Reg $2, $4)) - } -| LOCK BITOP qreg COMMA imm - { check_size ($2.sz, X86QUAD) - ; `X86BITOP (true, $2.op, X86S64, Bit_rm_imm (Reg $3, $5)) - } -| BITOP qreg COMMA qreg - { check_size ($1.sz, X86QUAD) - ; `X86BITOP (false, $1.op, X86S64, Bit_rm_r (Reg $2, $4)) - } -| LOCK BITOP qreg COMMA qreg - { check_size ($2.sz, X86QUAD) - ; `X86BITOP (true, $2.op, X86S64, Bit_rm_r (Reg $3, $5)) - } -| BITOP addr COMMA qreg - { check_size ($1.sz, X86QUAD) - ; `X86BITOP (false, $1.op, X86S64, Bit_rm_r ($2, $4)) - } -| LOCK BITOP addr COMMA qreg - { check_size ($2.sz, X86QUAD) - ; `X86BITOP (true, $2.op, X86S64, Bit_rm_r ($3, $5)) - } -| CALL big_imm - { `X86CALL (Imm $2) } -| CALL addr - { `X86CALL (Rm $2) } -| CALL qreg - { `X86CALL (Rm (Reg $2)) } -| CLC - { `X86CLC } -| CMC - { `X86CMC } -| CMOV wreg COMMA addr - { check_size ($1.sz, X86WORD) - ; `X86MOV ($1.cond, X86S16, R_rm ($2, $4)) - } -| CMOV lreg COMMA addr - { check_size ($1.sz, X86LONG) - ; `X86MOV ($1.cond, X86S32, R_rm ($2, $4)) - } -| CMOV qreg COMMA addr - { check_size ($1.sz, X86QUAD) - ; `X86MOV ($1.cond, X86S64, R_rm ($2, $4)) - } -| CMOV wreg COMMA wreg - { check_size ($1.sz, X86WORD) - ; `X86MOV ($1.cond, X86S16, R_rm ($2, Reg $4)) - } -| CMOV lreg COMMA lreg - { check_size ($1.sz, X86LONG) - ; `X86MOV ($1.cond, X86S32, R_rm ($2, Reg $4)) - } -| CMOV qreg COMMA qreg - { check_size ($1.sz, X86QUAD) - ; `X86MOV ($1.cond, X86S64, R_rm ($2, Reg $4)) - } -| CMPXCHG breg COMMA breg - { check_size ($1.sz, X86BYTE) - ; check_byte_regs ($2, $4) - ; `X86CMPXCHG (false, X86S8 ($2.high), Reg (IReg ($2.reg)), IReg ($4.reg)) - } -| CMPXCHG addr COMMA breg - { check_size ($1.sz, X86BYTE) - ; `X86CMPXCHG (false, X86S8 ($4.high), $2, IReg ($4.reg)) - } -| LOCK CMPXCHG addr COMMA breg - { check_size ($2.sz, X86BYTE) - ; `X86CMPXCHG (true, X86S8 ($5.high), $3, IReg ($5.reg)) - } -| CMPXCHG wreg COMMA wreg - { check_size ($1.sz, X86WORD) - ; `X86CMPXCHG (false, X86S16, Reg $2, $4) - } -| CMPXCHG addr COMMA wreg - { check_size ($1.sz, X86WORD) - ; `X86CMPXCHG (false, X86S16, $2, $4) - } -| LOCK CMPXCHG addr COMMA wreg - { check_size ($2.sz, X86WORD) - ; `X86CMPXCHG (true, X86S16, $3, $5) - } -| CMPXCHG lreg COMMA lreg - { check_size ($1.sz, X86LONG) - ; `X86CMPXCHG (false, X86S32, Reg $2, $4) - } -| CMPXCHG addr COMMA lreg - { check_size ($1.sz, X86LONG) - ; `X86CMPXCHG (false, X86S32, $2, $4) - } -| LOCK CMPXCHG addr COMMA lreg - { check_size ($2.sz, X86LONG) - ; `X86CMPXCHG (true, X86S32, $3, $5) - } -| CMPXCHG qreg COMMA qreg - { check_size ($1.sz, X86QUAD) - ; `X86CMPXCHG (false, X86S64, Reg $2, $4) - } -| CMPXCHG addr COMMA qreg - { check_size ($1.sz, X86QUAD) - ; `X86CMPXCHG (false, X86S64, $2, $4) - } -| LOCK CMPXCHG addr COMMA qreg - { check_size ($2.sz, X86QUAD) - ; `X86CMPXCHG (true, X86S64, $3, $5) - } -| DIV addr - { `X86DIV (suffix_size $1.sz, $2) } -| DIV breg - { check_size ($1.sz, X86BYTE) - ; `X86DIV (X86S8 ($2.high), Reg (IReg ($2.reg))) - } -| DIV wreg - { check_size ($1.sz, X86WORD) - ; `X86DIV (X86S16, Reg $2) - } -| DIV lreg - { check_size ($1.sz, X86LONG) - ; `X86DIV (X86S32, Reg $2) - } -| DIV qreg - { check_size ($1.sz, X86QUAD) - ; `X86DIV (X86S64, Reg $2) - } -| JCC big_num - { `X86JCC ($1.cond, $2) } -| JMP big_num - { `X86JCC (X86ALWAYS, $2) } -| JMP addr - { `X86JMP $2 } -| JMP qreg - { `X86JMP (Reg $2) } -| LEA wreg COMMA addr - { check_size ($1.sz, X86WORD) - ; `X86LEA (X86S16, R_rm ($2, $4)) - } -| LEA lreg COMMA addr - { check_size ($1.sz, X86LONG) - ; `X86LEA (X86S32, R_rm ($2, $4)) - } -| LEA qreg COMMA addr - { check_size ($1.sz, X86QUAD) - ; `X86LEA (X86S64, R_rm ($2, $4)) - } -| LEAVE - { `X86LEAVE } -| LOOP big_num - { `X86LOOP ($1.cond, $2) } -| MFENCE - { `X86MFENCE } -| MONOP addr - { `X86MONOP (false, $1.op, suffix_size $1.sz, $2) } -| LOCK MONOP addr - { `X86MONOP (true, $2.op, suffix_size $2.sz, $3) } -| MONOP breg - { check_size ($1.sz, X86BYTE) - ; `X86MONOP (false, $1.op, X86S8 ($2.high), Reg (IReg $2.reg)) - } -| MONOP wreg - { check_size ($1.sz, X86WORD) - ; `X86MONOP (false, $1.op, X86S16, Reg $2) - } -| MONOP lreg - { check_size ($1.sz, X86LONG) - ; `X86MONOP (false, $1.op, X86S32, Reg $2) - } -| MONOP qreg - { check_size ($1.sz, X86QUAD) - ; `X86MONOP (false, $1.op, X86S64, Reg $2) - } -| MOV addr COMMA big_imm - { `X86MOV (X86ALWAYS, suffix_size $1.sz, Rm_i ($2, $4)) } -| MOV breg COMMA imm - { check_size ($1.sz, X86BYTE) - ; `X86MOV (X86ALWAYS, X86S8 ($2.high), Rm_i (Reg (IReg $2.reg), bit64_of_int $4)) - } -| MOV breg COMMA breg - { check_size ($1.sz, X86BYTE) - ; check_byte_regs ($2, $4) - ; `X86MOV (X86ALWAYS, X86S8 ($2.high), Rm_r (Reg (IReg $2.reg), (IReg $4.reg))) - } -| MOV addr COMMA breg - { check_size ($1.sz, X86BYTE) - ; `X86MOV (X86ALWAYS, X86S8 ($4.high), Rm_r ($2, IReg $4.reg)) - } -| MOV breg COMMA addr - { check_size ($1.sz, X86BYTE) - ; `X86MOV (X86ALWAYS, X86S8 ($2.high), R_rm (IReg $2.reg, $4)) - } -| MOV wreg COMMA imm - { check_size ($1.sz, X86WORD) - ; `X86MOV (X86ALWAYS, X86S16, Rm_i (Reg $2, bit64_of_int $4)) - } -| MOV wreg COMMA wreg - { check_size ($1.sz, X86WORD) - ; `X86MOV (X86ALWAYS, X86S16, Rm_r (Reg $2, $4)) - } -| MOV addr COMMA wreg - { check_size ($1.sz, X86WORD) - ; `X86MOV (X86ALWAYS, X86S16, Rm_r ($2, $4)) - } -| MOV wreg COMMA addr - { check_size ($1.sz, X86WORD) - ; `X86MOV (X86ALWAYS, X86S16, R_rm ($2, $4)) - } -| MOV lreg COMMA imm - { check_size ($1.sz, X86LONG) - ; `X86MOV (X86ALWAYS, X86S32, Rm_i (Reg $2, bit64_of_int $4)) - } -| MOV lreg COMMA lreg - { check_size ($1.sz, X86LONG) - ; `X86MOV (X86ALWAYS, X86S32, Rm_r (Reg $2, $4)) - } -| MOV addr COMMA lreg - { check_size ($1.sz, X86LONG) - ; `X86MOV (X86ALWAYS, X86S32, Rm_r ($2, $4)) - } -| MOV lreg COMMA addr - { check_size ($1.sz, X86LONG) - ; `X86MOV (X86ALWAYS, X86S32, R_rm ($2, $4)) - } -| MOV qreg COMMA big_imm - { check_size ($1.sz, X86QUAD) - ; `X86MOV (X86ALWAYS, X86S64, Rm_i (Reg $2, $4)) - } -| MOV qreg COMMA qreg - { check_size ($1.sz, X86QUAD) - ; if $1.txt = "MOVABS" then failwith "movabs expects an immediate" else () - ; `X86MOV (X86ALWAYS, X86S64, Rm_r (Reg $2, $4)) - } -| MOV addr COMMA qreg - { check_size ($1.sz, X86QUAD) - ; if $1.txt = "MOVABS" then failwith "movabs expects an immediate" else () - ; `X86MOV (X86ALWAYS, X86S64, Rm_r ($2, $4)) - } -| MOV qreg COMMA addr - { check_size ($1.sz, X86QUAD) - ; if $1.txt = "MOVABS" then failwith "movabs expects an immediate" else () - ; `X86MOV (X86ALWAYS, X86S64, R_rm ($2, $4)) - } -| MOVSX wreg COMMA breg - { check_size ($1.sz1, X86BYTE) - ; check_size ($1.sz2, X86WORD) - ; `X86MOVSX (X86S16, R_rm ($2, Reg (IReg $4.reg)), X86S8 $4.high) - } -| MOVSX lreg COMMA breg - { check_size ($1.sz1, X86BYTE) - ; check_size ($1.sz2, X86LONG) - ; `X86MOVSX (X86S32, R_rm ($2, Reg (IReg $4.reg)), X86S8 $4.high) - } -| MOVSX qreg COMMA breg - { check_size ($1.sz1, X86BYTE) - ; check_size ($1.sz2, X86QUAD) - ; `X86MOVSX (X86S64, R_rm ($2, Reg (IReg $4.reg)), X86S8 $4.high) - } -| MOVSX lreg COMMA wreg - { check_size ($1.sz1, X86WORD) - ; check_size ($1.sz2, X86LONG) - ; `X86MOVSX (X86S32, R_rm ($2, Reg $4), X86S16) - } -| MOVSX qreg COMMA wreg - { check_size ($1.sz1, X86WORD) - ; check_size ($1.sz2, X86QUAD) - ; `X86MOVSX (X86S64, R_rm ($2, Reg $4), X86S16) - } -| MOVSX qreg COMMA lreg - { check_size ($1.sz1, X86LONG) - ; check_size ($1.sz2, X86QUAD) - ; `X86MOVSX (X86S64, R_rm ($2, Reg $4), X86S32) - } -| MOVSX wreg COMMA addr - { check_size ($1.sz2, X86WORD) - ; `X86MOVSX (X86S16, R_rm ($2, $4), suffix_size $1.sz1) (* XXX size *) - } -| MOVSX lreg COMMA addr - { check_size ($1.sz2, X86LONG) - ; `X86MOVSX (X86S32, R_rm ($2, $4), suffix_size $1.sz1) - } -| MOVSX qreg COMMA addr - { check_size ($1.sz2, X86QUAD) - ; `X86MOVSX (X86S64, R_rm ($2, $4), suffix_size $1.sz1) - } -| MOVZX wreg COMMA breg - { check_size ($1.sz1, X86BYTE) - ; check_size ($1.sz2, X86WORD) - ; `X86MOVZX (X86S16, R_rm ($2, Reg (IReg $4.reg)), X86S8 $4.high) - } -| MOVZX lreg COMMA breg - { check_size ($1.sz1, X86BYTE) - ; check_size ($1.sz2, X86LONG) - ; `X86MOVZX (X86S32, R_rm ($2, Reg (IReg $4.reg)), X86S8 $4.high) - } -| MOVZX qreg COMMA breg - { check_size ($1.sz1, X86BYTE) - ; check_size ($1.sz2, X86QUAD) - ; `X86MOVZX (X86S64, R_rm ($2, Reg (IReg $4.reg)), X86S8 $4.high) - } -| MOVZX lreg COMMA wreg - { check_size ($1.sz1, X86WORD) - ; check_size ($1.sz2, X86LONG) - ; `X86MOVZX (X86S32, R_rm ($2, Reg $4), X86S16) - } -| MOVZX qreg COMMA wreg - { check_size ($1.sz1, X86WORD) - ; check_size ($1.sz2, X86QUAD) - ; `X86MOVZX (X86S64, R_rm ($2, Reg $4), X86S16) - } -| MOVZX wreg COMMA addr - { check_size ($1.sz2, X86WORD) - ; `X86MOVZX (X86S16, R_rm ($2, $4), suffix_size $1.sz1) (* XXX size *) - } -| MOVZX lreg COMMA addr - { check_size ($1.sz2, X86LONG) - ; `X86MOVZX (X86S32, R_rm ($2, $4), suffix_size $1.sz1) - } -| MOVZX qreg COMMA addr - { check_size ($1.sz2, X86QUAD) - ; `X86MOVZX (X86S64, R_rm ($2, $4), suffix_size $1.sz1) - } -| MUL addr - { `X86MUL (suffix_size $1.sz, $2) } -| MUL breg - { check_size ($1.sz, X86BYTE) - ; `X86MUL (X86S8 ($2.high), Reg (IReg $2.reg)) - } -| MUL wreg - { check_size ($1.sz, X86WORD) - ; `X86MUL (X86S16, Reg $2) - } -| MUL lreg - { check_size ($1.sz, X86LONG) - ; `X86MUL (X86S32, Reg $2) - } -| MUL qreg - { check_size ($1.sz, X86QUAD) - ; `X86MUL (X86S64, Reg $2) - } -| NOP - { `X86NOP } -| POP qreg - { `X86POP (Reg $2) } -| POP addr - { `X86POP $2 } -| PUSH big_imm - { `X86PUSH (Imm $2) } -| PUSH addr - { `X86PUSH (Rm $2) } -| PUSH qreg - { `X86PUSH (Rm (Reg $2)) } -| RET big_imm - { `X86RET $2 } -| SET breg - { `X86SET ($1.cond, $2.high, Reg (IReg $2.reg)) } -| SET addr - { `X86SET ($1.cond, false, $2) } -| STC - { `X86STC } -| XADD breg COMMA breg - { check_size ($1.sz, X86BYTE) - ; check_byte_regs ($2, $4) - ; `X86XADD (false, X86S8 ($2.high), Reg (IReg $2.reg), (IReg $4.reg)) - } -| XADD addr COMMA breg - { check_size ($1.sz, X86BYTE) - ; `X86XADD (false, X86S8 ($4.high), $2, (IReg $4.reg)) - } -| LOCK XADD addr COMMA breg - { check_size ($2.sz, X86BYTE) - ; `X86XADD (true, X86S8 ($5.high), $3, (IReg $5.reg)) - } -| XADD wreg COMMA wreg - { check_size ($1.sz, X86WORD) - ; `X86XADD (false, X86S16, Reg $2, $4) - } -| XADD addr COMMA wreg - { check_size ($1.sz, X86WORD) - ; `X86XADD (false, X86S16, $2, $4) - } -| LOCK XADD addr COMMA wreg - { check_size ($2.sz, X86WORD) - ; `X86XADD (true, X86S16, $3, $5) - } -| XADD lreg COMMA lreg - { check_size ($1.sz, X86LONG) - ; `X86XADD (false, X86S32, Reg $2, $4) - } -| XADD addr COMMA lreg - { check_size ($1.sz, X86LONG) - ; `X86XADD (false, X86S32, $2, $4) - } -| LOCK XADD addr COMMA lreg - { check_size ($2.sz, X86LONG) - ; `X86XADD (true, X86S32, $3, $5) - } -| XADD qreg COMMA qreg - { check_size ($1.sz, X86QUAD) - ; `X86XADD (false, X86S64, Reg $2, $4) - } -| XADD addr COMMA qreg - { check_size ($1.sz, X86QUAD) - ; `X86XADD (false, X86S64, $2, $4) - } -| LOCK XADD addr COMMA qreg - { check_size ($2.sz, X86QUAD) - ; `X86XADD (true, X86S64, $3, $5) - } -| XCHG breg COMMA breg - { check_size ($1.sz, X86BYTE) - ; check_byte_regs ($2, $4) - ; `X86XCHG (false, X86S8 ($2.high), Reg (IReg $2.reg), IReg $4.reg) - } -| XCHG addr COMMA breg - { check_size ($1.sz, X86BYTE) - ; `X86XCHG (false, X86S8 ($4.high), $2, (IReg $4.reg)) - } -| LOCK XCHG addr COMMA breg - { check_size ($2.sz, X86BYTE) - ; `X86XCHG (true, X86S8 ($5.high), $3, (IReg $5.reg)) - } -| XCHG wreg COMMA wreg - { check_size ($1.sz, X86WORD) - ; `X86XCHG (false, X86S16, Reg $2, $4) - } -| XCHG addr COMMA wreg - { check_size ($1.sz, X86WORD) - ; `X86XCHG (false, X86S16, $2, $4) - } -| LOCK XCHG addr COMMA wreg - { check_size ($2.sz, X86WORD) - ; `X86XCHG (true, X86S16, $3, $5) - } -| XCHG lreg COMMA lreg - { check_size ($1.sz, X86LONG) - ; `X86XCHG (false, X86S32, Reg $2, $4) - } -| XCHG addr COMMA lreg - { check_size ($1.sz, X86LONG) - ; `X86XCHG (false, X86S32, $2, $4) - } -| LOCK XCHG addr COMMA lreg - { check_size ($2.sz, X86LONG) - ; `X86XCHG (true, X86S32, $3, $5) - } -| XCHG qreg COMMA qreg - { check_size ($1.sz, X86QUAD) - ; `X86XCHG (false, X86S64, Reg $2, $4) - } -| XCHG addr COMMA qreg - { check_size ($1.sz, X86QUAD) - ; `X86XCHG (false, X86S64, $2, $4) - } -| LOCK XCHG addr COMMA qreg - { check_size ($2.sz, X86QUAD) - ; `X86XCHG (true, X86S64, $3, $5) - } diff --git a/x86/gen/pretty.hgen b/x86/gen/pretty.hgen deleted file mode 100644 index fc0c59d4..00000000 --- a/x86/gen/pretty.hgen +++ /dev/null @@ -1,50 +0,0 @@ -| `X86BINOP (locked, bop, sz, dst_src) -> - pp_locked locked ^ pp_x86Binop bop ^ pp_x86Size sz ^ " " ^ pp_x86Dest_src (sz, dst_src) -| `X86BITOP (locked, bop, sz, bo) -> - pp_locked locked ^ pp_x86Bitop bop ^ pp_x86Size sz ^ " " ^ pp_x86Bit_offset (sz, bo) -| `X86CALL (Imm i) -> "call " ^ " $" ^ bit64_to_string i -| `X86CALL (Rm rm) -> "call " ^ pp_x86Rm (X86S64, rm) -| `X86CLC -> "clc" -| `X86CMC -> "cmc" -| `X86CMPXCHG (locked, sz, rm, r) -> - sprintf "%scmpxchg%s %s, %s" - (pp_locked locked) (pp_x86Size sz) (pp_size_reg sz r) (pp_x86Rm (sz, rm)) -| `X86DIV (sz, rm) -> "div" ^ pp_x86Size sz ^ " " ^ pp_x86Rm (sz, rm) -| `X86JCC (X86ALWAYS, i) -> "jmp " ^ bit64_to_string i -| `X86JCC (cnd, i) -> "j" ^ pp_x86Cond cnd ^ " " ^ bit64_to_string i -| `X86JMP (rm) -> "jmp " ^ pp_x86Rm(X86S64, rm) -| `X86LEA (sz, dst_src) -> - "lea" ^ (pp_x86Size sz) ^ " " ^ pp_x86Dest_src (sz, dst_src) -| `X86LEAVE -> "leave" -| `X86LOOP (cnd, i) -> "loop" ^ pp_x86Cond cnd ^ " " ^ bit64_to_string i -| `X86MFENCE -> "mfence" -| `X86MONOP (locked, mop, sz, rm) -> - pp_x86Monop mop ^ pp_x86Size sz ^ " " ^ pp_x86Rm (sz, rm) -| `X86MOV (X86ALWAYS, sz, dst_src) -> - "mov" ^ pp_x86Size sz ^ " " ^ pp_x86Dest_src (sz, dst_src) -| `X86MOV (cnd, sz, dst_src) -> - "cmov" ^ pp_x86Cond cnd ^ pp_x86Size sz ^ " " ^ pp_x86Dest_src (sz, dst_src) -| `X86MOVSX (sz1, R_rm (r, rm), sz2) -> - "movs" ^ pp_x86Size sz1 ^ pp_x86Size sz2 ^ " " ^ pp_x86Rm (sz1, rm) ^ - ", " ^ pp_size_reg sz2 r -| `X86MOVSX (sz1, _, sz2) -> failwith "bad movsx instruction" -| `X86MOVZX (sz1, R_rm (r, rm), sz2) -> - "movz" ^ pp_x86Size sz1 ^ pp_x86Size sz2 ^ " " ^ pp_x86Rm (sz1, rm) ^ - ", " ^ pp_size_reg sz2 r -| `X86MOVZX (sz1, _, sz2) -> failwith "bad movzx instruction" -| `X86MUL (sz, rm) -> "mul" ^ pp_x86Size sz ^ " " ^ pp_x86Rm (sz, rm) -| `X86NOP -> "nop" -| `X86POP rm -> "pop " ^ (pp_x86Rm (X86S64, rm)) -| `X86PUSH (Imm i) -> "push $" ^ bit64_to_string i -| `X86PUSH (Rm rm) -> "push " ^ pp_x86Rm (X86S64, rm) -| `X86RET i -> "ret " ^ bit64_to_string i -| `X86SET (cnd, b, rm) -> "set" ^ pp_x86Cond cnd ^ " " ^ pp_x86Rm (X86S8 b, rm) -| `X86STC -> "stc" -| `X86XADD (locked, sz, rm, r) -> - sprintf "%s xadd%s %s, %s" - (pp_locked locked) (pp_x86Size sz) (pp_size_reg sz r) (pp_x86Rm (sz, rm)) -| `X86XCHG (locked, sz, rm, r) -> - sprintf "%sxchg%s %s, %s" - (pp_locked locked) (pp_x86Size sz) (pp_size_reg sz r) (pp_x86Rm (sz, rm)) -| `X86ThreadStart -> "start" -| `X86StopFetching -> "hlt" diff --git a/x86/gen/sail_trans_out.hgen b/x86/gen/sail_trans_out.hgen deleted file mode 100644 index 948db8fa..00000000 --- a/x86/gen/sail_trans_out.hgen +++ /dev/null @@ -1 +0,0 @@ -(* *) diff --git a/x86/gen/shallow_ast_to_herdtools_ast.hgen b/x86/gen/shallow_ast_to_herdtools_ast.hgen deleted file mode 100644 index ed5d6680..00000000 --- a/x86/gen/shallow_ast_to_herdtools_ast.hgen +++ /dev/null @@ -1,27 +0,0 @@ -| Binop (locked, binop, sz, dest_src) -> `X86BINOP (translate_out_bool locked, translate_out_binop binop, translate_out_size sz, translate_out_dest_src dest_src) -| Bitop (locked, bitop, sz, bo) -> `X86BITOP (translate_out_bool locked, translate_out_bitop bitop, translate_out_size sz, translate_out_bitoffset bo) -| CALL (imm_rm) -> `X86CALL (translate_out_imm_rm imm_rm) -| CLC -> `X86CLC -| CMC -> `X86CMC -| CMPXCHG (locked, sz, rm , reg) -> `X86CMPXCHG (translate_out_bool locked, translate_out_size sz, translate_out_rm rm, translate_out_reg reg) -| X86_DIV (sz, rm) -> `X86DIV (translate_out_size sz, translate_out_rm rm) -| HLT -> `X86StopFetching -| Jcc (cond, imm64) -> `X86JCC (translate_out_cond cond, translate_out_imm64 imm64) -| JMP (rm) -> `X86JMP (translate_out_rm rm) -| LEA (sz, dest_src) -> `X86LEA (translate_out_size sz, translate_out_dest_src dest_src) -| LEAVE -> `X86LEAVE -| LOOP (cond, imm64) -> `X86LOOP (translate_out_cond cond, translate_out_imm64 imm64) -| MFENCE -> `X86MFENCE -| Monop (locked, monop, sz, rm) -> `X86MONOP (translate_out_bool locked, translate_out_monop monop, translate_out_size sz, translate_out_rm rm) -| MOV (cond, sz, dest_src) -> `X86MOV (translate_out_cond cond, translate_out_size sz, translate_out_dest_src dest_src) -| MOVSX (sz1, dest_src, sz2) -> `X86MOVSX (translate_out_size sz1, translate_out_dest_src dest_src, translate_out_size sz2) -| MOVZX (sz1, dest_src, sz2) -> `X86MOVZX (translate_out_size sz1, translate_out_dest_src dest_src, translate_out_size sz2) -| X86_MUL (sz, rm) -> `X86MUL (translate_out_size sz, translate_out_rm rm) -| NOP (_) -> `X86NOP -| POP (rm) -> `X86POP (translate_out_rm rm) -| PUSH (imm_rm) -> `X86PUSH (translate_out_imm_rm imm_rm) -| RET (imm64) -> `X86RET (translate_out_imm64 imm64) -| SET (cond, b, rm) -> `X86SET (translate_out_cond cond, translate_out_bool b, translate_out_rm rm) -| STC -> `X86STC -| XADD (locked, sz, rm, reg) -> `X86XADD (translate_out_bool locked, translate_out_size sz, translate_out_rm rm, translate_out_reg reg) -| XCHG (locked, sz, rm, reg) -> `X86XCHG (translate_out_bool locked, translate_out_size sz, translate_out_rm rm, translate_out_reg reg) diff --git a/x86/gen/shallow_types_to_herdtools_types.hgen b/x86/gen/shallow_types_to_herdtools_types.hgen deleted file mode 100644 index ba4eccaa..00000000 --- a/x86/gen/shallow_types_to_herdtools_types.hgen +++ /dev/null @@ -1,97 +0,0 @@ -let is_inc = false - -let translate_out_bool = function - | Sail_values.B1 -> true - | Sail_values.B0 -> false - | _ -> failwith "translate_out_bool Undef" - -let translate_out_binop = function - | X86_Add -> X86ADD - | X86_Or -> X86OR - | X86_Adc -> X86ADC - | X86_Sbb -> X86SBB - | X86_And -> X86AND - | X86_Sub -> X86SUB - | X86_Xor -> X86XOR - | X86_Cmp -> X86CMP - | X86_Rol -> X86ROL - | X86_Ror -> X86ROR - | X86_Rcl -> X86RCL - | X86_Rcr -> X86RCR - | X86_Shl -> X86SHL - | X86_Shr -> X86SHR - | X86_Test -> X86TEST - | X86_Sar -> X86SAR - -let translate_out_bitop = function - | Btc -> X86Btc - | Bts -> X86Bts - | Btr -> X86Btr - -let translate_out_size = function - | Sz8 (high) -> X86S8 (translate_out_bool high) - | Sz16 -> X86S16 - | Sz32 -> X86S32 - | Sz64 -> X86S64 - -let translate_out_big_bit = Sail_values.unsigned - -let translate_out_int inst = (Nat_big_num.to_int (translate_out_big_bit inst)) - -let translate_out_reg r = IReg (int_to_ireg (Nat_big_num.to_int r)) - -let translate_out_scale = translate_out_int - -let translate_out_imm64 i = translate_out_big_bit i - -let translate_out_msi = function - | Some (scale, reg) -> Some (translate_out_scale scale, translate_out_reg reg) - | None -> None - -let translate_out_base = function - | X86_embed_types.NoBase -> X86HGenBase.NoBase - | X86_embed_types.RegBase(r) -> X86HGenBase.RegBase (translate_out_reg r) - | X86_embed_types.RipBase -> X86HGenBase.RipBase - -let translate_out_rm = function - | X86_embed_types.X86_Reg (r) -> X86HGenBase.Reg (translate_out_reg r) - | X86_embed_types.Mem (m_si, base, imm) -> X86HGenBase.Mem (translate_out_msi m_si, translate_out_base base, translate_out_imm64 imm) - -let translate_out_dest_src = function - | X86_embed_types.R_rm (reg, rm) -> X86HGenBase.R_rm (translate_out_reg reg, translate_out_rm rm) - | X86_embed_types.Rm_i (rm, imm64) -> X86HGenBase.Rm_i (translate_out_rm rm, translate_out_imm64 imm64) - | X86_embed_types.Rm_r (rm, reg) -> X86HGenBase.Rm_r (translate_out_rm rm, translate_out_reg reg) - -let translate_out_imm_rm = function - | X86_embed_types.Imm (imm) -> X86HGenBase.Imm (translate_out_imm64 imm) - | X86_embed_types.Rm (rm) -> X86HGenBase.Rm (translate_out_rm rm) - -let translate_out_bitoffset = function - | Bit_rm_imm (rm, imm) -> X86HGenBase.Bit_rm_imm (translate_out_rm rm, Nat_big_num.to_int (translate_out_imm64 imm)) - | Bit_rm_r (rm, r) -> X86HGenBase.Bit_rm_r (translate_out_rm rm, translate_out_reg r) - -let translate_out_cond = function - | X86_O -> X86O - | X86_NO -> X86NO - | X86_B -> X86B - | X86_NB -> X86NB - | X86_E -> X86E - | X86_NE -> X86NE - | X86_NA -> X86NA - | X86_A -> X86A - | X86_S -> X86S - | X86_NS -> X86NS - | X86_P -> X86P - | X86_NP -> X86NP - | X86_L -> X86L - | X86_NL -> X86NL - | X86_NG -> X86NG - | X86_G -> X86G - | X86_ALWAYS -> X86ALWAYS - -let translate_out_monop = function - | X86_Dec -> X86DEC - | X86_Inc -> X86INC - | X86_Not -> X86NOT - | X86_Neg -> X86NEG - diff --git a/x86/gen/token_types.hgen b/x86/gen/token_types.hgen deleted file mode 100644 index 9485e544..00000000 --- a/x86/gen/token_types.hgen +++ /dev/null @@ -1,29 +0,0 @@ -type token_BINOP = { txt : string; op : x86Binop; sz : x86Suffix } -type token_BITOP = { txt : string; op : x86Bitop; sz : x86Suffix } -type token_CALL = { txt : string } -type token_CLC = { txt : string } -type token_CMC = { txt : string } -type token_CMOV = { txt : string; cond : x86Cond; sz : x86Suffix } -type token_CMPXCHG = { txt : string; sz : x86Suffix } -type token_DIV = { txt : string; sz : x86Suffix } -type token_JCC = { txt : string; cond : x86Cond } -type token_JMP = { txt : string } -type token_LEA = { txt : string; sz : x86Suffix } -type token_LEAVE = { txt : string } -type token_LOOP = { txt : string; cond : x86Cond } -type token_MFENCE = { txt : string; } -type token_MONOP = { txt : string; op : x86Monop; sz : x86Suffix } -type token_MOV = { txt : string; sz : x86Suffix } -type token_MOVABS = { txt : string } -type token_MOVSX = { txt : string; sz1 : x86Suffix; sz2 : x86Suffix } -type token_MOVZX = { txt : string; sz1 : x86Suffix; sz2 : x86Suffix } -type token_MUL = { txt : string; sz : x86Suffix } -type token_NOP = { txt : string } -type token_POP = { txt : string } -type token_PUSH = { txt : string } -type token_RET = { txt : string } -type token_SET = { txt : string; cond : x86Cond } -type token_STC = { txt : string } -type token_XADD = { txt : string; sz : x86Suffix } -type token_XCHG = { txt : string; sz : x86Suffix } - diff --git a/x86/gen/tokens.hgen b/x86/gen/tokens.hgen deleted file mode 100644 index 7aa5256f..00000000 --- a/x86/gen/tokens.hgen +++ /dev/null @@ -1,28 +0,0 @@ -%token <X86HGenBase.token_BINOP> BINOP -%token <X86HGenBase.token_BITOP> BITOP -%token <X86HGenBase.token_CALL> CALL -%token <X86HGenBase.token_CLC> CLC -%token <X86HGenBase.token_CMC> CMC -%token <X86HGenBase.token_CMPXCHG> CMPXCHG -%token <X86HGenBase.token_DIV> DIV -%token <X86HGenBase.token_JCC> JCC -%token <X86HGenBase.token_JMP> JMP -%token <X86HGenBase.token_LEA> LEA -%token <X86HGenBase.token_LEAVE> LEAVE -%token <X86HGenBase.token_LOOP> LOOP -%token <X86HGenBase.token_MFENCE> MFENCE -%token <X86HGenBase.token_MONOP> MONOP -%token <X86HGenBase.token_CMOV> CMOV -%token <X86HGenBase.token_MOV> MOV -%token <X86HGenBase.token_MOVABS> MOVABS -%token <X86HGenBase.token_MOVSX> MOVSX -%token <X86HGenBase.token_MOVZX> MOVZX -%token <X86HGenBase.token_MUL> MUL -%token <X86HGenBase.token_NOP> NOP -%token <X86HGenBase.token_POP> POP -%token <X86HGenBase.token_PUSH> PUSH -%token <X86HGenBase.token_RET> RET -%token <X86HGenBase.token_SET> SET -%token <X86HGenBase.token_STC> STC -%token <X86HGenBase.token_XADD> XADD -%token <X86HGenBase.token_XCHG> XCHG diff --git a/x86/gen/trans_sail.hgen b/x86/gen/trans_sail.hgen deleted file mode 100644 index 0fdfc803..00000000 --- a/x86/gen/trans_sail.hgen +++ /dev/null @@ -1,28 +0,0 @@ -(*| `X86BINOP(binop, sz, dest_src) -> ("Binop", [translate_binop binop; translate_size sz; translate_dest_src dest_src], []) -| `X86CALL (imm_rm) -> ("CALL", [translate_imm_rm imm_rm], []) -| `X86CLC -> ("CLC", [], []) -| `X86CMC -> ("CMC", [], []) -| `X86CMPXCHG (sz, rm , reg) -> ("CMPXCHG", [translate_size sz; translate_rm rm; translate_reg reg], []) -| `X86DIV (sz, rm) -> ("DIV", [translate_size sz; translate_rm rm], []) -| `X86StopFetching -> ("HLT", [], []) -| `X86JCC (cond, imm64) -> ("Jcc", [translate_cond cond; translate_imm64 imm64], []) -| `X86JMP (rm) -> ("JMP", [translate_rm rm], []) -| `X86LEA (sz, dest_src) -> ("LEA", [translate_size sz; translate_dest_src dest_src], []) -| `X86LEAVE -> ("LEAVE", [], []) -| `X86LOOP (cond, imm64) -> ("LOOP", [translate_cond cond; translate_imm64 imm64], []) -| `X86MFENCE -> ("MFENCE", [], []) -| `X86MONOP (monop, sz, rm) -> ("Monop", [translate_monop monop; translate_size sz; translate_rm rm], []) -| `X86MOV (cond, sz, dest_src) -> ("MOV", [translate_cond cond; translate_size sz; translate_dest_src dest_src], []) -| `X86MOVSX (sz1, dest_src, sz2) -> ("MOVSX", [translate_size sz1; translate_dest_src dest_src; translate_size sz2], []) -| `X86MOVZX (sz1, dest_src, sz2) -> ("MOVZX", [translate_size sz1; translate_dest_src dest_src; translate_size sz2], []) -| `X86MUL (sz, rm) -> ("MUL", [translate_size sz; translate_rm rm], []) -| `X86NOP -> ("NOP", [Nat_big_num.of_int 0], []) -| `X86POP (rm) -> ("POP", [translate_rm rm], []) -| `X86PUSH (imm_rm) -> ("PUSH", [translate_imm_rm imm_rm], []) -| `X86RET (imm64) -> ("RET", [translate_imm64 imm64], []) -| `X86SET (cond, b, rm) -> ("SET", [translate_cond cond; translate_bool b; translate_rm rm], []) -| `X86STC -> ("STC", [], []) -| `X86XADD (sz, rm, reg) -> ("XADD", [translate_size sz; translate_rm rm; translate_reg reg], []) -| `X86XCHG (sz, rm, reg) -> ("XCHG", [translate_size sz; translate_rm rm; translate_reg reg], []) - -*)
\ No newline at end of file diff --git a/x86/gen/types.hgen b/x86/gen/types.hgen deleted file mode 100644 index 117f0f4d..00000000 --- a/x86/gen/types.hgen +++ /dev/null @@ -1,134 +0,0 @@ -type bit2 = int -type bit64 = Nat_big_num.num -let bit64_of_int = Nat_big_num.of_int -let bit64_to_int = Nat_big_num.to_int -let bit64_to_string = Nat_big_num.to_string -let eq_bit64 = Nat_big_num.equal - -type x86Binop = -| X86ADD -| X86OR -| X86ADC -| X86SBB -| X86AND -| X86SUB -| X86XOR -| X86CMP -| X86ROL -| X86ROR -| X86RCL -| X86RCR -| X86SHL -| X86SHR -| X86TEST -| X86SAR - -let pp_x86Binop = function -| X86ADD -> "add" -| X86OR -> "or" -| X86ADC -> "adc" -| X86SBB -> "sbb" -| X86AND -> "and" -| X86SUB -> "sub" -| X86XOR -> "xor" -| X86CMP -> "cmp" -| X86ROL -> "rol" -| X86ROR -> "ror" -| X86RCL -> "rcl" -| X86RCR -> "rcr" -| X86SHL -> "shl" -| X86SHR -> "shr" -| X86TEST -> "test" -| X86SAR -> "sar" - -type x86Bitop = X86Bts | X86Btc | X86Btr - -let pp_x86Bitop = function -| X86Bts -> "bts" -| X86Btc -> "btc" -| X86Btr -> "btr" - -type x86Monop = -| X86DEC -| X86INC -| X86NOT -| X86NEG - -let pp_x86Monop = function -| X86DEC -> "dec" -| X86INC -> "inc" -| X86NOT -> "not" -| X86NEG -> "neg" - -type x86Cond = -| X86O -| X86NO -| X86B -| X86NB -| X86E -| X86NE -| X86NA -| X86A -| X86S -| X86NS -| X86P -| X86NP -| X86L -| X86NL -| X86NG -| X86G -| X86ALWAYS - -let pp_x86Cond = function -| X86O -> "o" -| X86NO -> "no" -| X86B -> "b" -| X86NB -> "nb" -| X86E -> "e" -| X86NE -> "ne" -| X86NA -> "na" -| X86A -> "a" -| X86S -> "s" -| X86NS -> "ns" -| X86P -> "p" -| X86NP -> "np" -| X86L -> "l" -| X86NL -> "nl" -| X86NG -> "ng" -| X86G -> "g" -| X86ALWAYS -> "" - -type x86Suffix = -| X86BYTE -| X86WORD -| X86LONG -| X86QUAD -| X86NONE - -let pp_x86Suffix = function -| X86BYTE -> "byte" -| X86WORD -> "word" -| X86LONG -> "long" -| X86QUAD -> "quad" -| X86NONE -> "" - -type x86Size = -| X86S8 of bool -| X86S16 -| X86S32 -| X86S64 - -let pp_x86Size = function -| X86S8(_) -> "b" -| X86S16 -> "w" -| X86S32 -> "l" -| X86S64 -> "q" - -let pp_locked l = if l then "lock " else "" - -let suffix_size = function -| X86BYTE -> X86S8 false -| X86WORD -> X86S16 -| X86LONG -> X86S32 -| X86QUAD -> X86S64 -| X86NONE -> X86S64 diff --git a/x86/gen/types_sail_trans_out.hgen b/x86/gen/types_sail_trans_out.hgen deleted file mode 100644 index 948db8fa..00000000 --- a/x86/gen/types_sail_trans_out.hgen +++ /dev/null @@ -1 +0,0 @@ -(* *) diff --git a/x86/gen/types_trans_sail.hgen b/x86/gen/types_trans_sail.hgen deleted file mode 100644 index f088db39..00000000 --- a/x86/gen/types_trans_sail.hgen +++ /dev/null @@ -1,61 +0,0 @@ -(*let translate_enum enum_values name value = - let rec bit_count n = - if n = 0 then 0 - else 1 + (bit_count (n lsr 1)) in - let rec find_index element = function - | h::tail -> if h = element then 0 else 1 + (find_index element tail) - | _ -> failwith "translate_enum could not find value" - in - let size = bit_count (List.length enum_values) in - let index = find_index value enum_values in - (name, Range0 (Some size), IInt.bit_list_of_integer size (Nat_big_num.of_int index)) - -let translate_binop = translate_enum [X86ADD ; X86OR ; X86ADC ; X86SBB ; X86AND ; X86SUB ; X86XOR ; X86CMP ; X86ROL ; X86ROR ; X86RCL ; X86RCR ; X86SHL ; X86SHR ; X86TEST; X86SAR] - -let translate_cond = translate_enum [X86O ; X86NO ; X86B ; X86NB ; X86E ; X86NE ; X86NA ; X86A ; X86S ; X86NS ; X86P ; X86NP ; X86L ; X86NL ; X86NG ; X86G ; X86ALWAYS ] - -let translate_monop = translate_enum [X86DEC; X86INC; X86NOT; X86NEG] - -let translate_bool value = - ("bool", Bit, [if value then Bitc_one else Bitc_zero]) - -let translate_size = function - | X86S8(high) -> ("Sz8", [translate_bool high], []) - | X86S16 -> ("Sz16", [], []) - | X86S32 -> ("Sz32", [], []) - | X86S64 -> ("Sz64", [], []) - -let translate_bits bits value = - ("bits", Bvector (Some bits), IInt.bit_list_of_integer bits (Nat_big_num.of_int value)) - -let translate_bits_big bits value = - ("bits", Bvector (Some bits), IInt.bit_list_of_integer bits value) - -let translate_reg r = translate_bits 4 (reg_to_int r) - -let translate_scale s = translate_bits 2 s - -let translate_imm64 i = translate_bits_big 64 i - -let translate_msi = function - | Some (scale, reg) -> ("Some", [translate_scale scale; translate_reg reg], []) - | None -> ("None", [], []) - -let translate_base = function - | X86HGenBase.NoBase -> ("NoBase", [], []) - | X86HGenBase.RegBase(r) -> ("RegBase", [translate_reg r], []) - | X86HGenBase.RipBase -> ("RipBase", [], []) - -let translate_rm = function - | X86HGenBase.Reg (r) -> ("Reg", [translate_reg r], []) - | X86HGenBase.Mem (m_si, base, imm) -> ("Mem", [translate_msi m_si; translate_base base; translate_imm64 imm], []) - -let translate_dest_src = function - | X86HGenBase.R_rm (reg, rm) -> ("R_rm", [translate_reg reg; translate_rm rm], []) - | X86HGenBase.Rm_i (rm, imm64) -> ("Rm_i", [translate_rm rm; translate_imm64 imm64], []) - | X86HGenBase.Rm_r (rm, reg) -> ("Rm_r", [translate_rm rm; translate_reg reg], []) - -let translate_imm_rm = function - | X86HGenBase.Imm (imm) -> ("Imm", [translate_imm64 imm], []) - | X86HGenBase.Rm (rm) -> ("Rm", [translate_rm rm], []) - *) |
