<project.out>
Disclaimer: This description may not always be correct up to the
last "new line" character or exact number of "=" signs or white spaces.
Second Disclaimer: If something strikes you as not being useful
or as irrelevant to you, you are probably right... :-)
In this file, the following information is stored:
-
symbol table
-
the parse tree of the program
-
the declarations of functions/procedures
-
(user defined) dummy dependencies
-
symbol table, part II ("pretty names")
Read: Directory scanpars2 File Parser.cc Function
Load
Write: Directory scanpars2 File Parser.cc Function
Save
Format
For the description of the format, we use the following symbols:
[...] ... optional construct
{...} ... possible repetition of a construct
| ... alternative
--> ... definition of a non-terminal
<nl> ... new line character
\" ... quote (or inch) sign
This file is built as follows:
File -->
SymbolTable:<nl><nl><SymTab>SymbolTable END<nl><nl>
[MainProgram:<nl><nl><LaNodes><nl><nl>]
[Functions:<nl><nl><FctDecls><nl><nl>]
[Dependencies:<nl><nl><DummyDeps><nl><nl>]
// number of indices <NrInd><nl>
// number of blobs <NrBlobs><nl>
// number of stmnts <NrStats><nl>
// number of arrays <NrArrays><nl>
// last LaNode ID <lastLaNodeID><nl><nl><nl>
<PrettyNames>
The entries NrInd, NrBlobs, NrStats, NrArrays, lastLaNodeID are integers
giving the corresponding numbers. The other constructs are built as follows:
Symbol-Table (<SymTab>)
Syntax
SymTab -->
{<FrameDesignator>
{<SymTabEntry>}
}
FrameDesignator -->
================<nl>
// frame <frameNr><nl>
================<nl>
SymTabEntry -->
================<nl>
// lexem <lexem><nl>
// token <token><nl>
// type <type><nl>
// number <number><nl>
// indices <indices><nl>
// level <level><nl>
// intent <intent><nl>
// basictype <basictype><nl>
// identify <identity><nl>
// status <status><nl>
// next <ptrInfo><nl>
// leftchild <ptrInfo><nl>
// rightchild <ptrInfo><nl>
<bounds>
bounds --> nobounds |
{
===========<nl>
<LaExpr>
}
LaExpr -->
<NumInd><nl>{<integer><nl>}
<Const><nl>
<NumBlob><nl>{<integer><nl>}
<Denom><nl>
<nextLaExpr><nl>
nextLaExpr --> 0|1
Semantics
The symbol table is divided into frames. Each user defined function/procedure
and the main-program has an own frame. The `main`-program owns frame 1
and a user defined function/procedure with number n owns the frame (n+1);
a predefined function/procedure with number -n owns a frame -n-1. For predefined
functions, the default behaviour is to take no or only input arguments;
for these functions, no frame is stored.
A symbol table entry contains the following information:
-
lexem: the string associated with the entry
-
token: the scanner token that lead to the entry
-
type: value Index, Blob, Array, Function, Proto
(defined in LaNode_global.h; Proto is a dummy argument); these entries
are a subset of LaNode states
-
number: for each type, the entries of that type are enumerated starting
with 1 (the type/number-pair is the unique identifier of a symbol table
entry within a frame; predefined functions have negative numbers)
-
indices: number of index dimensions of an array variable (no indices: -1)
-
level: the loop depth in which the first use of that lexem occurred
-
intent: intent of a dummy argument; value loopoParser::IN, loopoParser::OUT,
loopoParser::INOUT; these are the tokens as defined in grammar.y/loopoParser.h!
-
basictype: the type of a variable or return type of a function, respectively;
values: UNKNOWN_, VOID_, INT_, BOOL_, FLOAT_, TEMPLATE_, PROCESSOR_ (defined
in grammar.y/loopoParser.h)
-
identify: unique variable identifier to distinguish between variables of
different projects (different parser objects) in targout
-
status: bitvector with bits defined in symtab.h:
-
node::CLEAR: no bit set
-
node::VALID: avoids nested loops with the same index variable
-
node::PURE: marks a function as PURE
-
node::NO_WARN: avoids warning for unused parameter
-
node::DYNAMIC: indicates a dynamic array (whose extent may change during
run-time; normloops uses this kind of arrays)
-
node::LOCAL: indicates an array that is local to each process (used by
targout)
-
node::PSEUDO: indicates a pseudo parameter (used by the dependence test)
-
node::NORMLOOPS: indicates a normloops parameter (that will be processed
by retloops)
-
node::ASSIGN_IDX: indicates an index variable that holds the actual index
value of a strip-mined dimension, introduced by the tiling module; this
value is assigned in a loop whose lower bound is equal to its upper bound
-
next/leftchild/rightchild: values 0 (if the node has no successor in the
corresponding field), 1 (if the node does have a successor in the corresponding
field); if there are successors in one or more fields, these successors
are given in preorder and in the order of the entries (next, left, right)
directly after the current node; leftchild/rightchild are used to produce
a binary search tree on the lexem, while next is a "replacement" for an
identifier
-
bounds: nobounds indicates an array whose bounds are not explicitly defined;
explicitly defined bounds are given as sequence of LaExprs: for each dimension
(beginning with the leftmost one), first the lower, then the upper bound
is given as a LaExpr (with NumInd and NumBlob giving the number of indices
and blobs, respectively, whose coefficients are given directly after NumInd/NumBlob)
Main Program/Functions (<LaNodes>/<FctDecls>)
Syntax
The main program is given by a sequence of LaNodes:
LaNodes --> {<LaNode>}
FctDecls --> {<LaNode_verb>}
Normally, the output format is "compressed" (i.e. not really human readable),
there is also a "verbose-save-mode" that is described below. The normal
format is:
LaNode --> [InfoVect: {<ModNr>} -1]<nl>[{ModTag}] <LaNodeBase>
LaNodeBase --> <ID> <occ> <type> <name> <state> <stmnt> <op> <Tstmnt> <step> <up> <low>
<cond> <indices> <children> <elsechild> <arguments> <next> \"<label>\" #
This output format will be used in verbose-save-mode:
LaNode_verb -->
================<nl>
// typ <type><nl>
// name <name><nl>
// state <state><nl>
// stmnt <stmnt><nl>
// ID <ID><nl>
// occ_ID <occ><nl>
// op <op><nl>
// Tstmnt <Tstmnt><nl>
// step <step><nl>
// up <up><nl>
// low <low><nl>
// cond <cond><nl>
// indices <indices><nl>
// children <children><nl>
// elsechild <elsechild><nl>
// arguments <arguments><nl>
// next <next><nl><nl>
This output format is used for functions/procedures.
Semantics
A LaNode contains the following information:
-
type: the type of the LaNode as defined in LaNode_global.h:
-
Assign: an assignment; the name of the LaNode
is the name of the variable to be assigned to, the state may give an alternate
kind of variable (blob, index) instead of the default (array); however,
this feature should not be used; the child pointer contains the expression
to be assigned
-
Expr: an algebraic expression; if this is a composed
expression (operator), children contains the left operand, elsechild the
right operand; parentheses (BRACKET) point to the parenthesized expression
in the children pointer
-
Skip: SKIP statement
-
Forloop: a FOR loop; the children pointer points
to the loop body; index contains the number of the index variable associated
with the loop; at least low and up should point to expressions, step may
be NULL, which means default stride (1);
op may give additional information about
the loop (defined in LaNode_global.h):
-
Do: loop is sequential
-
DoAll: loop is completely parallel
-
DoAcross: loop that is marked as parallel but carries a dependence (this
should only be set by targout)
-
Whileloop: WHILE loop; index contains the number
of an index variable associated with the loop; cond points to the while-condition
(an expression); children points to the loop body
-
If: IF statement; cond points to the condition; children
points to the then-branch, elsechild (if present) to the else-branch
-
Fctdecl: function declaration, only used in the "Functions:" section
-
Proccall: procedure call; arguments points to an argument
list
-
Label: label as target of a goto; label is
a string that defines the label for this place in the program text
-
Goto: goto; label contains the label string
of the jump target
-
name: if the LaNode represents an identifier, this is its "name" -- a number
(starting from 1), assigned to indices, blobs, arrays, functions (including
procedures) separately; predefined functions have names <0
-
state: there are different LaNode states defined in LaNode_global.h:
-
ReadWrite: comnbined read-and-write access to an
array (intent inout actual argument to a function/procedure); name contains
the name of the array, indices points to the list of index expressions
-
Read: read access to an array (name/indices, see above
)
-
Write: write access to an array (name/indices, see above
)
-
Const: an integer constant (in an expression)
-
Index: an index variable (in an expression)
-
Blob: a blob (in an expression)
-
Array: general array access (in an expression); only used as type
in symbol table entries
-
Key: for internal purposes; currently unused
-
Function: this is actually only used in the context of symbol
table entries; since indices/blobs/arrays each have their own list
in the symbol table (just as functions), this is a theoretically possible
value in this field
-
FunctionCall: function call (as part of an expression); arguments
points to an argument list
-
Proto: only used in the context of symbol
table entries
-
Various: in a function declaration, a state of "Various" indicates that
the function may take a varying number of arguments (such as min(...),
max(...))
-
Statement_: auxiliary value for internal use only
-
stmnt: the number of the statement a LaNode belongs
to; control structures do not have statement numbers; only the first node
of a statement is required to have the statement number set
-
ID: the unique LaNode ID assigned to a LaNode by its constructor; this
ID is used in the accesses and access pairs files (.acc and .acp, respectively)
-
occ_ID: the original occurrence of a LaNode; at a given point, occurrence
numbers are assigned to all points in the program text; these are stored
here
-
op: in a LaNode representing a compound expression,
the op-entry gives the operator represented by this LaNode; possible values
(defined in grammar.y/loopoParser.h):
-
loopoParser::PARALLEL: children/elsechild point to subtrees that can be
executed in parallel
-
loopoParser::If: C-style-?-operator, cond points to a condition, children
to the then-branch, elsechild (if present) to the else-branch
-
other operators: loopoParser::NOT, loopoParser::LE, loopoParser::LEQ, loopoParser::EQ,
loopoParser::EQEQ (same as EQ), loopoParser::NEQ, loopoParser::GEQ, loopoParser::GE,,
loopoParser::AND, loopoParser::OR, loopoParser::PLUS, loopoParser::MINUS,
loopoParser::TIMES, loopoParser::DIV, loopoParser::, loopoParser::MOD
-
Tstmnt: the target statement number of a statement (see also stmnt);
since statements may be copied, several target statements may result from
a single (input) statement in the output program
-
step: pointer to the stride of a loop (see Forloop)
-
up: pointer to the upper bound of a loop (see Forloop)
-
low: pointer to the lower bound of a loop (see Forloop)
-
cond: pointer to the condition of a WHILE loop
loop or IF statement
-
indices: pointer to the indices of an array access; these are represented
as a list of LaNodes (from leftmost to rightmost) that are connected via
their next-pointers
-
children: in WHILE loops and FOR
loops a pointer to the loop body, in IF statements
a pointer to the then-branch, in assignments
a pointer to the expression to be assigned, in expressions
a pointer to the left operand (in parantheses [BRACKET expressions] the
paranthesized expression)
-
elsechild: in IF statements a pointer to the
else-branch, in expressions a pointer
to the right operand; in special parallel loops (in targout), this pointer
may also be used to represent any point outside of the current extent of
the loop but inside the processor field
-
arguments: argument list of a function or procedure
call; the sequence of actual arguments is a list of LaNodes connected via
the next-pointer
-
next: next node in the program (after the complete construct represented
by this node)
If a LaNode has a child in one of the pointer
fields
-
step
-
up
-
low
-
cond
-
indices
-
children
-
elsechild
-
arguments
-
next
the entry saved in the file is 1 for a child node that is present and 0
if no child node for that field is present; the corresponding child nodes
are saved in preorder search with the different LaNodes (step/up/low/...)
sorted in the same order as the information whether these nodes are present.
Dependencies (<DummyDeps>)
Syntax
DummyDeps --> {LaDep}<nl>
LaDep -->
// rows <rows><nl>
// columns <cols><nl>
// denom <denom><nl>
// matrix<nl>
{{<integer>}<nl>}
// first dependent statement <src><nl>
// second dependent statement <dest><nl>
// next <nextDummyDep><nl>
nextDummyDep --> 0|1
Semantics
For each user defined dependence, a LaDep is created that holds the rows
and columns of the matrix representing the h-transformation in the correspondig
entry; denom is the common denominator of the complete matrix; the matrix
itself (in homogeneous coordinates) is then stored row-by-row on separate
lines (with only integer entries). src is the number of the source statement,
dest the number of the destination statement of the dependence. next is
a pointer to the next user defined dependence (stored just like the pointers
in LaNodes).
Symbol Table, Part II (<PrettyNames>)
Syntax
PrettyNames -->
{<FrameDesignator>
{<origName> -> <prettyName>;<nl>}
}
Semantics
For each frame, the names of identifiers is stored in the origName fields;
symbol table entries may also have an entry in their "pretty" field which
indicates that this pretty name is to be preferred for printing. Pretty
names are set by targout.
Andreas Dischinger, 26 Nov 1997; revised: Peter Faber, 2001-10-10