## codelabel.api
#
# An abstract interface to machine-level instruction addresses.
# We use codelabels in both our treecode and machcode (abstract
# machine code) compiler backend lowhalf code representations.
#
# Code labels come in three flavors:
#
# o Global labels have fixed names and are imported/exported
# from the current compilation unit;
#
# o Local labels have names generated from some given prefix;
#
# o Anonymous labels have internally generated names that
# are not in the compilation unit's symbol table.
# Compiled by:
#
src/lib/compiler/back/low/lib/lowhalf.lib### "As we look to the horizon of a decade hence,
### we see no silver bullet. There is no single
### development, in either technology or in
### management technique, that by itself promises
### even one order-of-magnitude improvement in
### productivity, in reliability, in simplicity."
###
### -- Frederick P Brooks, 1986
# This api is implemented in:
#
#
src/lib/compiler/back/low/code/codelabel.pkg#
api Codelabel {
#
Codelabel;
make_global_codelabel: String -> Codelabel; # Make a global label.
make_codelabel_generator: String -> Void -> Codelabel;
#
# Make a label generator.
# Note that if the prefix string is "",
# then the standard prefix "L" will be used:
make_anonymous_codelabel: Void -> Codelabel;
# Codelabel equality, comparisons, and hashing:
#
same_codelabel: (Codelabel, Codelabel) -> Bool;
compare_codelabels: (Codelabel, Codelabel) -> Order;
codelabel_to_hashcode: Codelabel -> Unt;
# Codelabel addresses. These two calls are used
# (only) during actual machine code generation:
#
exception GLOBAL_LABEL;
#
set_codelabel_address: (Codelabel, Int) -> Void;
get_codelabel_address: Codelabel -> Int;
codelabel_to_string: Codelabel -> String;
#
# Return a string representation of the label.
#
# This function is meant for debugging --
# use the format function for assembly output.
codelabel_format_for_asm
:
{ global_symbol_prefix: String,
anonymous_label_prefix: String
}
-> Codelabel
-> String;
#
# Format a label for assembly output.
#
# 'global_symbol_prefix': the target ABI's prefix
# for global symbols
# (e.g., "_" or "")
#
# 'a_prefix': the target assembler's prefix
# for anonymous labels.
#
# Local labels are emitted using
# their specified prefix.
set_count_to_zero: Void -> Void;
#
# Reset the internal counter used
# to generate unique IDs for labels.
# This function should never be called
# when there are label values still in use.
};
## COPYRIGHT (c) 2001 Bell Labs, Lucent Technologies
## Subsequent changes by Jeff Prothero Copyright (c) 2010-2015,
## released per terms of SMLNJ-COPYRIGHT.