Document alias defs.

The diagram showing the basics of how alias defs work is in a spearate file
because it created to much clutter in the header file.
This commit is contained in:
Bill Currie 2012-12-09 19:43:12 +09:00
parent 061e2be5d4
commit 054d902d3a
4 changed files with 49 additions and 3 deletions

View file

@ -1770,7 +1770,7 @@ DOT_PATH =
# contain dot files that are included in the documentation (see the
# \dotfile command).
DOTFILE_DIRS =
DOTFILE_DIRS = @TOPSRC@/tools/qfcc/doc/dot
# The MSCFILE_DIRS tag can be used to specify one or more directories that
# contain msc files that are included in the documentation (see the

View file

@ -2,4 +2,5 @@ AUTOMAKE_OPTIONS= foreign
SUBDIRS= man
EXTRA_DIST= expressions.txt
EXTRA_DIST= expressions.txt \
dot/vector-alias.dot

View file

@ -0,0 +1,25 @@
digraph vector_alias {
rankdir=LR;
subgraph types {
rank = same;
vector [fontsize=10,label="type\nvector"];
float [fontsize=10,label="type\nfloat"];
}
subgraph alias {
vec [fontsize=10,shape=record,label="<v>vec|<n>next|<t>type|<a>alias|<d>alias_defs|offset ?|..."];
vec_x [fontsize=10,shape=record,label="<v>vec.x|<n>next|<t>type|<a>alias|<d>alias_defs|offset 0|..."];
vec_y [fontsize=10,shape=record,label="<v>vec.y|<n>next|<t>type|<a>alias|<d>alias_defs|offset 1|..."];
vec_z [fontsize=10,shape=record,label= "<v>vec.z|<n>next|<t>type|<a>alias|<d>alias_defs|offset 2|..."];
}
vector -> float [style=invis];
vec:t -> vector [weight=2];
vec_x:t -> float [weight=2];
vec_y:t -> float [weight=2];
vec_z:t -> float [weight=2];
vec:d -> vec_z:v [weight=5];
vec_z:n -> vec_y:v [weight=15];
vec_y:n -> vec_x:v [weight=15];
vec:v -> vec_z:a [dir=back,weight=4];
vec:v -> vec_y:a [dir=back,weight=4];
vec:v -> vec_x:a [dir=back,weight=4];
}

View file

@ -54,15 +54,35 @@ struct expr_s;
*/
typedef struct def_s {
struct def_s *next; ///< general purpose linking
struct def_s *temp_next; ///< linked list of "free" temp defs
struct type_s *type; ///< QC type of this def
const char *name; ///< the def's name
struct defspace_s *space; ///< defspace to which this def belongs
int offset; ///< address of this def in its defspace
/** \name Def aliasing.
Aliasing a def provides a different view of the def providing access
via a different type, or access to members of structs, unions and
arrays.
Alias defs are very simple: they store only the type and relative
offset off the def they alias. All other information is held in the
def they alias, including relocation records. However, they do keep
track of the source file and line that first created the alias.
The relations between a def an any of its aliases are maintained by
a linked list headed by def_t::alias_defs and connected by
def_t::next. def_t::alias is used to find the main def via one if its
aliases. The order of the aliases in the list is arbitrary: it is the
reverse of the order in which they were created.
\dotfile vector-alias.dot "Accessing a vector via its components."
*/
//@{
struct def_s *alias_defs; ///< defs that alias this def
struct def_s *alias; ///< real def which this def aliases
//@}
struct reloc_s *relocs; ///< for relocations
struct expr_s *initializer;///< initialer expression
struct daglabel_s *daglabel;///< daglabel for this def