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
andl2
are both global, thenequal l1 l2
istrue
when the strings comprising their names are equal.
- If
l1
andl2
are both local, thenequal l1 l2
istrue
whenl1
andl2
are handles to the same local label.
- Otherwise,
equal _ _
isfalse
.
- If
val compare : t -> t -> int
If
equal l1 l2
istrue
thencompare l1 l2
is0
. 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.