Module Fang_vm.Label

Operations on labels.

type t = label
val equal : t -> t -> bool

Labels are compared for equality based on whether they're local or global:

  • If l1 and l2 are both global, then equal l1 l2 is true when the strings comprising their names are equal.
  • If l1 and l2 are both local, then equal l1 l2 is true when l1 and l2 are handles to the same local label.
  • Otherwise, equal _ _ is false.
val compare : t -> t -> int

If equal l1 l2 is true then compare l1 l2 is 0. Otherwise, there exists a total order on labels but it is unspecified.

val pp : ?⁠local:int Fmt.t -> ?⁠global:string Fmt.t -> unit -> t Fmt.t

Format a label.

By default, labels are formatted as by pp_top. The way that local and global labels are formatted can be overridden.

val pp_top : t Fmt.t

Format a label in a default human-friendly way.

This format may not correspond to anything that an actual assembler recognizes.

A local label is formatted as .L%d where %d is a unique integer.

A global label is formatted as its name.