Module Fang_x64

Compiler functionality specialized to the x86-64 architecture.

Registers

For simplicity, Fang uses a uniform representation of a machine word for all values. Thus, while x86-64 registers are "segmented" into registers of different sizes (for example, eax is the 32 b segment of the ax register) we only ever use the 64 b variants (e.g, rax).

val ax : box
val bx : box
val cx : box
val dx : box
val si : box
val di : box
val sp : box
val bp : box
val r8 : box
val r9 : box
val r10 : box
val r11 : box
val r12 : box
val r13 : box
val r14 : box
val r15 : box
val pp_reg : box Fmt.t

Translation to IR

module Frame : functor (I : IR) -> FRAME with type 'a ir = 'a I.t
module Translate : functor (I : IR) -> TRANSLATE with type 'a ir = 'a I.t

Emitting flow graphs

module Emit : sig ... end

Register allocation

Producing the final assembly

The assembly produced is compatible with the internal assemblers of both GCC and Clang.

val pp_asm_string : label -> string Fmt.t

Pretty-print assembly for a constant string with the given label.

val pp_asm_prefix : unit Fmt.t

This is the preamble necessary for a standalone assembly file.

val pp_asm : frame_ptr -> graph Fmt.t

Assuming the flow-graph has had processor registers assigned, produce the final assembly for the frame described by the graph.