Maintenance Info¶
Getitem Areas¶
The functions
getitem
and
freearea
(in
salloc.c)
are used to allocate
small pieces of dynamic memory and free them in a single operation.
There are
ANUM
(see definition of ANUM
in salloc.c)
“areas”,
numbered 0 thru ANUM-1
, which can be used.
They are used within the compilers as follows:
Area |
Names |
Use/Lifetime |
0 |
none |
item lists (FTN). Semantic analyzer. Freed during semant (FTN). |
1 |
none |
DOINFO records (FTN). Freed at end of semant. |
^ |
none |
Entry/exit argument processing by the expander (FTN). Freed at end of expand. |
^ |
none |
Predecessor lists. Scheduler. Freed after each block. |
2 |
none |
reserved |
3 |
none |
Statement function, variable format expression, and adjustable array info (FTN); freed at end of semant. Statement function, [NO]SEQUENCE info, and access info (Fortran); freed at end of semant. |
4 |
none |
Constant tree saved until end of program unit (FTN). Semantic Analyzer. |
5 |
none |
Constant tree saved and freed at end of semant (FTN). Semantic Analyzer. |
6 |
none |
Equivalence group lists (FTN). Freed at end of semant. |
7 |
none |
reserved |
8 |
none |
Temporary filenames and pathnames space. Freed at end of compilation. |
^ |
PERM_AREA |
Permanent area, freed at the end of compilation. |
9 |
none |
reserved |
10 |
TRANS_AREA |
Area used by the Fortran transformer. |
11 |
USE_AREA |
Fortran USE statement processing; lifetime is during processing of a block of USE statements (semant); freed by semant after immediately after all USE statements have been processed. |
^ |
FORALL_AREA |
For converting foralls to do’s during the comm and outconv Fortran passes. |
12 |
none |
pragma/directives |
13 |
none |
pragma/directives |
14 |
none |
reserved |
15 |
none |
Fortran Constant trees and initializer variable lists for dinits, based common variables, equivalence group lists, and do loop variables, Created during semant and saved until end of program unit. |
16 |
DEBUG_MODULE_AREA |
F90 backend only, module debug info |
16 |
none |
reserved |
17 |
none |
reserved |
18 |
MOD_AREA |
Fortran export/import processing: used to collect symbols, etc. to be written to the interface file or read from the interface; lifetime is an invocation of export() or import(). |
19 |
APPEND_AREA |
Fortran semantic processing of a module contained subprogram; used to collect the information associated with a contained subprogram which is to be appended to the module file; lifetime is during between mod_add_subprogram() and mod_end_subprogram(). |
20 |
DWF_CU_AREA |
Area needed to store dwarf information for an entire compilation unit. |
21 |
DWF_FUNC_AREA |
Area needed to store dwarf information for a function. |
22 |
none |
reserved |
23 |
none |
reserved |
24 |
CCFFAREA |
Area to store CCFF messages before outputting to .CCFF section. |
25 |
LLVM_LONGTERM_AREA |
Area for LLVM code generation. Remains active across compilation of all routines. |
26 |
none |
reserved |
27 |
none |
reserved |
28-29 |
currently unused |
Compiler Created Symbols¶
Compiler created symbols are generally allocated by calling
the function
getccsym
(in
symtab.c) and
getccsym_sc
(in
symtab.c).
It forms a name of the form
'.<letter><4``digits>'
and calls
``getsym
to enter the symbol. Below are the prototypes for the
getccsym
and
getccsym_sc
functions:
int getccsym(int letter, int n, int stype);
int getccsym_sc(int letter, int n, int stype, int sc);
The following describes the function arguments:
letter
- the character specifying the prefix letter of temporary name
n
- The number (represented as 4 digits) appended onto the temporary name
stype
- the symbol table type (ST type) to assign to the temporary
sc
- (for
getccsym_sc()
only) the storage class to assign to the temporary
The following table shows the letters used within the compilers for compiler created symbols:
Letter |
Language |
Index |
Use |
_ |
|||
A |
ftn,fe90 |
counter |
array bounds temp |
B |
all |
stb.lbavail |
compiler created label |
C |
fe90 |
counter |
scalar temporary |
D |
fe90 |
counter |
descriptor actual argument for intrinsics (semfunc). |
E |
reserved |
||
F |
reserved |
||
G |
reserved |
||
H |
reserved |
||
I |
reserved |
||
J |
f90 |
expb.swtcnt |
switch array (exputil) |
K |
reserved |
||
L |
reserved |
||
M |
reserved |
||
N |
reserved |
||
O |
fe90 |
counter |
type descriptor dummy arguments (semfin) |
P |
reserved |
||
Q |
C,ftn,f90 |
expb.gentmps |
Expander miscellaneous temps |
R |
C,ftn,f90 |
expb.retcnt |
return label |
S |
C |
stack_no |
terminal stack |
S |
f90 |
gbl.currsub |
display temporary |
T |
ftn,f90 |
expb.chartmps |
char temp |
U |
ftn,f90 |
expb.chardtmps |
char desc or char length for CHARACTER*(*) dummy |
U |
ftn,f90 |
arg |
char desc or char length for host CHARACTER*(*) dummy |
V |
reserved |
||
W |
reserved |
||
X |
reserved |
||
Y |
reserved |
||
Z |
ftn,fe90 |
sptr |
associated pointer variable for non-POINTER allocatable array |
Letter |
Language |
Index |
Use |
_ |
|||
a |
C,ftn,f90 |
expb.arglcnt.next |
array temp for an argument list |
b |
C,fe90 |
sem.blksymnum |
un-named block name |
c |
C,ftn,f90 |
sptr |
temp representing address of an argument |
d |
fe90 |
sem.dtemps |
various misc. temporaries |
e |
reserved |
||
f |
reserved |
||
g |
reserved |
||
h |
reserved |
||
i |
C,ftn,fe90 |
sem.itemps |
semant compiler temporary (not shared across statements) |
j |
not used |
||
k |
reserved |
||
l |
reserved |
||
m |
reserved |
||
n |
reserved |
||
o |
reserved |
||
p |
not used |
||
q |
reserved |
||
r |
reserved |
||
s |
reserved |
||
t |
reserved |
||
u |
reserved |
||
v |
reserved |
||
w |
reserved |
||
x |
reserved |
||
y |
reserved |
||
z |
ftn,f90 |
sptr |
base of allocatable common |
Compiler created symbols may also be created by calling
getccssym
(in
symtab.c)
which uses a string instead of a letter as a prefix.
getccssym
forms a name of the form
'.<prefix><4``digits>'
and calls
``getsym
to enter the symbol.
Below is the prototype for the
getccssym
function:
int getccssym(char \*pfx, int n, int stype);
The following describes the arguments:
pfx
- the prefix string for the temporary
n
- the number (integer represented with 4 digits) added after the prefix string
stype
- the symbol table type (ST type) to assign to the temporary.
The following table shows the prefixes used within the compilers:
Prefix |
Language |
Use |
_ |
||
dX |
f90 |
do index temp |
dY |
f90 |
do end temp |
de |
f90 |
OpenMP doend temp |
di |
f90 |
do increment temp |
dr |
f90 |
OpenMP runtime-scheduler temp |
ds |
f90 |
do step temp for OpenMP block-cyclic loops |
dy |
f90 |
do end temp for OpenMP block-cyclic loops |
sr |
all |
scalar temp for scalar replacement |
wi |
all |
wider (int) temp for replacing narrow int scalars |
For the Fortran compiler, compiler-created temporaries which are user-visible
are allocate by calling the functions
getcctmp
(in
symtab.c).
and
getcctmp_sc
(in
symtab.c).
It forms a name of the form
'z_<letter>_<digits>'
and calls
getsym
to enter the symbol.
The number represented by <digits>
ranges from 0 to 9999.
Only lower case letters are allowed.
Below are the prototypes for the
getcctmp
and
getcctmp_sc
functions:
int getcctmp(int letter, int n, int stype, int dtype);
int getcctmp_sc(int letter, int n, int stype, int dtype, int sc);
The following describes the function arguments:
letter
- the character specifying the prefix letter of temporary name
n
- The number (an integer) appended onto the temporary name
stype
- the symbol table type (ST type) to assign to the temporary
sc
- (for
getcctmp_sc()
only) the storage class to assign to the temporary
Note: for
getcctmp()
, the storage class of the temporary is
SC_LOCAL
The following table shows the letters used within the compilers for compiler created temporaries:
Letter |
Language |
Use |
_ |
||
a |
Fortran |
array temporaries |
b |
Fortran |
array bounds temporaries |
c |
Fortran |
array constant temporaries |
d |
Fortran |
bound of the shape of the dim specified in an intrinsic; misc. temporaries |
e |
Fortran |
shared array bounds temporaries; sharing is based on the value (ast) of the bounds expression. |
f |
Fortran |
array-valued function |
g |
reserved |
|
h |
not used |
|
i |
Fortran |
scalar non-character temps for semant |
j |
not used |
|
k |
not used |
|
l |
Fortran |
label variable temporaries |
m |
not used |
|
n |
not used |
|
o |
not used |
|
p |
not used |
|
q |
quad temps |
|
r |
Fortran |
redundss shared temps base on the ast value |
s |
Fortran |
scalar character temps for semant |
t |
Fortran |
scalar character temps for semant created for a character contstant which is substring |
u |
not used |
|
v |
not used |
|
w |
not used |
|
x |
not used |
|
y |
not used |
|
z |
not used |
SYMTAB Utility¶
The SYMTAB utility reads a specially formatted troff document, a symbol table include file, and a symbol table initialization file. It writes another troff document that will become the symbol table chapter in the maintenance document, the include file for the symbol table in the compiler source, and a file of data definitions for the compiler source.
Troff Document¶
The symbol table troff document consists of text interspersed with macros. The symbol table macros have the following meanings:
- .OC B width
Begin overloading class definitions. width is the width of the widest overloading class name plus a little (for .ip).
- .OC name
Name of an overloading class. Should be followed by descriptive text.
- .SF B width
Begin shared field definitions. width is the width of the hanging tag.
- .SF name [where]
Name of a shared field. where is the location of the field in the form wordspec[:fieldspec] where wordspec is w*n* meaning word n, and fieldspec is h*n* meaning halfword n, b*n* meaning byte n, or b*n-m* meaning bytes m-n (used for flags only). Halfwords and bytes are numbered left to right starting with 1.
The field name “flags” is special. It is the field that contains the flag values (single bits). For this field alone, a range of bytes or halfwords can be specified using (mi. The .FL macro specifies values for this field.
- .ST B width
Begin symbol type definitions.
- .ST E
End symbol type definitions.
- .ST name
Specify a symbol type definition. name is the symbol type name.
- .Sc B width
Begin storage class definitions.
- .Sc E
End storage class definitions.
- .Sc name
Specify a storage class definition. name is the storage class name.
- .SM stype [stype …]
Specify a symbol definition for the given stype. The symbol has all shared fields unless they are overridden by a .SE for this symbol. The macro generates a new page and a section header for the symbol. The picture goes immediately after the section header. Note that the picture is generated automatically from the following .SE lines.
- .SM E
End of symbol definitions.
- .SE name [where]
Specify a symbol element (field) for the current symbol type. name is the name of the field. where only needs to be specified if a field of this name has not yet been defined; it gives the location and size of the field as defined above for .SF.
- .SI oclass sname [sname …]
Specify symbol information for the current symbol type. oclass is the overloading class for this symbol type. sname is the textual name (e.g., pointer, label) corresponding to the symbol type specified on the .SM line. This macro generates no output in the troff document, only in the utility output.
- .FL name [where]
Specify a flag. name is the name of the flag. where is the flag number in the form f*n*, where is*the bit number in the *flags field. Bits are numbered left to right starting at 1. All flags must have different bits assigned to them.
- .TY B width
Begin the type word definitions. width is the width of the hanging tag.
- .TY E
End the type word definitions.
- .TY name attr [attr …]
Specify a type word. name is the name of the type word. attr is an attribute of the type (e.g., INT, SCALAR) used to define the DT_ISxxx macros.
- .DT name [name …]
Specify a data type record. The picture goes right after this macro. name should be the type word in the first word of the record (e.g., TY_ENUM). This is used for complex data types. The elements of the record are specified using .DE macros.
- .DE name
Define the next element of the current data type record. This should be followed by descriptive text.
- .PD B width
Begin the predefined data type definitions. width is the width of the hanging tag.
- .PD E
End the predefined data type definitions.
- .PD name sname def [def …]
Define a predefined data type record. name is the index in the data type area used to access the record (e.g., DT_INT). sname is a descriptive textual name (e.g., int, char *). def defines the record. Each def defines one word of the record.
Include File¶
The symbol table include template is a C header file containing predefined header information interspersed with macro lines. The macro lines begin with a period and are replaced with the appropriate information as follows:
- .ST
Symbol types
- .TY
Data type words (TY_)
- .TA
Type attributes (DT_ISINT, etc.)
- .Sc
Storage classes
- .OC
Overloading classes
- .SE
Symbol field access macros
Data File and Symbol Init¶
The data initialization file is written from information gathered from the symtab document and the symbol initialization file. Symbol initialization file:
- .ST
field[=value] [field[=value] …]
- .SM
name [value …] .ST defines a template for following .SM up to end or next .ST. Fields that are initialized with =value are duplicated for each .SM; other fields are set with values taken from macro line in same order as specified in template line. Other fields are set to zero.