The src/temp
Directory
Namespace temp
, delivered for TC-5. Handle temps (fresh registers & labels).
File: local.am (src/temp/)
This is a Makefile configuration relative to the
src/temp/
directory. It is responsible for the integration into thelibtc
library with everything exported from thetemp
module, and the linkage of the directory’s unit tests in the test-suite.
File: libtemp.* (src/temp/)
The interface of the
temp
module. It exports a single procedure,dump
.
File: tasks.* (src/temp/)
Tasks related to the
temp
module (see: The src/task Directory).
File: fwd.hh (src/temp/)
Forward declarations for the
temp
module.
File: identifier.* (src/temp/)
Provides the class template
Identifier
built uponmisc::variant
and used to implementtemp::Temp
andtemp::Label
. Also contains the genericIdentifierCompareVisitor
, used to compare two identifiers.
Identifier
handles maps ofIdentifiers
. For instance, theTemp t5
might be allocated in the register$t2
, in which case, when outputtingt5
, we should print$t2
. Maps stored in the xalloc’d slotIdentifier::map
of streams implements such a correspondence. In addition, theoperator<<
of theIdentifier
class template itself “knows” when such a mapping is active, and uses it.
File: label.* (src/temp/)
We need labels for
jump
, functions, strings etc. Implemented as an instantiation of thetemp::Identifier
scheme.
File: temp.* (src/temp/)
So called temporaries are pseudo-registers: we may allocate as many temporaries as we want. Eventually the register allocator will map those temporaries to either an actual register, or it will allocate a slot in the activation block (aka frame) of the current function. Implemented as an instantiation of the
temp::Identifier
scheme.
File: temp-set.* (src/temp/)
A set of temporaries, along with its
operator<<
.
File: test-temp.cc (src/temp/)
Unit tests.