blob: 7916a0e0551321781fca7dd29c77b0653013b820 [file] [log] [blame]
Chris Lattnerbdfb3392004-01-05 05:06:33 +00001<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
2 "http://www.w3.org/TR/html4/strict.dtd">
3<html>
4<head>
5 <title>Source Level Debugging with LLVM</title>
6 <link rel="stylesheet" href="llvm.css" type="text/css">
7</head>
8<body>
9
10<div class="doc_title">Source Level Debugging with LLVM</div>
11
Reid Spencerd3f876c2004-11-01 08:19:36 +000012<table class="layout" style="width:100%">
13 <tr class="layout">
14 <td class="left">
Chris Lattnerbdfb3392004-01-05 05:06:33 +000015<ul>
Misha Brukman82873732004-05-12 19:21:57 +000016 <li><a href="#introduction">Introduction</a>
Chris Lattnerbdfb3392004-01-05 05:06:33 +000017 <ol>
18 <li><a href="#phil">Philosophy behind LLVM debugging information</a></li>
Jim Laskey383e0092006-03-23 17:54:33 +000019 <li><a href="#consumers">Debug information consumers</a></li>
Chris Lattnerbdfb3392004-01-05 05:06:33 +000020 <li><a href="#debugopt">Debugging optimized code</a></li>
Misha Brukman82873732004-05-12 19:21:57 +000021 </ol></li>
Misha Brukman82873732004-05-12 19:21:57 +000022 <li><a href="#format">Debugging information format</a>
Chris Lattnerbdfb3392004-01-05 05:06:33 +000023 <ol>
Jim Laskeycec12a52006-03-14 18:08:46 +000024 <li><a href="#debug_info_descriptors">Debug information descriptors</a>
Chris Lattnerbdfb3392004-01-05 05:06:33 +000025 <ul>
Jim Laskeycec12a52006-03-14 18:08:46 +000026 <li><a href="#format_anchors">Anchor descriptors</a></li>
27 <li><a href="#format_compile_units">Compile unit descriptors</a></li>
28 <li><a href="#format_global_variables">Global variable descriptors</a></li>
29 <li><a href="#format_subprograms">Subprogram descriptors</a></li>
Jim Laskey3d11bee2006-03-15 19:10:52 +000030 <li><a href="#format_blocks">Block descriptors</a></li>
Jim Laskeycec12a52006-03-14 18:08:46 +000031 <li><a href="#format_basic_type">Basic type descriptors</a></li>
32 <li><a href="#format_derived_type">Derived type descriptors</a></li>
33 <li><a href="#format_composite_type">Composite type descriptors</a></li>
34 <li><a href="#format_subrange">Subrange descriptors</a></li>
35 <li><a href="#format_enumeration">Enumerator descriptors</a></li>
Jim Laskey383e0092006-03-23 17:54:33 +000036 <li><a href="#format_variables">Local variables</a></li>
Misha Brukman82873732004-05-12 19:21:57 +000037 </ul></li>
Jim Laskeycec12a52006-03-14 18:08:46 +000038 <li><a href="#format_common_intrinsics">Debugger intrinsic functions</a>
39 <ul>
40 <li><a href="#format_common_stoppoint">llvm.dbg.stoppoint</a></li>
41 <li><a href="#format_common_func_start">llvm.dbg.func.start</a></li>
42 <li><a href="#format_common_region_start">llvm.dbg.region.start</a></li>
43 <li><a href="#format_common_region_end">llvm.dbg.region.end</a></li>
44 <li><a href="#format_common_declare">llvm.dbg.declare</a></li>
45 </ul></li>
46 <li><a href="#format_common_stoppoints">Representing stopping points in the
47 source program</a></li>
Misha Brukman82873732004-05-12 19:21:57 +000048 </ol></li>
49 <li><a href="#ccxx_frontend">C/C++ front-end specific debug information</a>
Chris Lattnerbdfb3392004-01-05 05:06:33 +000050 <ol>
Jim Laskeycec12a52006-03-14 18:08:46 +000051 <li><a href="#ccxx_compile_units">C/C++ source file information</a></li>
52 <li><a href="#ccxx_global_variable">C/C++ global variable information</a></li>
53 <li><a href="#ccxx_subprogram">C/C++ function information</a></li>
54 <li><a href="#ccxx_basic_types">C/C++ basic types</a></li>
55 <li><a href="#ccxx_derived_types">C/C++ derived types</a></li>
56 <li><a href="#ccxx_composite_types">C/C++ struct/union types</a></li>
57 <li><a href="#ccxx_enumeration_types">C/C++ enumeration types</a></li>
Misha Brukman82873732004-05-12 19:21:57 +000058 </ol></li>
Chris Lattnerbdfb3392004-01-05 05:06:33 +000059</ul>
Misha Brukman82873732004-05-12 19:21:57 +000060</td>
Reid Spencerd3f876c2004-11-01 08:19:36 +000061<td class="right">
Misha Brukmane849a1a2004-05-12 21:26:16 +000062<img src="img/venusflytrap.jpg" alt="A leafy and green bug eater" width="247"
Misha Brukman82873732004-05-12 19:21:57 +000063height="369">
64</td>
Reid Spencerd3f876c2004-11-01 08:19:36 +000065</tr></table>
Misha Brukman82873732004-05-12 19:21:57 +000066
Chris Lattner7911ce22004-05-23 21:07:27 +000067<div class="doc_author">
Jim Laskeycec12a52006-03-14 18:08:46 +000068 <p>Written by <a href="mailto:sabre@nondot.org">Chris Lattner</a>
69 and <a href="mailto:jlaskey@apple.com">Jim Laskey</a></p>
Chris Lattner7911ce22004-05-23 21:07:27 +000070</div>
71
Chris Lattnerbdfb3392004-01-05 05:06:33 +000072
73<!-- *********************************************************************** -->
Misha Brukman94218a72004-12-09 20:27:37 +000074<div class="doc_section"><a name="introduction">Introduction</a></div>
75<!-- *********************************************************************** -->
Chris Lattnerbdfb3392004-01-05 05:06:33 +000076
77<div class="doc_text">
78
79<p>This document is the central repository for all information pertaining to
Jim Laskeycec12a52006-03-14 18:08:46 +000080debug information in LLVM. It describes the <a href="#format">actual format
81that the LLVM debug information</a> takes, which is useful for those interested
82in creating front-ends or dealing directly with the information. Further, this
83document provides specifc examples of what debug information for C/C++.</p>
Chris Lattnerbdfb3392004-01-05 05:06:33 +000084
85</div>
86
87<!-- ======================================================================= -->
88<div class="doc_subsection">
89 <a name="phil">Philosophy behind LLVM debugging information</a>
90</div>
91
92<div class="doc_text">
93
Misha Brukman82873732004-05-12 19:21:57 +000094<p>The idea of the LLVM debugging information is to capture how the important
Chris Lattnerbdfb3392004-01-05 05:06:33 +000095pieces of the source-language's Abstract Syntax Tree map onto LLVM code.
96Several design aspects have shaped the solution that appears here. The
97important ones are:</p>
98
Misha Brukman82873732004-05-12 19:21:57 +000099<ul>
Chris Lattnerbdfb3392004-01-05 05:06:33 +0000100<li>Debugging information should have very little impact on the rest of the
101compiler. No transformations, analyses, or code generators should need to be
102modified because of debugging information.</li>
103
104<li>LLVM optimizations should interact in <a href="#debugopt">well-defined and
105easily described ways</a> with the debugging information.</li>
106
107<li>Because LLVM is designed to support arbitrary programming languages,
108LLVM-to-LLVM tools should not need to know anything about the semantics of the
109source-level-language.</li>
110
111<li>Source-level languages are often <b>widely</b> different from one another.
112LLVM should not put any restrictions of the flavor of the source-language, and
113the debugging information should work with any language.</li>
114
115<li>With code generator support, it should be possible to use an LLVM compiler
Chris Lattner8ff75902004-01-06 05:31:32 +0000116to compile a program to native machine code and standard debugging formats.
Chris Lattnerbdfb3392004-01-05 05:06:33 +0000117This allows compatibility with traditional machine-code level debuggers, like
118GDB or DBX.</li>
119
Misha Brukman82873732004-05-12 19:21:57 +0000120</ul>
Chris Lattnerbdfb3392004-01-05 05:06:33 +0000121
Misha Brukman82873732004-05-12 19:21:57 +0000122<p>The approach used by the LLVM implementation is to use a small set of <a
Chris Lattner8ff75902004-01-06 05:31:32 +0000123href="#format_common_intrinsics">intrinsic functions</a> to define a mapping
Chris Lattnerbdfb3392004-01-05 05:06:33 +0000124between LLVM program objects and the source-level objects. The description of
125the source-level program is maintained in LLVM global variables in an <a
Chris Lattner8ff75902004-01-06 05:31:32 +0000126href="#ccxx_frontend">implementation-defined format</a> (the C/C++ front-end
Chris Lattnerbdfb3392004-01-05 05:06:33 +0000127currently uses working draft 7 of the <a
128href="http://www.eagercon.com/dwarf/dwarf3std.htm">Dwarf 3 standard</a>).</p>
129
Jim Laskeycec12a52006-03-14 18:08:46 +0000130<p>When a program is being debugged, a debugger interacts with the user and
131turns the stored debug information into source-language specific information.
Jim Laskey3d11bee2006-03-15 19:10:52 +0000132As such, a debugger must be aware of the source-language, and is thus tied to
Jim Laskeycec12a52006-03-14 18:08:46 +0000133a specific language of family of languages.</p>
Chris Lattnerbdfb3392004-01-05 05:06:33 +0000134
135</div>
136
Chris Lattnerbdfb3392004-01-05 05:06:33 +0000137<!-- ======================================================================= -->
138<div class="doc_subsection">
Jim Laskey383e0092006-03-23 17:54:33 +0000139 <a name="consumers">Debug information consumers</a>
140</div>
141
142<div class="doc_text">
143<p>The role of debug information is to provide meta information normally
144stripped away during the compilation process. This meta information provides an
145llvm user a relationship between generated code and the original program source
146code.</p>
147
148<p>Currently, debug information is consumed by the DwarfWriter to produce dwarf
149information used by the gdb debugger. Other targets could use the same
150information to produce stabs or other debug forms.</p>
151
152<p>It would also be reasonable to use debug information to feed profiling tools
153for analysis of generated code, or, tools for reconstructing the original source
154from generated code.</p>
155
156<p>TODO - expound a bit more.</p>
157
158</div>
159
160<!-- ======================================================================= -->
161<div class="doc_subsection">
Chris Lattnerbdfb3392004-01-05 05:06:33 +0000162 <a name="debugopt">Debugging optimized code</a>
163</div>
164
165<div class="doc_text">
Chris Lattnerbdfb3392004-01-05 05:06:33 +0000166
Misha Brukman82873732004-05-12 19:21:57 +0000167<p>An extremely high priority of LLVM debugging information is to make it
168interact well with optimizations and analysis. In particular, the LLVM debug
169information provides the following guarantees:</p>
170
171<ul>
Chris Lattnerbdfb3392004-01-05 05:06:33 +0000172
173<li>LLVM debug information <b>always provides information to accurately read the
174source-level state of the program</b>, regardless of which LLVM optimizations
175have been run, and without any modification to the optimizations themselves.
176However, some optimizations may impact the ability to modify the current state
177of the program with a debugger, such as setting program variables, or calling
178function that have been deleted.</li>
179
180<li>LLVM optimizations gracefully interact with debugging information. If they
181are not aware of debug information, they are automatically disabled as necessary
182in the cases that would invalidate the debug info. This retains the LLVM
183features making it easy to write new transformations.</li>
184
185<li>As desired, LLVM optimizations can be upgraded to be aware of the LLVM
186debugging information, allowing them to update the debugging information as they
187perform aggressive optimizations. This means that, with effort, the LLVM
188optimizers could optimize debug code just as well as non-debug code.</li>
189
190<li>LLVM debug information does not prevent many important optimizations from
191happening (for example inlining, basic block reordering/merging/cleanup, tail
192duplication, etc), further reducing the amount of the compiler that eventually
193is "aware" of debugging information.</li>
194
195<li>LLVM debug information is automatically optimized along with the rest of the
196program, using existing facilities. For example, duplicate information is
197automatically merged by the linker, and unused information is automatically
198removed.</li>
199
Misha Brukman82873732004-05-12 19:21:57 +0000200</ul>
Chris Lattnerbdfb3392004-01-05 05:06:33 +0000201
Misha Brukman82873732004-05-12 19:21:57 +0000202<p>Basically, the debug information allows you to compile a program with
203"<tt>-O0 -g</tt>" and get full debug information, allowing you to arbitrarily
Jim Laskey3d11bee2006-03-15 19:10:52 +0000204modify the program as it executes from a debugger. Compiling a program with
Misha Brukman82873732004-05-12 19:21:57 +0000205"<tt>-O3 -g</tt>" gives you full debug information that is always available and
206accurate for reading (e.g., you get accurate stack traces despite tail call
207elimination and inlining), but you might lose the ability to modify the program
208and call functions where were optimized out of the program, or inlined away
209completely.</p>
Chris Lattnerbdfb3392004-01-05 05:06:33 +0000210
211</div>
212
Chris Lattnerbdfb3392004-01-05 05:06:33 +0000213<!-- *********************************************************************** -->
214<div class="doc_section">
Chris Lattner8ff75902004-01-06 05:31:32 +0000215 <a name="format">Debugging information format</a>
Chris Lattnerbdfb3392004-01-05 05:06:33 +0000216</div>
217<!-- *********************************************************************** -->
218
219<div class="doc_text">
220
221<p>LLVM debugging information has been carefully designed to make it possible
222for the optimizer to optimize the program and debugging information without
223necessarily having to know anything about debugging information. In particular,
224the global constant merging pass automatically eliminates duplicated debugging
225information (often caused by header files), the global dead code elimination
226pass automatically deletes debugging information for a function if it decides to
227delete the function, and the linker eliminates debug information when it merges
228<tt>linkonce</tt> functions.</p>
229
230<p>To do this, most of the debugging information (descriptors for types,
231variables, functions, source files, etc) is inserted by the language front-end
232in the form of LLVM global variables. These LLVM global variables are no
233different from any other global variables, except that they have a web of LLVM
234intrinsic functions that point to them. If the last references to a particular
235piece of debugging information are deleted (for example, by the
236<tt>-globaldce</tt> pass), the extraneous debug information will automatically
237become dead and be removed by the optimizer.</p>
238
Jim Laskeycec12a52006-03-14 18:08:46 +0000239<p>Debug information is designed to be agnostic about the target debugger and
240debugging information representation (e.g. DWARF/Stabs/etc). It uses a generic
241machine debug information pass to decode the information that represents
242variables, types, functions, namespaces, etc: this allows for arbitrary
243source-language semantics and type-systems to be used, as long as there is a
244module written for the target debugger to interpret the information. In
245addition, debug global variables are declared in the <tt>"llvm.metadata"</tt>
246section. All values declared in this section are stripped away after target
247debug information is constructed and before the program object is emitted.</p>
Chris Lattnerbdfb3392004-01-05 05:06:33 +0000248
Misha Brukman82873732004-05-12 19:21:57 +0000249<p>To provide basic functionality, the LLVM debugger does have to make some
Chris Lattnerbdfb3392004-01-05 05:06:33 +0000250assumptions about the source-level language being debugged, though it keeps
251these to a minimum. The only common features that the LLVM debugger assumes
Jim Laskeycec12a52006-03-14 18:08:46 +0000252exist are <a href="#format_compile_units">source files</a>, and <a
253href="#format_global_variables">program objects</a>. These abstract objects are
Jim Laskey3d11bee2006-03-15 19:10:52 +0000254used by a debugger to form stack traces, show information about local
Misha Brukman82873732004-05-12 19:21:57 +0000255variables, etc.</p>
Chris Lattnerbdfb3392004-01-05 05:06:33 +0000256
257<p>This section of the documentation first describes the representation aspects
Chris Lattner8ff75902004-01-06 05:31:32 +0000258common to any source-language. The <a href="#ccxx_frontend">next section</a>
259describes the data layout conventions used by the C and C++ front-ends.</p>
Chris Lattnerbdfb3392004-01-05 05:06:33 +0000260
261</div>
262
263<!-- ======================================================================= -->
264<div class="doc_subsection">
Jim Laskeycec12a52006-03-14 18:08:46 +0000265 <a name="debug_info_descriptors">Debug information descriptors</a>
Chris Lattnerbdfb3392004-01-05 05:06:33 +0000266</div>
267
268<div class="doc_text">
Jim Laskeycec12a52006-03-14 18:08:46 +0000269<p>In consideration of the complexity and volume of debug information, LLVM
270provides a specification for well formed debug global variables. The constant
271value of each of these globals is one of a limited set of structures, known as
272debug descriptors.</p>
Chris Lattnerbdfb3392004-01-05 05:06:33 +0000273
Jim Laskeycec12a52006-03-14 18:08:46 +0000274<p>Consumers of LLVM debug information expect the descriptors for program
275objects to start in a canonical format, but the descriptors can include
Jim Laskey383e0092006-03-23 17:54:33 +0000276additional information appended at the end that is source-language specific. All
277LLVM debugging information is versioned, allowing backwards compatibility in the
278case that the core structures need to change in some way. Also, all debugging
279information objects start with a tag to indicate what type of object it is. The
280source-language is allowed to define its own objects, by using unreserved tag
281numbers. We recommend using with tags in the range 0x1000 thru 0x2000 (there is
282a defined enum DW_TAG_user_base = 0x1000.)</p>
Jim Laskeycec12a52006-03-14 18:08:46 +0000283
284<p>The fields of debug descriptors used internally by LLVM (MachineDebugInfo)
285are restricted to only the simple data types <tt>int</tt>, <tt>uint</tt>,
286<tt>bool</tt>, <tt>float</tt>, <tt>double</tt>, <tt>sbyte*</tt> and <tt> { }*
287</tt>. References to arbitrary values are handled using a <tt> { }* </tt> and a
288cast to <tt> { }* </tt> expression; typically references to other field
289descriptors, arrays of descriptors or global variables.</p>
Chris Lattnerbdfb3392004-01-05 05:06:33 +0000290
Misha Brukman82873732004-05-12 19:21:57 +0000291<pre>
Jim Laskeycec12a52006-03-14 18:08:46 +0000292 %llvm.dbg.object.type = type {
293 uint, ;; A tag
294 ...
295 }
Misha Brukman82873732004-05-12 19:21:57 +0000296</pre>
Chris Lattnerbdfb3392004-01-05 05:06:33 +0000297
Jim Laskey7089f452006-06-16 13:14:03 +0000298<p><a name="LLVMDebugVersion">The first field of a descriptor is always an
299<tt>uint</tt> containing a tag value identifying the content of the descriptor.
300The remaining fields are specific to the descriptor. The values of tags are
301loosely bound to the tag values of Dwarf information entries. However, that
302does not restrict the use of the information supplied to Dwarf targets. To
303facilitate versioning of debug information, the tag is augmented with the
304current debug version (LLVMDebugVersion = 4 << 16 or 0x40000.)</a></p>
Jim Laskeycec12a52006-03-14 18:08:46 +0000305
Jim Laskey7089f452006-06-16 13:14:03 +0000306<p>The details of the various descriptors follow.</p>
Jim Laskeycec12a52006-03-14 18:08:46 +0000307
308</div>
309
310<!-- ======================================================================= -->
311<div class="doc_subsubsection">
312 <a name="format_anchors">Anchor descriptors</a>
313</div>
314
315<div class="doc_text">
316
317<pre>
318 %<a href="#format_anchors">llvm.dbg.anchor.type</a> = type {
Jim Laskey7089f452006-06-16 13:14:03 +0000319 uint, ;; Tag = 0 + <a href="#LLVMDebugVersion">LLVMDebugVersion</a>
Jim Laskeycec12a52006-03-14 18:08:46 +0000320 uint ;; Tag of descriptors grouped by the anchor
321 }
322</pre>
323
324<p>One important aspect of the LLVM debug representation is that it allows the
325LLVM debugger to efficiently index all of the global objects without having the
326scan the program. To do this, all of the global objects use "anchor"
327descriptors with designated names. All of the global objects of a particular
328type (e.g., compile units) contain a pointer to the anchor. This pointer allows
Jim Laskey3d11bee2006-03-15 19:10:52 +0000329a debugger to use def-use chains to find all global objects of that type.</p>
Jim Laskeycec12a52006-03-14 18:08:46 +0000330
331<p>The following names are recognized as anchors by LLVM:</p>
332
333<pre>
334 %<a href="#format_compile_units">llvm.dbg.compile_units</a> = linkonce constant %<a href="#format_anchors">llvm.dbg.anchor.type</a> { uint 0, uint 17 } ;; DW_TAG_compile_unit
335 %<a href="#format_global_variables">llvm.dbg.global_variables</a> = linkonce constant %<a href="#format_anchors">llvm.dbg.anchor.type</a> { uint 0, uint 52 } ;; DW_TAG_variable
336 %<a href="#format_subprograms">llvm.dbg.subprograms</a> = linkonce constant %<a href="#format_anchors">llvm.dbg.anchor.type</a> { uint 0, uint 46 } ;; DW_TAG_subprogram
337</pre>
338
339<p>Using anchors in this way (where the compile unit descriptor points to the
340anchors, as opposed to having a list of compile unit descriptors) allows for the
Chris Lattnerbdfb3392004-01-05 05:06:33 +0000341standard dead global elimination and merging passes to automatically remove
342unused debugging information. If the globals were kept track of through lists,
343there would always be an object pointing to the descriptors, thus would never be
Misha Brukman82873732004-05-12 19:21:57 +0000344deleted.</p>
Chris Lattnerbdfb3392004-01-05 05:06:33 +0000345
346</div>
347
Chris Lattnerbdfb3392004-01-05 05:06:33 +0000348<!-- ======================================================================= -->
Jim Laskeycec12a52006-03-14 18:08:46 +0000349<div class="doc_subsubsection">
350 <a name="format_compile_units">Compile unit descriptors</a>
351</div>
352
353<div class="doc_text">
354
355<pre>
356 %<a href="#format_compile_units">llvm.dbg.compile_unit.type</a> = type {
Jim Laskey7089f452006-06-16 13:14:03 +0000357 uint, ;; Tag = 17 + <a href="#LLVMDebugVersion">LLVMDebugVersion</a> (DW_TAG_compile_unit)
Jim Laskeycec12a52006-03-14 18:08:46 +0000358 { }*, ;; Compile unit anchor = cast = (%<a href="#format_anchors">llvm.dbg.anchor.type</a>* %<a href="#format_compile_units">llvm.dbg.compile_units</a> to { }*)
Jim Laskeycec12a52006-03-14 18:08:46 +0000359 uint, ;; Dwarf language identifier (ex. DW_LANG_C89)
360 sbyte*, ;; Source file name
361 sbyte*, ;; Source file directory (includes trailing slash)
362 sbyte* ;; Producer (ex. "4.0.1 LLVM (LLVM research group)")
363 }
364</pre>
365
Jim Laskey7089f452006-06-16 13:14:03 +0000366<p>These descriptors contain a source language ID for the file (we use the Dwarf
3673.0 ID numbers, such as <tt>DW_LANG_C89</tt>, <tt>DW_LANG_C_plus_plus</tt>,
368<tt>DW_LANG_Cobol74</tt>, etc), three strings describing the filename, working
369directory of the compiler, and an identifier string for the compiler that
370produced it.</p>
Jim Laskeycec12a52006-03-14 18:08:46 +0000371
372<p> Compile unit descriptors provide the root context for objects declared in a
373specific source file. Global variables and top level functions would be defined
374using this context. Compile unit descriptors also provide context for source
375line correspondence.</p>
376
377</div>
378
379<!-- ======================================================================= -->
380<div class="doc_subsubsection">
381 <a name="format_global_variables">Global variable descriptors</a>
382</div>
383
384<div class="doc_text">
385
386<pre>
387 %<a href="#format_global_variables">llvm.dbg.global_variable.type</a> = type {
Jim Laskey7089f452006-06-16 13:14:03 +0000388 uint, ;; Tag = 52 + <a href="#LLVMDebugVersion">LLVMDebugVersion</a> (DW_TAG_variable)
Jim Laskeycec12a52006-03-14 18:08:46 +0000389 { }*, ;; Global variable anchor = cast (%<a href="#format_anchors">llvm.dbg.anchor.type</a>* %<a href="#format_global_variables">llvm.dbg.global_variables</a> to { }*),
Jim Laskey3d11bee2006-03-15 19:10:52 +0000390 { }*, ;; Reference to context descriptor
Jim Laskeycec12a52006-03-14 18:08:46 +0000391 sbyte*, ;; Name
Jim Laskey3d11bee2006-03-15 19:10:52 +0000392 { }*, ;; Reference to compile unit where defined
Jim Laskey383e0092006-03-23 17:54:33 +0000393 uint, ;; Line number where defined
Jim Laskeycec12a52006-03-14 18:08:46 +0000394 { }*, ;; Reference to type descriptor
395 bool, ;; True if the global is local to compile unit (static)
396 bool, ;; True if the global is defined in the compile unit (not extern)
Jim Laskey3d11bee2006-03-15 19:10:52 +0000397 { }* ;; Reference to the global variable
Jim Laskeycec12a52006-03-14 18:08:46 +0000398 }
399</pre>
400
401<p>These descriptors provide debug information about globals variables. The
402provide details such as name, type and where the variable is defined.</p>
403
404</div>
405
406<!-- ======================================================================= -->
407<div class="doc_subsubsection">
408 <a name="format_subprograms">Subprogram descriptors</a>
409</div>
410
411<div class="doc_text">
412
413<pre>
414 %<a href="#format_subprograms">llvm.dbg.subprogram.type</a> = type {
Jim Laskey7089f452006-06-16 13:14:03 +0000415 uint, ;; Tag = 46 + <a href="#LLVMDebugVersion">LLVMDebugVersion</a> (DW_TAG_subprogram)
Jim Laskeycec12a52006-03-14 18:08:46 +0000416 { }*, ;; Subprogram anchor = cast (%<a href="#format_anchors">llvm.dbg.anchor.type</a>* %<a href="#format_subprograms">llvm.dbg.subprograms</a> to { }*),
Jim Laskey3d11bee2006-03-15 19:10:52 +0000417 { }*, ;; Reference to context descriptor
Jim Laskeycec12a52006-03-14 18:08:46 +0000418 sbyte*, ;; Name
Jim Laskey3d11bee2006-03-15 19:10:52 +0000419 { }*, ;; Reference to compile unit where defined
Jim Laskey383e0092006-03-23 17:54:33 +0000420 uint, ;; Line number where defined
Jim Laskeycec12a52006-03-14 18:08:46 +0000421 { }*, ;; Reference to type descriptor
422 bool, ;; True if the global is local to compile unit (static)
Jim Laskey383e0092006-03-23 17:54:33 +0000423 bool ;; True if the global is defined in the compile unit (not extern)
Jim Laskeycec12a52006-03-14 18:08:46 +0000424 }
Jim Laskeycec12a52006-03-14 18:08:46 +0000425</pre>
426
427<p>These descriptors provide debug information about functions, methods and
Jim Laskey383e0092006-03-23 17:54:33 +0000428subprograms. They provide details such as name, return types and the source
429location where the subprogram is defined.</p>
Jim Laskey3d11bee2006-03-15 19:10:52 +0000430
431</div>
432<!-- ======================================================================= -->
433<div class="doc_subsubsection">
434 <a name="format_blocks">Block descriptors</a>
435</div>
436
437<div class="doc_text">
438
439<pre>
440 %<a href="#format_blocks">llvm.dbg.block</a> = type {
Jim Laskey7089f452006-06-16 13:14:03 +0000441 uint, ;; Tag = 13 + <a href="#LLVMDebugVersion">LLVMDebugVersion</a> (DW_TAG_lexical_block)
Jim Laskey383e0092006-03-23 17:54:33 +0000442 { }* ;; Reference to context descriptor
Jim Laskey3d11bee2006-03-15 19:10:52 +0000443 }
444</pre>
445
446<p>These descriptors provide debug information about nested blocks within a
447subprogram. The array of member descriptors is used to define local variables
448and deeper nested blocks.</p>
449
Jim Laskeycec12a52006-03-14 18:08:46 +0000450</div>
451
452<!-- ======================================================================= -->
453<div class="doc_subsubsection">
454 <a name="format_basic_type">Basic type descriptors</a>
455</div>
456
457<div class="doc_text">
458
459<pre>
460 %<a href="#format_basic_type">llvm.dbg.basictype.type</a> = type {
Jim Laskey7089f452006-06-16 13:14:03 +0000461 uint, ;; Tag = 36 + <a href="#LLVMDebugVersion">LLVMDebugVersion</a> (DW_TAG_base_type)
Jim Laskeycec12a52006-03-14 18:08:46 +0000462 { }*, ;; Reference to context (typically a compile unit)
463 sbyte*, ;; Name (may be "" for anonymous types)
464 { }*, ;; Reference to compile unit where defined (may be NULL)
Jim Laskey383e0092006-03-23 17:54:33 +0000465 uint, ;; Line number where defined (may be 0)
Jim Laskeycec12a52006-03-14 18:08:46 +0000466 uint, ;; Size in bits
467 uint, ;; Alignment in bits
468 uint, ;; Offset in bits
469 uint ;; Dwarf type encoding
470 }
471</pre>
472
473<p>These descriptors define primitive types used in the code. Example int, bool
474and float. The context provides the scope of the type, which is usually the top
475level. Since basic types are not usually user defined the compile unit and line
476number can be left as NULL and 0. The size, alignment and offset are expressed
477in bits and can be 64 bit values. The alignment is used to round the offset
478when embedded in a <a href="#format_composite_type">composite type</a>
479(example to keep float doubles on 64 bit boundaries.) The offset is the bit
480offset if embedded in a <a href="#format_composite_type">composite
481type</a>.</p>
482
483<p>The type encoding provides the details of the type. The values are typically
484one of the following;</p>
485
486<pre>
487 DW_ATE_address = 1
488 DW_ATE_boolean = 2
489 DW_ATE_float = 4
490 DW_ATE_signed = 5
491 DW_ATE_signed_char = 6
492 DW_ATE_unsigned = 7
493 DW_ATE_unsigned_char = 8
494</pre>
495
496</div>
497
498<!-- ======================================================================= -->
499<div class="doc_subsubsection">
500 <a name="format_derived_type">Derived type descriptors</a>
501</div>
502
503<div class="doc_text">
504
505<pre>
506 %<a href="#format_derived_type">llvm.dbg.derivedtype.type</a> = type {
507 uint, ;; Tag (see below)
508 { }*, ;; Reference to context
509 sbyte*, ;; Name (may be "" for anonymous types)
510 { }*, ;; Reference to compile unit where defined (may be NULL)
Jim Laskey383e0092006-03-23 17:54:33 +0000511 uint, ;; Line number where defined (may be 0)
Jim Laskeycec12a52006-03-14 18:08:46 +0000512 uint, ;; Size in bits
513 uint, ;; Alignment in bits
514 uint, ;; Offset in bits
515 { }* ;; Reference to type derived from
516 }
517</pre>
518
519<p>These descriptors are used to define types derived from other types. The
520value of the tag varies depending on the meaning. The following are possible
521tag values;</p>
522
523<pre>
Jim Laskey3d11bee2006-03-15 19:10:52 +0000524 DW_TAG_formal_parameter = 5
Jim Laskeycec12a52006-03-14 18:08:46 +0000525 DW_TAG_member = 13
526 DW_TAG_pointer_type = 15
527 DW_TAG_reference_type = 16
528 DW_TAG_typedef = 22
529 DW_TAG_const_type = 38
530 DW_TAG_volatile_type = 53
531 DW_TAG_restrict_type = 55
532</pre>
533
534<p> <tt>DW_TAG_member</tt> is used to define a member of a <a
Jim Laskey3d11bee2006-03-15 19:10:52 +0000535href="#format_composite_type">composite type</a> or <a
536href="#format_subprograms">subprogram</a>. The type of the member is the <a
537href="#format_derived_type">derived type</a>. <tt>DW_TAG_formal_parameter</tt>
538is used to define a member which is a formal argument of a subprogram.</p>
Jim Laskeycec12a52006-03-14 18:08:46 +0000539
540<p><tt>DW_TAG_typedef</tt> is used to
541provide a name for the derived type.</p>
542
543<p><tt>DW_TAG_pointer_type</tt>,
544<tt>DW_TAG_reference_type</tt>, <tt>DW_TAG_const_type</tt>,
545<tt>DW_TAG_volatile_type</tt> and <tt>DW_TAG_restrict_type</tt> are used to
546qualify the <a href="#format_derived_type">derived type</a>. </p>
547
548<p><a href="#format_derived_type">Derived type</a> location can be determined
549from the compile unit and line number. The size, alignment and offset are
550expressed in bits and can be 64 bit values. The alignment is used to round the
551offset when embedded in a <a href="#format_composite_type">composite type</a>
552(example to keep float doubles on 64 bit boundaries.) The offset is the bit
553offset if embedded in a <a href="#format_composite_type">composite
554type</a>.</p>
555
556<p>Note that the <tt>void *</tt> type is expressed as a
557<tt>llvm.dbg.derivedtype.type</tt> with tag of <tt>DW_TAG_pointer_type</tt> and
558NULL derived type.</p>
559
560</div>
561
562<!-- ======================================================================= -->
563<div class="doc_subsubsection">
564 <a name="format_composite_type">Composite type descriptors</a>
565</div>
566
567<div class="doc_text">
568
569<pre>
570 %<a href="#format_composite_type">llvm.dbg.compositetype.type</a> = type {
571 uint, ;; Tag (see below)
572 { }*, ;; Reference to context
573 sbyte*, ;; Name (may be "" for anonymous types)
574 { }*, ;; Reference to compile unit where defined (may be NULL)
Jim Laskey383e0092006-03-23 17:54:33 +0000575 uint, ;; Line number where defined (may be 0)
Jim Laskeycec12a52006-03-14 18:08:46 +0000576 uint, ;; Size in bits
577 uint, ;; Alignment in bits
578 uint, ;; Offset in bits
579 { }* ;; Reference to array of member descriptors
580 }
581</pre>
582
583<p>These descriptors are used to define types that are composed of 0 or more
584elements. The value of the tag varies depending on the meaning. The following
585are possible tag values;</p>
586
587<pre>
588 DW_TAG_array_type = 1
589 DW_TAG_enumeration_type = 4
590 DW_TAG_structure_type = 19
591 DW_TAG_union_type = 23
Jim Laskey7089f452006-06-16 13:14:03 +0000592 DW_TAG_vector_type = 259
Jim Laskeycec12a52006-03-14 18:08:46 +0000593</pre>
594
Jim Laskeyf8a01a92006-06-15 20:51:43 +0000595<p>The vector flag indicates that an array type is a native packed vector.</p>
596
Jim Laskey7089f452006-06-16 13:14:03 +0000597<p>The members of array types (tag = <tt>DW_TAG_array_type</tt>) or vector types
598(tag = <tt>DW_TAG_vector_type</tt>) are <a href="#format_subrange">subrange
599descriptors</a>, each representing the range of subscripts at that level of
600indexing.</p>
Jim Laskeycec12a52006-03-14 18:08:46 +0000601
602<p>The members of enumeration types (tag = <tt>DW_TAG_enumeration_type</tt>) are
603<a href="#format_enumeration">enumerator descriptors</a>, each representing the
604definition of enumeration value
605for the set.</p>
606
607<p>The members of structure (tag = <tt>DW_TAG_structure_type</tt>) or union (tag
608= <tt>DW_TAG_union_type</tt>) types are any one of the <a
609href="#format_basic_type">basic</a>, <a href="#format_derived_type">derived</a>
610or <a href="#format_composite_type">composite</a> type descriptors, each
611representing a field member of the structure or union.</p>
612
613<p><a href="#format_composite_type">Composite type</a> location can be
614determined from the compile unit and line number. The size, alignment and
615offset are expressed in bits and can be 64 bit values. The alignment is used to
616round the offset when embedded in a <a href="#format_composite_type">composite
617type</a> (as an example, to keep float doubles on 64 bit boundaries.) The offset
618is the bit offset if embedded in a <a href="#format_composite_type">composite
619type</a>.</p>
620
621</div>
622
623<!-- ======================================================================= -->
624<div class="doc_subsubsection">
625 <a name="format_subrange">Subrange descriptors</a>
626</div>
627
628<div class="doc_text">
629
630<pre>
631 %<a href="#format_subrange">llvm.dbg.subrange.type</a> = type {
Jim Laskey7089f452006-06-16 13:14:03 +0000632 uint, ;; Tag = 33 + <a href="#LLVMDebugVersion">LLVMDebugVersion</a> (DW_TAG_subrange_type)
Jim Laskeycec12a52006-03-14 18:08:46 +0000633 uint, ;; Low value
634 uint ;; High value
635 }
636</pre>
637
638<p>These descriptors are used to define ranges of array subscripts for an array
639<a href="#format_composite_type">composite type</a>. The low value defines the
640lower bounds typically zero for C/C++. The high value is the upper bounds.
641Values are 64 bit. High - low + 1 is the size of the array. If
642low == high the array will be unbounded.</p>
643
644</div>
645
646<!-- ======================================================================= -->
647<div class="doc_subsubsection">
648 <a name="format_enumeration">Enumerator descriptors</a>
649</div>
650
651<div class="doc_text">
652
653<pre>
654 %<a href="#format_enumeration">llvm.dbg.enumerator.type</a> = type {
Jim Laskey7089f452006-06-16 13:14:03 +0000655 uint, ;; Tag = 40 + <a href="#LLVMDebugVersion">LLVMDebugVersion</a> (DW_TAG_enumerator)
Jim Laskeycec12a52006-03-14 18:08:46 +0000656 sbyte*, ;; Name
657 uint ;; Value
658 }
659</pre>
660
661<p>These descriptors are used to define members of an enumeration <a
662href="#format_composite_type">composite type</a>, it associates the name to the
663value.</p>
664
665</div>
666
667<!-- ======================================================================= -->
Jim Laskey383e0092006-03-23 17:54:33 +0000668<div class="doc_subsubsection">
669 <a name="format_variables">Local variables</a>
670</div>
671
672<div class="doc_text">
673<pre>
674 %<a href="#format_variables">llvm.dbg.variable.type</a> = type {
675 uint, ;; Tag (see below)
676 { }*, ;; Context
677 sbyte*, ;; Name
678 { }*, ;; Reference to compile unit where defined
679 uint, ;; Line number where defined
680 { }* ;; Type descriptor
681 }
682</pre>
683
684<p>These descriptors are used to define variables local to a sub program. The
685value of the tag depends on the usage of the variable;</p>
686
687<pre>
688 DW_TAG_auto_variable = 256
689 DW_TAG_arg_variable = 257
690 DW_TAG_return_variable = 258
691</pre>
692
693<p>An auto variable is any variable declared in the body of the function. An
694argument variable is any variable that appears as a formal argument to the
695function. A return variable is used to track the result of a function and has
696no source correspondent.</p>
697
Jim Laskey2d395d92006-03-24 09:20:27 +0000698<p>The context is either the subprogram or block where the variable is defined.
Jim Laskey383e0092006-03-23 17:54:33 +0000699Name the source variable name. Compile unit and line indicate where the
700variable was defined. Type descriptor defines the declared type of the
701variable.</p>
702
703</div>
704
705<!-- ======================================================================= -->
Chris Lattnerbdfb3392004-01-05 05:06:33 +0000706<div class="doc_subsection">
Jim Laskeycec12a52006-03-14 18:08:46 +0000707 <a name="format_common_intrinsics">Debugger intrinsic functions</a>
708</div>
709
710<div class="doc_text">
711
712<p>LLVM uses several intrinsic functions (name prefixed with "llvm.dbg") to
713provide debug information at various points in generated code.</p>
714
715</div>
716
717<!-- ======================================================================= -->
718<div class="doc_subsubsection">
719 <a name="format_common_stoppoint">llvm.dbg.stoppoint</a>
720</div>
721
722<div class="doc_text">
723<pre>
Jim Laskey108a6382006-03-23 17:58:46 +0000724 void %<a href="#format_common_stoppoint">llvm.dbg.stoppoint</a>( uint, uint, { }* )
Jim Laskeycec12a52006-03-14 18:08:46 +0000725</pre>
726
727<p>This intrinsic is used to provide correspondence between the source file and
728the generated code. The first argument is the line number (base 1), second
729argument si the column number (0 if unknown) and the third argument the source
Jim Laskey108a6382006-03-23 17:58:46 +0000730<tt>%<a href="#format_compile_units">llvm.dbg.compile_unit</a>*</tt> cast to a
731<tt>{ }*</tt>. Code following a call to this intrinsic will have been defined
732in close proximity of the line, column and file. This information holds until
733the next call to <tt>%<a
Jim Laskey383e0092006-03-23 17:54:33 +0000734href="#format_common_stoppoint">lvm.dbg.stoppoint</a></tt>.</p>
Jim Laskeycec12a52006-03-14 18:08:46 +0000735
736</div>
737
738<!-- ======================================================================= -->
739<div class="doc_subsubsection">
740 <a name="format_common_func_start">llvm.dbg.func.start</a>
741</div>
742
743<div class="doc_text">
744<pre>
Jim Laskey383e0092006-03-23 17:54:33 +0000745 void %<a href="#format_common_func_start">llvm.dbg.func.start</a>( { }* )
Jim Laskeycec12a52006-03-14 18:08:46 +0000746</pre>
747
748<p>This intrinsic is used to link the debug information in <tt>%<a
749href="#format_subprograms">llvm.dbg.subprogram</a></tt> to the function. It also
750defines the beginning of the function's declarative region (scope.) The
751intrinsic should be called early in the function after the all the alloca
Jim Laskey383e0092006-03-23 17:54:33 +0000752instructions. It should be paired off with a closing <tt>%<a
753href="#format_common_region_end">llvm.dbg.region.end</a></tt>. The function's
754single argument is the <tt>%<a
755href="#format_subprograms">llvm.dbg.subprogram.type</a></tt>.</p>
Jim Laskeycec12a52006-03-14 18:08:46 +0000756
757</div>
758
759<!-- ======================================================================= -->
760<div class="doc_subsubsection">
761 <a name="format_common_region_start">llvm.dbg.region.start</a>
762</div>
763
764<div class="doc_text">
765<pre>
Jim Laskey383e0092006-03-23 17:54:33 +0000766 void %<a href="#format_common_region_start">llvm.dbg.region.start</a>( { }* )
Jim Laskeycec12a52006-03-14 18:08:46 +0000767</pre>
768
769<p>This intrinsic is used to define the beginning of a declarative scope (ex.
770block) for local language elements. It should be paired off with a closing
Jim Laskey383e0092006-03-23 17:54:33 +0000771<tt>%<a href="#format_common_region_end">llvm.dbg.region.end</a></tt>. The
772function's single argument is the <tt>%<a
773href="#format_blocks">llvm.dbg.block</a></tt> which is starting.</p>
774
Jim Laskeycec12a52006-03-14 18:08:46 +0000775
776</div>
777
778<!-- ======================================================================= -->
779<div class="doc_subsubsection">
780 <a name="format_common_region_end">llvm.dbg.region.end</a>
781</div>
782
783<div class="doc_text">
784<pre>
Jim Laskey383e0092006-03-23 17:54:33 +0000785 void %<a href="#format_common_region_end">llvm.dbg.region.end</a>( { }* )
Jim Laskeycec12a52006-03-14 18:08:46 +0000786</pre>
787
788<p>This intrinsic is used to define the end of a declarative scope (ex. block)
789for local language elements. It should be paired off with an opening <tt>%<a
790href="#format_common_region_start">llvm.dbg.region.start</a></tt> or <tt>%<a
Jim Laskey383e0092006-03-23 17:54:33 +0000791href="#format_common_func_start">llvm.dbg.func.start</a></tt>. The function's
792single argument is either the <tt>%<a
793href="#format_blocks">llvm.dbg.block</a></tt> or the <tt>%<a
794href="#format_subprograms">llvm.dbg.subprogram.type</a></tt> which is
795ending.</p>
Jim Laskeycec12a52006-03-14 18:08:46 +0000796
797</div>
798
799<!-- ======================================================================= -->
800<div class="doc_subsubsection">
801 <a name="format_common_declare">llvm.dbg.declare</a>
802</div>
803
804<div class="doc_text">
805<pre>
Jim Laskey383e0092006-03-23 17:54:33 +0000806 void %<a href="#format_common_declare">llvm.dbg.declare</a>( { } *, { }* )
Jim Laskeycec12a52006-03-14 18:08:46 +0000807</pre>
808
Jim Laskey2d395d92006-03-24 09:20:27 +0000809<p>This intrinsic provides information about a local element (ex. variable.) The
810first argument is the alloca for the variable, cast to a <tt>{ }*</tt>. The
811second argument is the <tt>%<a
812href="#format_variables">llvm.dbg.variable</a></tt> containing the description
813of the variable, also cast to a <tt>{ }*</tt>.</p>
Jim Laskeycec12a52006-03-14 18:08:46 +0000814
815</div>
816
817<!-- ======================================================================= -->
818<div class="doc_subsection">
819 <a name="format_common_stoppoints">
Chris Lattnerbdfb3392004-01-05 05:06:33 +0000820 Representing stopping points in the source program
821 </a>
822</div>
823
824<div class="doc_text">
825
826<p>LLVM debugger "stop points" are a key part of the debugging representation
827that allows the LLVM to maintain simple semantics for <a
828href="#debugopt">debugging optimized code</a>. The basic idea is that the
Jim Laskeycec12a52006-03-14 18:08:46 +0000829front-end inserts calls to the <a
830href="#format_common_stoppoint">%<tt>llvm.dbg.stoppoint</tt></a> intrinsic
Jim Laskey3d11bee2006-03-15 19:10:52 +0000831function at every point in the program where a debugger should be able to
832inspect the program (these correspond to places a debugger stops when you
Jim Laskeycec12a52006-03-14 18:08:46 +0000833"<tt>step</tt>" through it). The front-end can choose to place these as
834fine-grained as it would like (for example, before every subexpression
835evaluated), but it is recommended to only put them after every source statement
836that includes executable code.</p>
Chris Lattnerbdfb3392004-01-05 05:06:33 +0000837
Misha Brukman82873732004-05-12 19:21:57 +0000838<p>Using calls to this intrinsic function to demark legal points for the
839debugger to inspect the program automatically disables any optimizations that
840could potentially confuse debugging information. To non-debug-information-aware
Chris Lattnerbdfb3392004-01-05 05:06:33 +0000841transformations, these calls simply look like calls to an external function,
842which they must assume to do anything (including reading or writing to any part
843of reachable memory). On the other hand, it does not impact many optimizations,
844such as code motion of non-trapping instructions, nor does it impact
Chris Lattner8ff75902004-01-06 05:31:32 +0000845optimization of subexpressions, code duplication transformations, or basic-block
846reordering transformations.</p>
Chris Lattnerbdfb3392004-01-05 05:06:33 +0000847
Chris Lattnerbdfb3392004-01-05 05:06:33 +0000848</div>
849
850
851<!-- ======================================================================= -->
852<div class="doc_subsection">
Chris Lattner8ff75902004-01-06 05:31:32 +0000853 <a name="format_common_lifetime">Object lifetimes and scoping</a>
Chris Lattnerbdfb3392004-01-05 05:06:33 +0000854</div>
855
856<div class="doc_text">
Misha Brukman82873732004-05-12 19:21:57 +0000857<p>In many languages, the local variables in functions can have their lifetime
858or scope limited to a subset of a function. In the C family of languages, for
Chris Lattnerbdfb3392004-01-05 05:06:33 +0000859example, variables are only live (readable and writable) within the source block
860that they are defined in. In functional languages, values are only readable
861after they have been defined. Though this is a very obvious concept, it is also
862non-trivial to model in LLVM, because it has no notion of scoping in this sense,
Misha Brukman82873732004-05-12 19:21:57 +0000863and does not want to be tied to a language's scoping rules.</p>
Chris Lattnerbdfb3392004-01-05 05:06:33 +0000864
Misha Brukman82873732004-05-12 19:21:57 +0000865<p>In order to handle this, the LLVM debug format uses the notion of "regions"
866of a function, delineated by calls to intrinsic functions. These intrinsic
867functions define new regions of the program and indicate when the region
868lifetime expires. Consider the following C fragment, for example:</p>
Chris Lattnerbdfb3392004-01-05 05:06:33 +0000869
Misha Brukman82873732004-05-12 19:21:57 +0000870<pre>
Chris Lattnerbdfb3392004-01-05 05:06:33 +00008711. void foo() {
8722. int X = ...;
8733. int Y = ...;
8744. {
8755. int Z = ...;
8766. ...
8777. }
8788. ...
8799. }
Misha Brukman82873732004-05-12 19:21:57 +0000880</pre>
Chris Lattnerbdfb3392004-01-05 05:06:33 +0000881
Jim Laskeycec12a52006-03-14 18:08:46 +0000882<p>Compiled to LLVM, this function would be represented like this:</p>
Chris Lattnerbdfb3392004-01-05 05:06:33 +0000883
Misha Brukman82873732004-05-12 19:21:57 +0000884<pre>
Chris Lattnerbdfb3392004-01-05 05:06:33 +0000885void %foo() {
Jim Laskeycec12a52006-03-14 18:08:46 +0000886entry:
Chris Lattnerbdfb3392004-01-05 05:06:33 +0000887 %X = alloca int
888 %Y = alloca int
889 %Z = alloca int
Jim Laskeycec12a52006-03-14 18:08:46 +0000890
891 ...
892
893 call void %<a href="#format_common_func_start">llvm.dbg.func.start</a>( %<a href="#format_subprograms">llvm.dbg.subprogram.type</a>* %llvm.dbg.subprogram )
894
895 call void %<a href="#format_common_stoppoint">llvm.dbg.stoppoint</a>( uint 2, uint 2, %<a href="#format_compile_units">llvm.dbg.compile_unit</a>* %llvm.dbg.compile_unit )
896
897 call void %<a href="#format_common_declare">llvm.dbg.declare</a>({}* %X, ...)
898 call void %<a href="#format_common_declare">llvm.dbg.declare</a>({}* %Y, ...)
899
Chris Lattnerbdfb3392004-01-05 05:06:33 +0000900 <i>;; Evaluate expression on line 2, assigning to X.</i>
Jim Laskeycec12a52006-03-14 18:08:46 +0000901
902 call void %<a href="#format_common_stoppoint">llvm.dbg.stoppoint</a>( uint 3, uint 2, %<a href="#format_compile_units">llvm.dbg.compile_unit</a>* %llvm.dbg.compile_unit )
903
Chris Lattnerbdfb3392004-01-05 05:06:33 +0000904 <i>;; Evaluate expression on line 3, assigning to Y.</i>
Jim Laskeycec12a52006-03-14 18:08:46 +0000905
906 call void %<a href="#format_common_stoppoint">llvm.region.start</a>()
907 call void %<a href="#format_common_stoppoint">llvm.dbg.stoppoint</a>( uint 5, uint 4, %<a href="#format_compile_units">llvm.dbg.compile_unit</a>* %llvm.dbg.compile_unit )
908 call void %<a href="#format_common_declare">llvm.dbg.declare</a>({}* %X, ...)
909
Chris Lattnerbdfb3392004-01-05 05:06:33 +0000910 <i>;; Evaluate expression on line 5, assigning to Z.</i>
Jim Laskeycec12a52006-03-14 18:08:46 +0000911
912 call void %<a href="#format_common_stoppoint">llvm.dbg.stoppoint</a>( uint 7, uint 2, %<a href="#format_compile_units">llvm.dbg.compile_unit</a>* %llvm.dbg.compile_unit )
913 call void %<a href="#format_common_region_end">llvm.region.end</a>()
914
915 call void %<a href="#format_common_stoppoint">llvm.dbg.stoppoint</a>( uint 9, uint 2, %<a href="#format_compile_units">llvm.dbg.compile_unit</a>* %llvm.dbg.compile_unit )
916
917 call void %<a href="#format_common_region_end">llvm.region.end</a>()
918
Chris Lattnerbdfb3392004-01-05 05:06:33 +0000919 ret void
920}
Misha Brukman82873732004-05-12 19:21:57 +0000921</pre>
Chris Lattnerbdfb3392004-01-05 05:06:33 +0000922
Misha Brukman82873732004-05-12 19:21:57 +0000923<p>This example illustrates a few important details about the LLVM debugging
Jim Laskeycec12a52006-03-14 18:08:46 +0000924information. In particular, it shows how the various intrinsics are applied
925together to allow a debugger to analyze the relationship between statements,
926variable definitions, and the code used to implement the function.</p>
Chris Lattnerbdfb3392004-01-05 05:06:33 +0000927
Jim Laskeycec12a52006-03-14 18:08:46 +0000928<p>The first intrinsic <tt>%<a
929href="#format_common_func_start">llvm.dbg.func.start</a></tt> provides
930a link with the <a href="#format_subprograms">subprogram descriptor</a>
931containing the details of this function. This call also defines the beginning
932of the function region, bounded by the <tt>%<a
933href="#format_common_region_end">llvm.region.end</a></tt> at the end of
934the function. This region is used to bracket the lifetime of variables declared
935within. For a function, this outer region defines a new stack frame whose
936lifetime ends when the region is ended.</p>
937
938<p>It is possible to define inner regions for short term variables by using the
939%<a href="#format_common_stoppoint"><tt>llvm.region.start</tt></a> and <a
940href="#format_common_region_end"><tt>%llvm.region.end</tt></a> to bound a
941region. The inner region in this example would be for the block containing the
942declaration of Z.</p>
Chris Lattnerbdfb3392004-01-05 05:06:33 +0000943
Misha Brukman82873732004-05-12 19:21:57 +0000944<p>Using regions to represent the boundaries of source-level functions allow
945LLVM interprocedural optimizations to arbitrarily modify LLVM functions without
Chris Lattner8ff75902004-01-06 05:31:32 +0000946having to worry about breaking mapping information between the LLVM code and the
947and source-level program. In particular, the inliner requires no modification
948to support inlining with debugging information: there is no explicit correlation
949drawn between LLVM functions and their source-level counterparts (note however,
950that if the inliner inlines all instances of a non-strong-linkage function into
951its caller that it will not be possible for the user to manually invoke the
Jim Laskey3d11bee2006-03-15 19:10:52 +0000952inlined function from a debugger).</p>
Chris Lattnerbdfb3392004-01-05 05:06:33 +0000953
Misha Brukman82873732004-05-12 19:21:57 +0000954<p>Once the function has been defined, the <a
Jim Laskeycec12a52006-03-14 18:08:46 +0000955href="#format_common_stoppoint"><tt>stopping point</tt></a> corresponding to
956line #2 (column #2) of the function is encountered. At this point in the
957function, <b>no</b> local variables are live. As lines 2 and 3 of the example
958are executed, their variable definitions are introduced into the program using
959%<a href="#format_common_declare"><tt>llvm.dbg.declare</tt></a>, without the
Chris Lattnerbdfb3392004-01-05 05:06:33 +0000960need to specify a new region. These variables do not require new regions to be
961introduced because they go out of scope at the same point in the program: line
Misha Brukman82873732004-05-12 19:21:57 +00009629.</p>
Chris Lattnerbdfb3392004-01-05 05:06:33 +0000963
Misha Brukman82873732004-05-12 19:21:57 +0000964<p>In contrast, the <tt>Z</tt> variable goes out of scope at a different time,
Jim Laskeycec12a52006-03-14 18:08:46 +0000965on line 7. For this reason, it is defined within the inner region, which kills
966the availability of <tt>Z</tt> before the code for line 8 is executed. In this
967way, regions can support arbitrary source-language scoping rules, as long as
968they can only be nested (ie, one scope cannot partially overlap with a part of
969another scope).</p>
Chris Lattnerbdfb3392004-01-05 05:06:33 +0000970
Misha Brukman82873732004-05-12 19:21:57 +0000971<p>It is worth noting that this scoping mechanism is used to control scoping of
972all declarations, not just variable declarations. For example, the scope of a
Jim Laskeycec12a52006-03-14 18:08:46 +0000973C++ using declaration is controlled with this couldchange how name lookup is
974performed.</p>
Chris Lattnerbdfb3392004-01-05 05:06:33 +0000975
976</div>
977
Chris Lattnerbdfb3392004-01-05 05:06:33 +0000978
979
980<!-- *********************************************************************** -->
981<div class="doc_section">
Chris Lattner8ff75902004-01-06 05:31:32 +0000982 <a name="ccxx_frontend">C/C++ front-end specific debug information</a>
Chris Lattnerbdfb3392004-01-05 05:06:33 +0000983</div>
Misha Brukman94218a72004-12-09 20:27:37 +0000984<!-- *********************************************************************** -->
Chris Lattnerbdfb3392004-01-05 05:06:33 +0000985
986<div class="doc_text">
987
Misha Brukman82873732004-05-12 19:21:57 +0000988<p>The C and C++ front-ends represent information about the program in a format
Chris Lattnerbdfb3392004-01-05 05:06:33 +0000989that is effectively identical to <a
990href="http://www.eagercon.com/dwarf/dwarf3std.htm">Dwarf 3.0</a> in terms of
991information content. This allows code generators to trivially support native
992debuggers by generating standard dwarf information, and contains enough
Chris Lattner8ff75902004-01-06 05:31:32 +0000993information for non-dwarf targets to translate it as needed.</p>
Chris Lattnerbdfb3392004-01-05 05:06:33 +0000994
Jim Laskeycec12a52006-03-14 18:08:46 +0000995<p>This section describes the forms used to represent C and C++ programs. Other
996languages could pattern themselves after this (which itself is tuned to
Chris Lattner8ff75902004-01-06 05:31:32 +0000997representing programs in the same way that Dwarf 3 does), or they could choose
Jim Laskeycec12a52006-03-14 18:08:46 +0000998to provide completely different forms if they don't fit into the Dwarf model.
999As support for debugging information gets added to the various LLVM
Misha Brukman82873732004-05-12 19:21:57 +00001000source-language front-ends, the information used should be documented here.</p>
Chris Lattnerbdfb3392004-01-05 05:06:33 +00001001
Jim Laskeycec12a52006-03-14 18:08:46 +00001002<p>The following sections provide examples of various C/C++ constructs and the
1003debug information that would best describe those constructs.</p>
1004
Chris Lattnerbdfb3392004-01-05 05:06:33 +00001005</div>
1006
1007<!-- ======================================================================= -->
1008<div class="doc_subsection">
Jim Laskeycec12a52006-03-14 18:08:46 +00001009 <a name="ccxx_compile_units">C/C++ source file information</a>
Chris Lattnerbdfb3392004-01-05 05:06:33 +00001010</div>
1011
1012<div class="doc_text">
Chris Lattnerbdfb3392004-01-05 05:06:33 +00001013
Jim Laskeycec12a52006-03-14 18:08:46 +00001014<p>Given the source files "MySource.cpp" and "MyHeader.h" located in the
1015directory "/Users/mine/sources", the following code;</p>
Chris Lattner8ff75902004-01-06 05:31:32 +00001016
Jim Laskeycec12a52006-03-14 18:08:46 +00001017<pre>
1018#include "MyHeader.h"
Chris Lattner8ff75902004-01-06 05:31:32 +00001019
Jim Laskeycec12a52006-03-14 18:08:46 +00001020int main(int argc, char *argv[]) {
1021 return 0;
1022}
1023</pre>
Chris Lattner8ff75902004-01-06 05:31:32 +00001024
Jim Laskeycec12a52006-03-14 18:08:46 +00001025<p>a C/C++ front-end would generate the following descriptors;</p>
1026
1027<pre>
1028...
1029;;
1030;; Define types used. In this case we need one for compile unit anchors and one
1031;; for compile units.
1032;;
1033%<a href="#format_anchors">llvm.dbg.anchor.type</a> = type { uint, uint }
1034%<a href="#format_compile_units">llvm.dbg.compile_unit.type</a> = type { uint, { }*, uint, uint, sbyte*, sbyte*, sbyte* }
1035...
1036;;
1037;; Define the anchor for compile units. Note that the second field of the
1038;; anchor is 17, which is the same as the tag for compile units
1039;; (17 = DW_TAG_compile_unit.)
1040;;
1041%<a href="#format_compile_units">llvm.dbg.compile_units</a> = linkonce constant %<a href="#format_anchors">llvm.dbg.anchor.type</a> { uint 0, uint 17 }, section "llvm.metadata"
1042
1043;;
1044;; Define the compile unit for the source file "/Users/mine/sources/MySource.cpp".
1045;;
1046%<a href="#format_compile_units">llvm.dbg.compile_unit1</a> = internal constant %<a href="#format_compile_units">llvm.dbg.compile_unit.type</a> {
Jim Laskey7089f452006-06-16 13:14:03 +00001047 uint add(uint 17, uint 262144),
Jim Laskeycec12a52006-03-14 18:08:46 +00001048 { }* cast (%<a href="#format_anchors">llvm.dbg.anchor.type</a>* %<a href="#format_compile_units">llvm.dbg.compile_units</a> to { }*),
1049 uint 1,
1050 uint 1,
1051 sbyte* getelementptr ([13 x sbyte]* %str1, int 0, int 0),
1052 sbyte* getelementptr ([21 x sbyte]* %str2, int 0, int 0),
1053 sbyte* getelementptr ([33 x sbyte]* %str3, int 0, int 0) }, section "llvm.metadata"
1054
1055;;
1056;; Define the compile unit for the header file "/Users/mine/sources/MyHeader.h".
1057;;
1058%<a href="#format_compile_units">llvm.dbg.compile_unit2</a> = internal constant %<a href="#format_compile_units">llvm.dbg.compile_unit.type</a> {
Jim Laskey7089f452006-06-16 13:14:03 +00001059 uint add(uint 17, uint 262144),
Jim Laskeycec12a52006-03-14 18:08:46 +00001060 { }* cast (%<a href="#format_anchors">llvm.dbg.anchor.type</a>* %<a href="#format_compile_units">llvm.dbg.compile_units</a> to { }*),
1061 uint 1,
1062 uint 1,
1063 sbyte* getelementptr ([11 x sbyte]* %str4, int 0, int 0),
1064 sbyte* getelementptr ([21 x sbyte]* %str2, int 0, int 0),
1065 sbyte* getelementptr ([33 x sbyte]* %str3, int 0, int 0) }, section "llvm.metadata"
1066
1067;;
1068;; Define each of the strings used in the compile units.
1069;;
1070%str1 = internal constant [13 x sbyte] c"MySource.cpp\00", section "llvm.metadata";
1071%str2 = internal constant [21 x sbyte] c"/Users/mine/sources/\00", section "llvm.metadata";
1072%str3 = internal constant [33 x sbyte] c"4.0.1 LLVM (LLVM research group)\00", section "llvm.metadata";
1073%str4 = internal constant [11 x sbyte] c"MyHeader.h\00", section "llvm.metadata";
1074...
1075</pre>
1076
Chris Lattner8ff75902004-01-06 05:31:32 +00001077</div>
1078
1079<!-- ======================================================================= -->
1080<div class="doc_subsection">
Jim Laskeycec12a52006-03-14 18:08:46 +00001081 <a name="ccxx_global_variable">C/C++ global variable information</a>
Chris Lattner8ff75902004-01-06 05:31:32 +00001082</div>
1083
1084<div class="doc_text">
Jim Laskeycec12a52006-03-14 18:08:46 +00001085
1086<p>Given an integer global variable declared as follows;</p>
1087
1088<pre>
1089int MyGlobal = 100;
1090</pre>
1091
1092<p>a C/C++ front-end would generate the following descriptors;</p>
1093
1094<pre>
1095;;
1096;; Define types used. One for global variable anchors, one for the global
1097;; variable descriptor, one for the global's basic type and one for the global's
1098;; compile unit.
1099;;
1100%<a href="#format_anchors">llvm.dbg.anchor.type</a> = type { uint, uint }
Jim Laskey3d11bee2006-03-15 19:10:52 +00001101%<a href="#format_global_variables">llvm.dbg.global_variable.type</a> = type { uint, { }*, { }*, sbyte*, { }*, uint, { }*, bool, bool, { }*, uint }
Jim Laskeycec12a52006-03-14 18:08:46 +00001102%<a href="#format_basic_type">llvm.dbg.basictype.type</a> = type { uint, { }*, sbyte*, { }*, int, uint, uint, uint, uint }
1103%<a href="#format_compile_units">llvm.dbg.compile_unit.type</a> = ...
1104...
1105;;
1106;; Define the global itself.
1107;;
1108%MyGlobal = global int 100
1109...
1110;;
1111;; Define the anchor for global variables. Note that the second field of the
1112;; anchor is 52, which is the same as the tag for global variables
1113;; (52 = DW_TAG_variable.)
1114;;
1115%<a href="#format_global_variables">llvm.dbg.global_variables</a> = linkonce constant %<a href="#format_anchors">llvm.dbg.anchor.type</a> { uint 0, uint 52 }, section "llvm.metadata"
1116
1117;;
1118;; Define the global variable descriptor. Note the reference to the global
1119;; variable anchor and the global variable itself.
1120;;
1121%<a href="#format_global_variables">llvm.dbg.global_variable</a> = internal constant %<a href="#format_global_variables">llvm.dbg.global_variable.type</a> {
Jim Laskey7089f452006-06-16 13:14:03 +00001122 uint add(uint 52, uint 262144),
Jim Laskeycec12a52006-03-14 18:08:46 +00001123 { }* cast (%<a href="#format_anchors">llvm.dbg.anchor.type</a>* %<a href="#format_global_variables">llvm.dbg.global_variables</a> to { }*),
1124 { }* cast (%<a href="#format_compile_units">llvm.dbg.compile_unit.type</a>* %<a href="#format_compile_units">llvm.dbg.compile_unit</a> to { }*),
1125 sbyte* getelementptr ([9 x sbyte]* %str1, int 0, int 0),
Jim Laskey3d11bee2006-03-15 19:10:52 +00001126 { }* cast (%<a href="#format_compile_units">llvm.dbg.compile_unit.type</a>* %<a href="#format_compile_units">llvm.dbg.compile_unit</a> to { }*),
1127 uint 1,
Jim Laskeycec12a52006-03-14 18:08:46 +00001128 { }* cast (%<a href="#format_basic_type">llvm.dbg.basictype.type</a>* %<a href="#format_basic_type">llvm.dbg.basictype</a> to { }*),
1129 bool false,
1130 bool true,
Jim Laskey3d11bee2006-03-15 19:10:52 +00001131 { }* cast (int* %MyGlobal to { }*) }, section "llvm.metadata"
Jim Laskeycec12a52006-03-14 18:08:46 +00001132
1133;;
1134;; Define the basic type of 32 bit signed integer. Note that since int is an
1135;; intrinsic type the source file is NULL and line 0.
1136;;
1137%<a href="#format_basic_type">llvm.dbg.basictype</a> = internal constant %<a href="#format_basic_type">llvm.dbg.basictype.type</a> {
Jim Laskey7089f452006-06-16 13:14:03 +00001138 uint add(uint 36, uint 262144),
Jim Laskeycec12a52006-03-14 18:08:46 +00001139 { }* cast (%<a href="#format_compile_units">llvm.dbg.compile_unit.type</a>* %<a href="#format_compile_units">llvm.dbg.compile_unit</a> to { }*),
1140 sbyte* getelementptr ([4 x sbyte]* %str2, int 0, int 0),
1141 { }* null,
1142 int 0,
1143 uint 32,
1144 uint 32,
1145 uint 0,
1146 uint 5 }, section "llvm.metadata"
1147
1148;;
1149;; Define the names of the global variable and basic type.
1150;;
1151%str1 = internal constant [9 x sbyte] c"MyGlobal\00", section "llvm.metadata"
1152%str2 = internal constant [4 x sbyte] c"int\00", section "llvm.metadata"
1153</pre>
1154
Chris Lattner8ff75902004-01-06 05:31:32 +00001155</div>
Chris Lattnerbdfb3392004-01-05 05:06:33 +00001156
Jim Laskeycec12a52006-03-14 18:08:46 +00001157<!-- ======================================================================= -->
1158<div class="doc_subsection">
1159 <a name="ccxx_subprogram">C/C++ function information</a>
1160</div>
1161
1162<div class="doc_text">
1163
1164<p>Given a function declared as follows;</p>
1165
1166<pre>
1167int main(int argc, char *argv[]) {
1168 return 0;
1169}
1170</pre>
1171
1172<p>a C/C++ front-end would generate the following descriptors;</p>
1173
1174<pre>
1175;;
1176;; Define types used. One for subprogram anchors, one for the subprogram
1177;; descriptor, one for the global's basic type and one for the subprogram's
1178;; compile unit.
1179;;
Jim Laskey383e0092006-03-23 17:54:33 +00001180%<a href="#format_subprograms">llvm.dbg.subprogram.type</a> = type { uint, { }*, { }*, sbyte*, { }*, bool, bool }
Jim Laskeycec12a52006-03-14 18:08:46 +00001181%<a href="#format_anchors">llvm.dbg.anchor.type</a> = type { uint, uint }
1182%<a href="#format_compile_units">llvm.dbg.compile_unit.type</a> = ...
1183
1184;;
1185;; Define the anchor for subprograms. Note that the second field of the
1186;; anchor is 46, which is the same as the tag for subprograms
1187;; (46 = DW_TAG_subprogram.)
1188;;
1189%<a href="#format_subprograms">llvm.dbg.subprograms</a> = linkonce constant %<a href="#format_anchors">llvm.dbg.anchor.type</a> { uint 0, uint 46 }, section "llvm.metadata"
1190
1191;;
1192;; Define the descriptor for the subprogram. TODO - more details.
1193;;
1194%<a href="#format_subprograms">llvm.dbg.subprogram</a> = internal constant %<a href="#format_subprograms">llvm.dbg.subprogram.type</a> {
Jim Laskey7089f452006-06-16 13:14:03 +00001195 uint add(uint 46, uint 262144),
Jim Laskeycec12a52006-03-14 18:08:46 +00001196 { }* cast (%<a href="#format_anchors">llvm.dbg.anchor.type</a>* %<a href="#format_subprograms">llvm.dbg.subprograms</a> to { }*),
1197 { }* cast (%<a href="#format_compile_units">llvm.dbg.compile_unit.type</a>* %<a href="#format_compile_units">llvm.dbg.compile_unit</a> to { }*),
1198 sbyte* getelementptr ([5 x sbyte]* %str1, int 0, int 0),
Jim Laskey3d11bee2006-03-15 19:10:52 +00001199 { }* cast (%<a href="#format_compile_units">llvm.dbg.compile_unit.type</a>* %<a href="#format_compile_units">llvm.dbg.compile_unit</a> to { }*),
1200 uint 1,
Jim Laskeycec12a52006-03-14 18:08:46 +00001201 { }* null,
1202 bool false,
Jim Laskey383e0092006-03-23 17:54:33 +00001203 bool true }, section "llvm.metadata"
Jim Laskeycec12a52006-03-14 18:08:46 +00001204
1205;;
1206;; Define the name of the subprogram.
1207;;
1208%str1 = internal constant [5 x sbyte] c"main\00", section "llvm.metadata"
1209
1210;;
1211;; Define the subprogram itself.
1212;;
1213int %main(int %argc, sbyte** %argv) {
1214...
1215}
1216</pre>
1217
1218</div>
1219
1220<!-- ======================================================================= -->
1221<div class="doc_subsection">
1222 <a name="ccxx_basic_types">C/C++ basic types</a>
1223</div>
1224
1225<div class="doc_text">
1226
1227<p>The following are the basic type descriptors for C/C++ core types;</p>
1228
1229</div>
1230
1231<!-- ======================================================================= -->
1232<div class="doc_subsubsection">
1233 <a name="ccxx_basic_type_bool">bool</a>
1234</div>
1235
1236<div class="doc_text">
1237
1238<pre>
1239%<a href="#format_basic_type">llvm.dbg.basictype</a> = internal constant %<a href="#format_basic_type">llvm.dbg.basictype.type</a> {
Jim Laskey7089f452006-06-16 13:14:03 +00001240 uint add(uint 36, uint 262144),
Jim Laskeycec12a52006-03-14 18:08:46 +00001241 { }* cast (%<a href="#format_compile_units">llvm.dbg.compile_unit.type</a>* %<a href="#format_compile_units">llvm.dbg.compile_unit</a> to { }*),
1242 sbyte* getelementptr ([5 x sbyte]* %str1, int 0, int 0),
1243 { }* null,
1244 int 0,
1245 uint 32,
1246 uint 32,
1247 uint 0,
1248 uint 2 }, section "llvm.metadata"
1249%str1 = internal constant [5 x sbyte] c"bool\00", section "llvm.metadata"
1250</pre>
1251
1252</div>
1253
1254<!-- ======================================================================= -->
1255<div class="doc_subsubsection">
1256 <a name="ccxx_basic_char">char</a>
1257</div>
1258
1259<div class="doc_text">
1260
1261<pre>
1262%<a href="#format_basic_type">llvm.dbg.basictype</a> = internal constant %<a href="#format_basic_type">llvm.dbg.basictype.type</a> {
Jim Laskey7089f452006-06-16 13:14:03 +00001263 uint add(uint 36, uint 262144),
Jim Laskeycec12a52006-03-14 18:08:46 +00001264 { }* cast (%<a href="#format_compile_units">llvm.dbg.compile_unit.type</a>* %<a href="#format_compile_units">llvm.dbg.compile_unit</a> to { }*),
1265 sbyte* getelementptr ([5 x sbyte]* %str1, int 0, int 0),
1266 { }* null,
1267 int 0,
1268 uint 8,
1269 uint 8,
1270 uint 0,
1271 uint 6 }, section "llvm.metadata"
1272%str1 = internal constant [5 x sbyte] c"char\00", section "llvm.metadata"
1273</pre>
1274
1275</div>
1276
1277<!-- ======================================================================= -->
1278<div class="doc_subsubsection">
1279 <a name="ccxx_basic_unsigned_char">unsigned char</a>
1280</div>
1281
1282<div class="doc_text">
1283
1284<pre>
1285%<a href="#format_basic_type">llvm.dbg.basictype</a> = internal constant %<a href="#format_basic_type">llvm.dbg.basictype.type</a> {
Jim Laskey7089f452006-06-16 13:14:03 +00001286 uint add(uint 36, uint 262144),
Jim Laskeycec12a52006-03-14 18:08:46 +00001287 { }* cast (%<a href="#format_compile_units">llvm.dbg.compile_unit.type</a>* %<a href="#format_compile_units">llvm.dbg.compile_unit</a> to { }*),
1288 sbyte* getelementptr ([14 x sbyte]* %str1, int 0, int 0),
1289 { }* null,
1290 int 0,
1291 uint 8,
1292 uint 8,
1293 uint 0,
1294 uint 8 }, section "llvm.metadata"
1295%str1 = internal constant [14 x sbyte] c"unsigned char\00", section "llvm.metadata"
1296</pre>
1297
1298</div>
1299
1300<!-- ======================================================================= -->
1301<div class="doc_subsubsection">
1302 <a name="ccxx_basic_short">short</a>
1303</div>
1304
1305<div class="doc_text">
1306
1307<pre>
1308%<a href="#format_basic_type">llvm.dbg.basictype</a> = internal constant %<a href="#format_basic_type">llvm.dbg.basictype.type</a> {
Jim Laskey7089f452006-06-16 13:14:03 +00001309 uint add(uint 36, uint 262144),
Jim Laskeycec12a52006-03-14 18:08:46 +00001310 { }* cast (%<a href="#format_compile_units">llvm.dbg.compile_unit.type</a>* %<a href="#format_compile_units">llvm.dbg.compile_unit</a> to { }*),
1311 sbyte* getelementptr ([10 x sbyte]* %str1, int 0, int 0),
1312 { }* null,
1313 int 0,
1314 uint 16,
1315 uint 16,
1316 uint 0,
1317 uint 5 }, section "llvm.metadata"
1318%str1 = internal constant [10 x sbyte] c"short int\00", section "llvm.metadata"
1319</pre>
1320
1321</div>
1322
1323<!-- ======================================================================= -->
1324<div class="doc_subsubsection">
1325 <a name="ccxx_basic_unsigned_short">unsigned short</a>
1326</div>
1327
1328<div class="doc_text">
1329
1330<pre>
1331%<a href="#format_basic_type">llvm.dbg.basictype</a> = internal constant %<a href="#format_basic_type">llvm.dbg.basictype.type</a> {
Jim Laskey7089f452006-06-16 13:14:03 +00001332 uint add(uint 36, uint 262144),
Jim Laskeycec12a52006-03-14 18:08:46 +00001333 { }* cast (%<a href="#format_compile_units">llvm.dbg.compile_unit.type</a>* %<a href="#format_compile_units">llvm.dbg.compile_unit</a> to { }*),
1334 sbyte* getelementptr ([19 x sbyte]* %str1, int 0, int 0),
1335 { }* null,
1336 int 0,
1337 uint 16,
1338 uint 16,
1339 uint 0,
1340 uint 7 }, section "llvm.metadata"
1341%str1 = internal constant [19 x sbyte] c"short unsigned int\00", section "llvm.metadata"
1342</pre>
1343
1344</div>
1345
1346<!-- ======================================================================= -->
1347<div class="doc_subsubsection">
1348 <a name="ccxx_basic_int">int</a>
1349</div>
1350
1351<div class="doc_text">
1352
1353<pre>
1354%<a href="#format_basic_type">llvm.dbg.basictype</a> = internal constant %<a href="#format_basic_type">llvm.dbg.basictype.type</a> {
Jim Laskey7089f452006-06-16 13:14:03 +00001355 uint add(uint 36, uint 262144),
Jim Laskeycec12a52006-03-14 18:08:46 +00001356 { }* cast (%<a href="#format_compile_units">llvm.dbg.compile_unit.type</a>* %<a href="#format_compile_units">llvm.dbg.compile_unit</a> to { }*),
1357 sbyte* getelementptr ([4 x sbyte]* %str1, int 0, int 0),
1358 { }* null,
1359 int 0,
1360 uint 32,
1361 uint 32,
1362 uint 0,
1363 uint 5 }, section "llvm.metadata"
1364%str1 = internal constant [4 x sbyte] c"int\00", section "llvm.metadata"
1365</pre>
1366
1367</div>
1368
1369<!-- ======================================================================= -->
1370<div class="doc_subsubsection">
1371 <a name="ccxx_basic_unsigned_int">unsigned int</a>
1372</div>
1373
1374<div class="doc_text">
1375
1376<pre>
1377%<a href="#format_basic_type">llvm.dbg.basictype</a> = internal constant %<a href="#format_basic_type">llvm.dbg.basictype.type</a> {
Jim Laskey7089f452006-06-16 13:14:03 +00001378 uint add(uint 36, uint 262144),
Jim Laskeycec12a52006-03-14 18:08:46 +00001379 { }* cast (%<a href="#format_compile_units">llvm.dbg.compile_unit.type</a>* %<a href="#format_compile_units">llvm.dbg.compile_unit</a> to { }*),
1380 sbyte* getelementptr ([13 x sbyte]* %str1, int 0, int 0),
1381 { }* null,
1382 int 0,
1383 uint 32,
1384 uint 32,
1385 uint 0,
1386 uint 7 }, section "llvm.metadata"
1387%str1 = internal constant [13 x sbyte] c"unsigned int\00", section "llvm.metadata"
1388</pre>
1389
1390</div>
1391
1392<!-- ======================================================================= -->
1393<div class="doc_subsubsection">
1394 <a name="ccxx_basic_long_long">long long</a>
1395</div>
1396
1397<div class="doc_text">
1398
1399<pre>
1400%<a href="#format_basic_type">llvm.dbg.basictype</a> = internal constant %<a href="#format_basic_type">llvm.dbg.basictype.type</a> {
Jim Laskey7089f452006-06-16 13:14:03 +00001401 uint add(uint 36, uint 262144),
Jim Laskeycec12a52006-03-14 18:08:46 +00001402 { }* cast (%<a href="#format_compile_units">llvm.dbg.compile_unit.type</a>* %<a href="#format_compile_units">llvm.dbg.compile_unit</a> to { }*),
1403 sbyte* getelementptr ([14 x sbyte]* %str1, int 0, int 0),
1404 { }* null,
1405 int 0,
1406 uint 64,
1407 uint 64,
1408 uint 0,
1409 uint 5 }, section "llvm.metadata"
1410%str1 = internal constant [14 x sbyte] c"long long int\00", section "llvm.metadata"
1411</pre>
1412
1413</div>
1414
1415<!-- ======================================================================= -->
1416<div class="doc_subsubsection">
1417 <a name="ccxx_basic_unsigned_long_long">unsigned long long</a>
1418</div>
1419
1420<div class="doc_text">
1421
1422<pre>
1423%<a href="#format_basic_type">llvm.dbg.basictype</a> = internal constant %<a href="#format_basic_type">llvm.dbg.basictype.type</a> {
Jim Laskey7089f452006-06-16 13:14:03 +00001424 uint add(uint 36, uint 262144),
Jim Laskeycec12a52006-03-14 18:08:46 +00001425 { }* cast (%<a href="#format_compile_units">llvm.dbg.compile_unit.type</a>* %<a href="#format_compile_units">llvm.dbg.compile_unit</a> to { }*),
1426 sbyte* getelementptr ([23 x sbyte]* %str1, int 0, int 0),
1427 { }* null,
1428 int 0,
1429 uint 64,
1430 uint 64,
1431 uint 0,
1432 uint 7 }, section "llvm.metadata"
1433%str1 = internal constant [23 x sbyte] c"long long unsigned int\00", section "llvm.metadata"
1434</pre>
1435
1436</div>
1437
1438<!-- ======================================================================= -->
1439<div class="doc_subsubsection">
1440 <a name="ccxx_basic_float">float</a>
1441</div>
1442
1443<div class="doc_text">
1444
1445<pre>
1446%<a href="#format_basic_type">llvm.dbg.basictype</a> = internal constant %<a href="#format_basic_type">llvm.dbg.basictype.type</a> {
Jim Laskey7089f452006-06-16 13:14:03 +00001447 uint add(uint 36, uint 262144),
Jim Laskeycec12a52006-03-14 18:08:46 +00001448 { }* cast (%<a href="#format_compile_units">llvm.dbg.compile_unit.type</a>* %<a href="#format_compile_units">llvm.dbg.compile_unit</a> to { }*),
1449 sbyte* getelementptr ([6 x sbyte]* %str1, int 0, int 0),
1450 { }* null,
1451 int 0,
1452 uint 32,
1453 uint 32,
1454 uint 0,
1455 uint 4 }, section "llvm.metadata"
1456%str1 = internal constant [6 x sbyte] c"float\00", section "llvm.metadata"
1457</pre>
1458
1459</div>
1460
1461<!-- ======================================================================= -->
1462<div class="doc_subsubsection">
1463 <a name="ccxx_basic_double">double</a>
1464</div>
1465
1466<div class="doc_text">
1467
1468<pre>
1469%<a href="#format_basic_type">llvm.dbg.basictype</a> = internal constant %<a href="#format_basic_type">llvm.dbg.basictype.type</a> {
Jim Laskey7089f452006-06-16 13:14:03 +00001470 uint add(uint 36, uint 262144),
Jim Laskeycec12a52006-03-14 18:08:46 +00001471 { }* cast (%<a href="#format_compile_units">llvm.dbg.compile_unit.type</a>* %<a href="#format_compile_units">llvm.dbg.compile_unit</a> to { }*),
1472 sbyte* getelementptr ([7 x sbyte]* %str1, int 0, int 0),
1473 { }* null,
1474 int 0,
1475 uint 64,
1476 uint 64,
1477 uint 0,
1478 uint 4 }, section "llvm.metadata"
1479%str1 = internal constant [7 x sbyte] c"double\00", section "llvm.metadata"
1480</pre>
1481
1482</div>
1483
1484<!-- ======================================================================= -->
1485<div class="doc_subsection">
1486 <a name="ccxx_derived_types">C/C++ derived types</a>
1487</div>
1488
1489<div class="doc_text">
1490
1491<p>Given the following as an example of C/C++ derived type;</p>
1492
1493<pre>
1494typedef const int *IntPtr;
1495</pre>
1496
1497<p>a C/C++ front-end would generate the following descriptors;</p>
1498
1499<pre>
1500;;
1501;; Define the typedef "IntPtr".
1502;;
1503%<a href="#format_derived_type">llvm.dbg.derivedtype1</a> = internal constant %<a href="#format_derived_type">llvm.dbg.derivedtype.type</a> {
Jim Laskey7089f452006-06-16 13:14:03 +00001504 uint add(uint 22, uint 262144),
Jim Laskeycec12a52006-03-14 18:08:46 +00001505 { }* cast (%<a href="#format_compile_units">llvm.dbg.compile_unit.type</a>* %<a href="#format_compile_units">llvm.dbg.compile_unit</a> to { }*),
1506 sbyte* getelementptr ([7 x sbyte]* %str1, int 0, int 0),
1507 { }* cast (%<a href="#format_compile_units">llvm.dbg.compile_unit.type</a>* %<a href="#format_compile_units">llvm.dbg.compile_unit</a> to { }*),
1508 int 1,
1509 uint 0,
1510 uint 0,
1511 uint 0,
1512 { }* cast (%<a href="#format_derived_type">llvm.dbg.derivedtype.type</a>* %<a href="#format_derived_type">llvm.dbg.derivedtype2</a> to { }*) }, section "llvm.metadata"
1513%str1 = internal constant [7 x sbyte] c"IntPtr\00", section "llvm.metadata"
1514
1515;;
1516;; Define the pointer type.
1517;;
1518%<a href="#format_derived_type">llvm.dbg.derivedtype2</a> = internal constant %<a href="#format_derived_type">llvm.dbg.derivedtype.type</a> {
Jim Laskey7089f452006-06-16 13:14:03 +00001519 uint add(uint 15, uint 262144),
Jim Laskeycec12a52006-03-14 18:08:46 +00001520 { }* cast (%<a href="#format_compile_units">llvm.dbg.compile_unit.type</a>* %<a href="#format_compile_units">llvm.dbg.compile_unit</a> to { }*),
Jim Laskey4d9b10b2006-03-14 18:50:50 +00001521 sbyte* null,
Jim Laskeycec12a52006-03-14 18:08:46 +00001522 { }* null,
1523 int 0,
1524 uint 32,
1525 uint 32,
1526 uint 0,
1527 { }* cast (%<a href="#format_derived_type">llvm.dbg.derivedtype.type</a>* %<a href="#format_derived_type">llvm.dbg.derivedtype3</a> to { }*) }, section "llvm.metadata"
Jim Laskeycec12a52006-03-14 18:08:46 +00001528
1529;;
1530;; Define the const type.
1531;;
1532%<a href="#format_derived_type">llvm.dbg.derivedtype3</a> = internal constant %<a href="#format_derived_type">llvm.dbg.derivedtype.type</a> {
Jim Laskey7089f452006-06-16 13:14:03 +00001533 uint add(uint 38, uint 262144),
Jim Laskeycec12a52006-03-14 18:08:46 +00001534 { }* cast (%<a href="#format_compile_units">llvm.dbg.compile_unit.type</a>* %<a href="#format_compile_units">llvm.dbg.compile_unit</a> to { }*),
Jim Laskey4d9b10b2006-03-14 18:50:50 +00001535 sbyte* null,
Jim Laskeycec12a52006-03-14 18:08:46 +00001536 { }* null,
1537 int 0,
1538 uint 0,
1539 uint 0,
1540 uint 0,
1541 { }* cast (%<a href="#format_basic_type">llvm.dbg.basictype.type</a>* %<a href="#format_basic_type">llvm.dbg.basictype1</a> to { }*) }, section "llvm.metadata"
1542
1543;;
1544;; Define the int type.
1545;;
1546%<a href="#format_basic_type">llvm.dbg.basictype1</a> = internal constant %<a href="#format_basic_type">llvm.dbg.basictype.type</a> {
Jim Laskey7089f452006-06-16 13:14:03 +00001547 uint add(uint 36, uint 262144),
Jim Laskeycec12a52006-03-14 18:08:46 +00001548 { }* cast (%<a href="#format_compile_units">llvm.dbg.compile_unit.type</a>* %<a href="#format_compile_units">llvm.dbg.compile_unit</a> to { }*),
Jim Laskey4d9b10b2006-03-14 18:50:50 +00001549 sbyte* getelementptr ([4 x sbyte]* %str2, int 0, int 0),
Jim Laskeycec12a52006-03-14 18:08:46 +00001550 { }* null,
1551 int 0,
1552 uint 32,
1553 uint 32,
1554 uint 0,
1555 uint 5 }, section "llvm.metadata"
Jim Laskey4d9b10b2006-03-14 18:50:50 +00001556%str2 = internal constant [4 x sbyte] c"int\00", section "llvm.metadata"
Jim Laskeycec12a52006-03-14 18:08:46 +00001557</pre>
1558
1559</div>
1560
1561<!-- ======================================================================= -->
1562<div class="doc_subsection">
1563 <a name="ccxx_composite_types">C/C++ struct/union types</a>
1564</div>
1565
1566<div class="doc_text">
1567
1568<p>Given the following as an example of C/C++ struct type;</p>
1569
1570<pre>
1571struct Color {
1572 unsigned Red;
1573 unsigned Green;
1574 unsigned Blue;
1575};
1576</pre>
1577
1578<p>a C/C++ front-end would generate the following descriptors;</p>
1579
1580<pre>
1581;;
1582;; Define basic type for unsigned int.
1583;;
1584%<a href="#format_basic_type">llvm.dbg.basictype</a> = internal constant %<a href="#format_basic_type">llvm.dbg.basictype.type</a> {
Jim Laskey7089f452006-06-16 13:14:03 +00001585 uint add(uint 36, uint 262144),
Jim Laskeycec12a52006-03-14 18:08:46 +00001586 { }* cast (%<a href="#format_compile_units">llvm.dbg.compile_unit.type</a>* %<a href="#format_compile_units">llvm.dbg.compile_unit</a> to { }*),
1587 sbyte* getelementptr ([13 x sbyte]* %str1, int 0, int 0),
1588 { }* null,
1589 int 0,
1590 uint 32,
1591 uint 32,
1592 uint 0,
1593 uint 7 }, section "llvm.metadata"
1594%str1 = internal constant [13 x sbyte] c"unsigned int\00", section "llvm.metadata"
1595
1596;;
1597;; Define composite type for struct Color.
1598;;
1599%<a href="#format_composite_type">llvm.dbg.compositetype</a> = internal constant %<a href="#format_composite_type">llvm.dbg.compositetype.type</a> {
Jim Laskey7089f452006-06-16 13:14:03 +00001600 uint add(uint 19, uint 262144),
Jim Laskeycec12a52006-03-14 18:08:46 +00001601 { }* cast (%<a href="#format_compile_units">llvm.dbg.compile_unit.type</a>* %<a href="#format_compile_units">llvm.dbg.compile_unit</a> to { }*),
1602 sbyte* getelementptr ([6 x sbyte]* %str2, int 0, int 0),
1603 { }* cast (%<a href="#format_compile_units">llvm.dbg.compile_unit.type</a>* %<a href="#format_compile_units">llvm.dbg.compile_unit</a> to { }*),
1604 int 1,
1605 uint 96,
1606 uint 32,
1607 uint 0,
Jim Laskeyf8a01a92006-06-15 20:51:43 +00001608 { }* null,
Jim Laskeycec12a52006-03-14 18:08:46 +00001609 { }* cast ([3 x { }*]* %llvm.dbg.array to { }*) }, section "llvm.metadata"
1610%str2 = internal constant [6 x sbyte] c"Color\00", section "llvm.metadata"
1611
1612;;
1613;; Define the Red field.
1614;;
1615%<a href="#format_derived_type">llvm.dbg.derivedtype1</a> = internal constant %<a href="#format_derived_type">llvm.dbg.derivedtype.type</a> {
Jim Laskey7089f452006-06-16 13:14:03 +00001616 uint add(uint 13, uint 262144),
Jim Laskeycec12a52006-03-14 18:08:46 +00001617 { }* null,
1618 sbyte* getelementptr ([4 x sbyte]* %str3, int 0, int 0),
1619 { }* cast (%<a href="#format_compile_units">llvm.dbg.compile_unit.type</a>* %<a href="#format_compile_units">llvm.dbg.compile_unit</a> to { }*),
1620 int 2,
1621 uint 32,
1622 uint 32,
1623 uint 0,
1624 { }* cast (%<a href="#format_basic_type">llvm.dbg.basictype.type</a>* %<a href="#format_basic_type">llvm.dbg.basictype</a> to { }*) }, section "llvm.metadata"
1625%str3 = internal constant [4 x sbyte] c"Red\00", section "llvm.metadata"
1626
1627;;
1628;; Define the Green field.
1629;;
1630%<a href="#format_derived_type">llvm.dbg.derivedtype2</a> = internal constant %<a href="#format_derived_type">llvm.dbg.derivedtype.type</a> {
Jim Laskey7089f452006-06-16 13:14:03 +00001631 uint add(uint 13, uint 262144),
Jim Laskeycec12a52006-03-14 18:08:46 +00001632 { }* null,
1633 sbyte* getelementptr ([6 x sbyte]* %str4, int 0, int 0),
1634 { }* cast (%<a href="#format_compile_units">llvm.dbg.compile_unit.type</a>* %<a href="#format_compile_units">llvm.dbg.compile_unit</a> to { }*),
1635 int 3,
1636 uint 32,
1637 uint 32,
1638 uint 32,
1639 { }* cast (%<a href="#format_basic_type">llvm.dbg.basictype.type</a>* %<a href="#format_basic_type">llvm.dbg.basictype</a> to { }*) }, section "llvm.metadata"
1640%str4 = internal constant [6 x sbyte] c"Green\00", section "llvm.metadata"
1641
1642;;
1643;; Define the Blue field.
1644;;
1645%<a href="#format_derived_type">llvm.dbg.derivedtype3</a> = internal constant %<a href="#format_derived_type">llvm.dbg.derivedtype.type</a> {
Jim Laskey7089f452006-06-16 13:14:03 +00001646 uint add(uint 13, uint 262144),
Jim Laskeycec12a52006-03-14 18:08:46 +00001647 { }* null,
1648 sbyte* getelementptr ([5 x sbyte]* %str5, int 0, int 0),
1649 { }* cast (%<a href="#format_compile_units">llvm.dbg.compile_unit.type</a>* %<a href="#format_compile_units">llvm.dbg.compile_unit</a> to { }*),
1650 int 4,
1651 uint 32,
1652 uint 32,
1653 uint 64,
1654 { }* cast (%<a href="#format_basic_type">llvm.dbg.basictype.type</a>* %<a href="#format_basic_type">llvm.dbg.basictype</a> to { }*) }, section "llvm.metadata"
1655%str5 = internal constant [5 x sbyte] c"Blue\00", section "llvm.metadata"
1656
1657;;
1658;; Define the array of fields used by the composite type Color.
1659;;
1660%llvm.dbg.array = internal constant [3 x { }*] [
1661 { }* cast (%<a href="#format_derived_type">llvm.dbg.derivedtype.type</a>* %<a href="#format_derived_type">llvm.dbg.derivedtype1</a> to { }*),
1662 { }* cast (%<a href="#format_derived_type">llvm.dbg.derivedtype.type</a>* %<a href="#format_derived_type">llvm.dbg.derivedtype2</a> to { }*),
1663 { }* cast (%<a href="#format_derived_type">llvm.dbg.derivedtype.type</a>* %<a href="#format_derived_type">llvm.dbg.derivedtype3</a> to { }*) ], section "llvm.metadata"
1664</pre>
1665
1666</div>
1667
1668<!-- ======================================================================= -->
1669<div class="doc_subsection">
1670 <a name="ccxx_enumeration_types">C/C++ enumeration types</a>
1671</div>
1672
1673<div class="doc_text">
1674
1675<p>Given the following as an example of C/C++ enumeration type;</p>
1676
1677<pre>
1678enum Trees {
1679 Spruce = 100,
1680 Oak = 200,
1681 Maple = 300
1682};
1683</pre>
1684
1685<p>a C/C++ front-end would generate the following descriptors;</p>
1686
1687<pre>
1688;;
1689;; Define composite type for enum Trees
1690;;
1691%<a href="#format_composite_type">llvm.dbg.compositetype</a> = internal constant %<a href="#format_composite_type">llvm.dbg.compositetype.type</a> {
Jim Laskey7089f452006-06-16 13:14:03 +00001692 uint add(uint 4, uint 262144),
Jim Laskeycec12a52006-03-14 18:08:46 +00001693 { }* cast (%<a href="#format_compile_units">llvm.dbg.compile_unit.type</a>* %<a href="#format_compile_units">llvm.dbg.compile_unit</a> to { }*),
1694 sbyte* getelementptr ([6 x sbyte]* %str1, int 0, int 0),
1695 { }* cast (%<a href="#format_compile_units">llvm.dbg.compile_unit.type</a>* %<a href="#format_compile_units">llvm.dbg.compile_unit</a> to { }*),
1696 int 1,
1697 uint 32,
1698 uint 32,
1699 uint 0,
1700 { }* null,
1701 { }* cast ([3 x { }*]* %llvm.dbg.array to { }*) }, section "llvm.metadata"
1702%str1 = internal constant [6 x sbyte] c"Trees\00", section "llvm.metadata"
1703
1704;;
1705;; Define Spruce enumerator.
1706;;
1707%<a href="#format_enumeration">llvm.dbg.enumerator1</a> = internal constant %<a href="#format_enumeration">llvm.dbg.enumerator.type</a> {
Jim Laskey7089f452006-06-16 13:14:03 +00001708 uint add(uint 40, uint 262144),
Jim Laskeycec12a52006-03-14 18:08:46 +00001709 sbyte* getelementptr ([7 x sbyte]* %str2, int 0, int 0),
1710 int 100 }, section "llvm.metadata"
1711%str2 = internal constant [7 x sbyte] c"Spruce\00", section "llvm.metadata"
1712
1713;;
1714;; Define Oak enumerator.
1715;;
1716%<a href="#format_enumeration">llvm.dbg.enumerator2</a> = internal constant %<a href="#format_enumeration">llvm.dbg.enumerator.type</a> {
Jim Laskey7089f452006-06-16 13:14:03 +00001717 uint add(uint 40, uint 262144),
Jim Laskeycec12a52006-03-14 18:08:46 +00001718 sbyte* getelementptr ([4 x sbyte]* %str3, int 0, int 0),
1719 int 200 }, section "llvm.metadata"
1720%str3 = internal constant [4 x sbyte] c"Oak\00", section "llvm.metadata"
1721
1722;;
1723;; Define Maple enumerator.
1724;;
1725%<a href="#format_enumeration">llvm.dbg.enumerator3</a> = internal constant %<a href="#format_enumeration">llvm.dbg.enumerator.type</a> {
Jim Laskey7089f452006-06-16 13:14:03 +00001726 uint add(uint 40, uint 262144),
Jim Laskeycec12a52006-03-14 18:08:46 +00001727 sbyte* getelementptr ([6 x sbyte]* %str4, int 0, int 0),
1728 int 300 }, section "llvm.metadata"
1729%str4 = internal constant [6 x sbyte] c"Maple\00", section "llvm.metadata"
1730
1731;;
1732;; Define the array of enumerators used by composite type Trees.
1733;;
1734%llvm.dbg.array = internal constant [3 x { }*] [
1735 { }* cast (%<a href="#format_enumeration">llvm.dbg.enumerator.type</a>* %<a href="#format_enumeration">llvm.dbg.enumerator1</a> to { }*),
1736 { }* cast (%<a href="#format_enumeration">llvm.dbg.enumerator.type</a>* %<a href="#format_enumeration">llvm.dbg.enumerator2</a> to { }*),
1737 { }* cast (%<a href="#format_enumeration">llvm.dbg.enumerator.type</a>* %<a href="#format_enumeration">llvm.dbg.enumerator3</a> to { }*) ], section "llvm.metadata"
1738</pre>
1739
1740</div>
Chris Lattnerbdfb3392004-01-05 05:06:33 +00001741
1742<!-- *********************************************************************** -->
Misha Brukman82873732004-05-12 19:21:57 +00001743
Chris Lattnerbdfb3392004-01-05 05:06:33 +00001744<hr>
Misha Brukman82873732004-05-12 19:21:57 +00001745<address>
1746 <a href="http://jigsaw.w3.org/css-validator/check/referer"><img
1747 src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Valid CSS!"></a>
1748 <a href="http://validator.w3.org/check/referer"><img
1749 src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!"></a>
1750
1751 <a href="mailto:sabre@nondot.org">Chris Lattner</a><br>
Reid Spencer05fe4b02006-03-14 05:39:39 +00001752 <a href="http://llvm.org">LLVM Compiler Infrastructure</a><br>
Chris Lattnerbdfb3392004-01-05 05:06:33 +00001753 Last modified: $Date$
Misha Brukman82873732004-05-12 19:21:57 +00001754</address>
Chris Lattnerbdfb3392004-01-05 05:06:33 +00001755
1756</body>
1757</html>