File: annotations.tex

package info (click to toggle)
mlton 20210117%2Bdfsg-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 58,464 kB
  • sloc: ansic: 27,682; sh: 4,455; asm: 3,569; lisp: 2,879; makefile: 2,347; perl: 1,169; python: 191; pascal: 68; javascript: 7
file content (33 lines) | stat: -rw-r--r-- 1,448 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
\section{Annotations}

\subsection{Overview}
A compiler front-end has to be propagate information to
the back-end.  An optimization phase may have to leave behind information
at various places of the IR so that other phases can reuse such information.
MLRISC uses the \newdef{annotations}
mechanism for these functions.  
Individual instructions, basic blocks, and flow graph edges, 
can be attached one or more annotations.  

The basic MLRISC system understands many annotations.  Some examples are:
\begin{description}
   \item[COMMENT] 
         these can be used to attach comments.  If attached to
         an instruction, the assemblers will output 
         them as part of their assembly output.
   \item[BRANCH\_PROB]
          these can be attached to a branch instruction to indicate
          the probability in which is it taken.
   \item[EXECUTION\_FREQ]
          these can be attached to a basic block to indicate 
          its expected execution frequency 
\end{description}

\subsection{Details}
The primitive annotations datatype is defined
to have this \mlrischref{library/annotations.sig}{signature}.
In addition, MLRISC predefined a few primitive annotations that are
recognized by the core system.  This signature is
\mlrischref{instructions/mlriscAnnotations.sig}{MLRISC\_ANNOTATIONS}.
More detailed documentation can be found in this 
\href{http://cm.bell-labs.com/cm/cs/what/smlnj/compiler-notes/annotations.ps}{paper}.