package ocaml-base-compiler

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type

Structured representation of Intel assembly language (32 and 64 bit).

type condition =
  1. | L
  2. | GE
  3. | LE
  4. | G
  5. | B
  6. | AE
  7. | BE
  8. | A
  9. | E
  10. | NE
  11. | O
  12. | NO
  13. | S
  14. | NS
  15. | P
  16. | NP
type float_condition =
  1. | EQf
  2. | LTf
  3. | LEf
  4. | UNORDf
  5. | NEQf
  6. | NLTf
  7. | NLEf
  8. | ORDf
type rounding =
  1. | RoundUp
  2. | RoundDown
  3. | RoundNearest
  4. | RoundTruncate
type constant =
  1. | Const of int64
  2. | ConstThis
  3. | ConstLabel of string
  4. | ConstAdd of constant * constant
  5. | ConstSub of constant * constant
type data_type =
  1. | NONE
  2. | REAL4
  3. | REAL8
  4. | BYTE
  5. | WORD
  6. | DWORD
  7. | QWORD
  8. | OWORD
  9. | NEAR
  10. | PROC
type reg64 =
  1. | RAX
  2. | RBX
  3. | RCX
  4. | RDX
  5. | RSP
  6. | RBP
  7. | RSI
  8. | RDI
  9. | R8
  10. | R9
  11. | R10
  12. | R11
  13. | R12
  14. | R13
  15. | R14
  16. | R15
type reg8h =
  1. | AH
  2. | BH
  3. | CH
  4. | DH
type registerf =
  1. | XMM of int
  2. | TOS
  3. | ST of int
type arch =
  1. | X64
  2. | X86
type addr = {
  1. arch : arch;
  2. typ : data_type;
  3. idx : reg64;
  4. scale : int;
  5. base : reg64 option;
  6. sym : string option;
  7. displ : int;
}

Addressing modes: displ + sym + base + idx * scale (if scale = 0, idx is ignored and base must be None)

type arg =
  1. | Imm of int64
    (*

    Operand is an immediate constant integer

    *)
  2. | Sym of string
    (*

    Address of a symbol (absolute address except for call/jmp target where it is interpreted as a relative displacement

    *)
  3. | Reg8L of reg64
  4. | Reg8H of reg8h
  5. | Reg16 of reg64
  6. | Reg32 of reg64
  7. | Reg64 of reg64
  8. | Regf of registerf
  9. | Mem of addr
  10. | Mem64_RIP of data_type * string * int
type instruction =
  1. | ADD of arg * arg
  2. | ADDSD of arg * arg
  3. | AND of arg * arg
  4. | ANDPD of arg * arg
  5. | BSWAP of arg
  6. | CALL of arg
  7. | CDQ
  8. | CMOV of condition * arg * arg
  9. | CMP of arg * arg
  10. | CMPSD of float_condition * arg * arg
  11. | COMISD of arg * arg
  12. | CQO
  13. | CVTSD2SI of arg * arg
  14. | CVTSD2SS of arg * arg
  15. | CVTSI2SD of arg * arg
  16. | CVTSS2SD of arg * arg
  17. | CVTTSD2SI of arg * arg
  18. | DEC of arg
  19. | DIVSD of arg * arg
  20. | FABS
  21. | FADD of arg
  22. | FADDP of arg * arg
  23. | FCHS
  24. | FCOMP of arg
  25. | FCOMPP
  26. | FCOS
  27. | FDIV of arg
  28. | FDIVP of arg * arg
  29. | FDIVR of arg
  30. | FDIVRP of arg * arg
  31. | FILD of arg
  32. | FISTP of arg
  33. | FLD of arg
  34. | FLD1
  35. | FLDCW of arg
  36. | FLDLG2
  37. | FLDLN2
  38. | FLDZ
  39. | FMUL of arg
  40. | FMULP of arg * arg
  41. | FNSTCW of arg
  42. | FNSTSW of arg
  43. | FPATAN
  44. | FPTAN
  45. | FSIN
  46. | FSQRT
  47. | FSTP of arg
  48. | FSUB of arg
  49. | FSUBP of arg * arg
  50. | FSUBR of arg
  51. | FSUBRP of arg * arg
  52. | FXCH of arg
  53. | FYL2X
  54. | HLT
  55. | IDIV of arg
  56. | IMUL of arg * arg option
  57. | INC of arg
  58. | J of condition * arg
  59. | JMP of arg
  60. | LEA of arg * arg
  61. | LEAVE
  62. | MOV of arg * arg
  63. | MOVAPD of arg * arg
  64. | MOVD of arg * arg
  65. | MOVLPD of arg * arg
  66. | MOVSD of arg * arg
  67. | MOVSS of arg * arg
  68. | MOVSX of arg * arg
  69. | MOVSXD of arg * arg
  70. | MOVZX of arg * arg
  71. | MULSD of arg * arg
  72. | NEG of arg
  73. | NOP
  74. | OR of arg * arg
  75. | POP of arg
  76. | PUSH of arg
  77. | RET
  78. | ROUNDSD of rounding * arg * arg
  79. | SAL of arg * arg
  80. | SAR of arg * arg
  81. | SET of condition * arg
  82. | SHR of arg * arg
  83. | SQRTSD of arg * arg
  84. | SUB of arg * arg
  85. | SUBSD of arg * arg
  86. | TEST of arg * arg
  87. | UCOMISD of arg * arg
  88. | XCHG of arg * arg
  89. | XOR of arg * arg
  90. | XORPD of arg * arg
type asm_line =
  1. | Ins of instruction
  2. | Align of bool * int
  3. | Byte of constant
  4. | Bytes of string
  5. | Comment of string
  6. | Global of string
  7. | Long of constant
  8. | NewLabel of string * data_type
  9. | Quad of constant
  10. | Section of string list * string option * string list
  11. | Space of int
  12. | Word of constant
  13. | External of string * data_type
  14. | Mode386
  15. | Model of string
  16. | Cfi_adjust_cfa_offset of int
  17. | Cfi_endproc
  18. | Cfi_startproc
  19. | Cfi_remember_state
  20. | Cfi_restore_state
  21. | Cfi_def_cfa_register of string
  22. | Cfi_def_cfa_offset of int
  23. | File of int * string
  24. | Indirect_symbol of string
  25. | Loc of int * int * int
  26. | Private_extern of string
  27. | Set of string * constant
  28. | Size of string * constant
  29. | Type of string * string
type asm_program = asm_line list
OCaml

Innovation. Community. Security.