blob: c9ae0202def4e42c399e18e1862d4c20d389c914 [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>
Bill Wendling48839d92009-05-17 05:52:39 +00005 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
Chris Lattnerbdfb3392004-01-05 05:06:33 +00006 <title>Source Level Debugging with LLVM</title>
7 <link rel="stylesheet" href="llvm.css" type="text/css">
8</head>
9<body>
10
NAKAMURA Takumi05d02652011-04-18 23:59:50 +000011<h1>Source Level Debugging with LLVM</h1>
Chris Lattnerbdfb3392004-01-05 05:06:33 +000012
Reid Spencerd3f876c2004-11-01 08:19:36 +000013<table class="layout" style="width:100%">
14 <tr class="layout">
15 <td class="left">
Chris Lattnerbdfb3392004-01-05 05:06:33 +000016<ul>
Misha Brukman82873732004-05-12 19:21:57 +000017 <li><a href="#introduction">Introduction</a>
Chris Lattnerbdfb3392004-01-05 05:06:33 +000018 <ol>
19 <li><a href="#phil">Philosophy behind LLVM debugging information</a></li>
Jim Laskey383e0092006-03-23 17:54:33 +000020 <li><a href="#consumers">Debug information consumers</a></li>
Chris Lattnerbdfb3392004-01-05 05:06:33 +000021 <li><a href="#debugopt">Debugging optimized code</a></li>
Misha Brukman82873732004-05-12 19:21:57 +000022 </ol></li>
Misha Brukman82873732004-05-12 19:21:57 +000023 <li><a href="#format">Debugging information format</a>
Chris Lattnerbdfb3392004-01-05 05:06:33 +000024 <ol>
Jim Laskeycec12a52006-03-14 18:08:46 +000025 <li><a href="#debug_info_descriptors">Debug information descriptors</a>
Chris Lattnerbdfb3392004-01-05 05:06:33 +000026 <ul>
Jim Laskeycec12a52006-03-14 18:08:46 +000027 <li><a href="#format_compile_units">Compile unit descriptors</a></li>
Devang Patel4b945502010-03-09 00:44:10 +000028 <li><a href="#format_files">File descriptors</a></li>
Jim Laskeycec12a52006-03-14 18:08:46 +000029 <li><a href="#format_global_variables">Global variable descriptors</a></li>
30 <li><a href="#format_subprograms">Subprogram descriptors</a></li>
Jim Laskey3d11bee2006-03-15 19:10:52 +000031 <li><a href="#format_blocks">Block descriptors</a></li>
Jim Laskeycec12a52006-03-14 18:08:46 +000032 <li><a href="#format_basic_type">Basic type descriptors</a></li>
33 <li><a href="#format_derived_type">Derived type descriptors</a></li>
34 <li><a href="#format_composite_type">Composite type descriptors</a></li>
35 <li><a href="#format_subrange">Subrange descriptors</a></li>
36 <li><a href="#format_enumeration">Enumerator descriptors</a></li>
Jim Laskey383e0092006-03-23 17:54:33 +000037 <li><a href="#format_variables">Local variables</a></li>
Misha Brukman82873732004-05-12 19:21:57 +000038 </ul></li>
Jim Laskeycec12a52006-03-14 18:08:46 +000039 <li><a href="#format_common_intrinsics">Debugger intrinsic functions</a>
40 <ul>
Jim Laskeycec12a52006-03-14 18:08:46 +000041 <li><a href="#format_common_declare">llvm.dbg.declare</a></li>
Victor Hernandez67a1a542010-01-11 22:53:48 +000042 <li><a href="#format_common_value">llvm.dbg.value</a></li>
Jim Laskeycec12a52006-03-14 18:08:46 +000043 </ul></li>
Misha Brukman82873732004-05-12 19:21:57 +000044 </ol></li>
Devang Patel744950d2009-11-25 23:28:01 +000045 <li><a href="#format_common_lifetime">Object lifetimes and scoping</a></li>
Misha Brukman82873732004-05-12 19:21:57 +000046 <li><a href="#ccxx_frontend">C/C++ front-end specific debug information</a>
Chris Lattnerbdfb3392004-01-05 05:06:33 +000047 <ol>
Jim Laskeycec12a52006-03-14 18:08:46 +000048 <li><a href="#ccxx_compile_units">C/C++ source file information</a></li>
49 <li><a href="#ccxx_global_variable">C/C++ global variable information</a></li>
50 <li><a href="#ccxx_subprogram">C/C++ function information</a></li>
51 <li><a href="#ccxx_basic_types">C/C++ basic types</a></li>
52 <li><a href="#ccxx_derived_types">C/C++ derived types</a></li>
53 <li><a href="#ccxx_composite_types">C/C++ struct/union types</a></li>
54 <li><a href="#ccxx_enumeration_types">C/C++ enumeration types</a></li>
Misha Brukman82873732004-05-12 19:21:57 +000055 </ol></li>
Chris Lattnerbdfb3392004-01-05 05:06:33 +000056</ul>
Misha Brukman82873732004-05-12 19:21:57 +000057</td>
Reid Spencerd3f876c2004-11-01 08:19:36 +000058<td class="right">
Misha Brukmane849a1a2004-05-12 21:26:16 +000059<img src="img/venusflytrap.jpg" alt="A leafy and green bug eater" width="247"
Misha Brukman82873732004-05-12 19:21:57 +000060height="369">
61</td>
Reid Spencerd3f876c2004-11-01 08:19:36 +000062</tr></table>
Misha Brukman82873732004-05-12 19:21:57 +000063
Chris Lattner7911ce22004-05-23 21:07:27 +000064<div class="doc_author">
Jim Laskeycec12a52006-03-14 18:08:46 +000065 <p>Written by <a href="mailto:sabre@nondot.org">Chris Lattner</a>
Jim Laskeyc760a922007-03-14 19:32:21 +000066 and <a href="mailto:jlaskey@mac.com">Jim Laskey</a></p>
Chris Lattner7911ce22004-05-23 21:07:27 +000067</div>
68
Chris Lattnerbdfb3392004-01-05 05:06:33 +000069
70<!-- *********************************************************************** -->
NAKAMURA Takumi05d02652011-04-18 23:59:50 +000071<h2><a name="introduction">Introduction</a></h2>
Misha Brukman94218a72004-12-09 20:27:37 +000072<!-- *********************************************************************** -->
Chris Lattnerbdfb3392004-01-05 05:06:33 +000073
NAKAMURA Takumif5af6ad2011-04-23 00:30:22 +000074<div>
Chris Lattnerbdfb3392004-01-05 05:06:33 +000075
76<p>This document is the central repository for all information pertaining to
Bill Wendling48839d92009-05-17 05:52:39 +000077 debug information in LLVM. It describes the <a href="#format">actual format
78 that the LLVM debug information</a> takes, which is useful for those
79 interested in creating front-ends or dealing directly with the information.
Chris Lattner8ad2f982009-07-18 21:47:15 +000080 Further, this document provides specific examples of what debug information
Chris Lattner89940752011-01-18 06:12:10 +000081 for C/C++ looks like.</p>
Chris Lattnerbdfb3392004-01-05 05:06:33 +000082
Chris Lattnerbdfb3392004-01-05 05:06:33 +000083<!-- ======================================================================= -->
NAKAMURA Takumi05d02652011-04-18 23:59:50 +000084<h3>
Chris Lattnerbdfb3392004-01-05 05:06:33 +000085 <a name="phil">Philosophy behind LLVM debugging information</a>
NAKAMURA Takumi05d02652011-04-18 23:59:50 +000086</h3>
Chris Lattnerbdfb3392004-01-05 05:06:33 +000087
NAKAMURA Takumif5af6ad2011-04-23 00:30:22 +000088<div>
Chris Lattnerbdfb3392004-01-05 05:06:33 +000089
Misha Brukman82873732004-05-12 19:21:57 +000090<p>The idea of the LLVM debugging information is to capture how the important
Bill Wendling48839d92009-05-17 05:52:39 +000091 pieces of the source-language's Abstract Syntax Tree map onto LLVM code.
92 Several design aspects have shaped the solution that appears here. The
93 important ones are:</p>
Chris Lattnerbdfb3392004-01-05 05:06:33 +000094
Misha Brukman82873732004-05-12 19:21:57 +000095<ul>
Bill Wendling48839d92009-05-17 05:52:39 +000096 <li>Debugging information should have very little impact on the rest of the
97 compiler. No transformations, analyses, or code generators should need to
98 be modified because of debugging information.</li>
Chris Lattnerbdfb3392004-01-05 05:06:33 +000099
Bill Wendling48839d92009-05-17 05:52:39 +0000100 <li>LLVM optimizations should interact in <a href="#debugopt">well-defined and
101 easily described ways</a> with the debugging information.</li>
Chris Lattnerbdfb3392004-01-05 05:06:33 +0000102
Bill Wendling48839d92009-05-17 05:52:39 +0000103 <li>Because LLVM is designed to support arbitrary programming languages,
104 LLVM-to-LLVM tools should not need to know anything about the semantics of
105 the source-level-language.</li>
Chris Lattnerbdfb3392004-01-05 05:06:33 +0000106
Bill Wendling48839d92009-05-17 05:52:39 +0000107 <li>Source-level languages are often <b>widely</b> different from one another.
108 LLVM should not put any restrictions of the flavor of the source-language,
109 and the debugging information should work with any language.</li>
Chris Lattnerbdfb3392004-01-05 05:06:33 +0000110
Bill Wendling48839d92009-05-17 05:52:39 +0000111 <li>With code generator support, it should be possible to use an LLVM compiler
112 to compile a program to native machine code and standard debugging
113 formats. This allows compatibility with traditional machine-code level
114 debuggers, like GDB or DBX.</li>
Misha Brukman82873732004-05-12 19:21:57 +0000115</ul>
Chris Lattnerbdfb3392004-01-05 05:06:33 +0000116
Bill Wendling48839d92009-05-17 05:52:39 +0000117<p>The approach used by the LLVM implementation is to use a small set
118 of <a href="#format_common_intrinsics">intrinsic functions</a> to define a
119 mapping between LLVM program objects and the source-level objects. The
Devang Patele4b27562009-08-28 23:24:31 +0000120 description of the source-level program is maintained in LLVM metadata
121 in an <a href="#ccxx_frontend">implementation-defined format</a>
Bill Wendling48839d92009-05-17 05:52:39 +0000122 (the C/C++ front-end currently uses working draft 7 of
123 the <a href="http://www.eagercon.com/dwarf/dwarf3std.htm">DWARF 3
124 standard</a>).</p>
Chris Lattnerbdfb3392004-01-05 05:06:33 +0000125
Jim Laskeycec12a52006-03-14 18:08:46 +0000126<p>When a program is being debugged, a debugger interacts with the user and
Bill Wendling48839d92009-05-17 05:52:39 +0000127 turns the stored debug information into source-language specific information.
128 As such, a debugger must be aware of the source-language, and is thus tied to
129 a specific language or family of languages.</p>
Chris Lattnerbdfb3392004-01-05 05:06:33 +0000130
131</div>
132
Chris Lattnerbdfb3392004-01-05 05:06:33 +0000133<!-- ======================================================================= -->
NAKAMURA Takumi05d02652011-04-18 23:59:50 +0000134<h3>
Jim Laskey383e0092006-03-23 17:54:33 +0000135 <a name="consumers">Debug information consumers</a>
NAKAMURA Takumi05d02652011-04-18 23:59:50 +0000136</h3>
Jim Laskey383e0092006-03-23 17:54:33 +0000137
NAKAMURA Takumif5af6ad2011-04-23 00:30:22 +0000138<div>
Bill Wendling48839d92009-05-17 05:52:39 +0000139
Jim Laskey383e0092006-03-23 17:54:33 +0000140<p>The role of debug information is to provide meta information normally
Bill Wendling48839d92009-05-17 05:52:39 +0000141 stripped away during the compilation process. This meta information provides
142 an LLVM user a relationship between generated code and the original program
143 source code.</p>
Jim Laskey383e0092006-03-23 17:54:33 +0000144
Chris Lattnerc3107782010-04-05 04:11:11 +0000145<p>Currently, debug information is consumed by DwarfDebug to produce dwarf
Bill Wendling48839d92009-05-17 05:52:39 +0000146 information used by the gdb debugger. Other targets could use the same
147 information to produce stabs or other debug forms.</p>
Jim Laskey383e0092006-03-23 17:54:33 +0000148
149<p>It would also be reasonable to use debug information to feed profiling tools
Bill Wendling48839d92009-05-17 05:52:39 +0000150 for analysis of generated code, or, tools for reconstructing the original
151 source from generated code.</p>
Jim Laskey383e0092006-03-23 17:54:33 +0000152
153<p>TODO - expound a bit more.</p>
154
155</div>
156
157<!-- ======================================================================= -->
NAKAMURA Takumi05d02652011-04-18 23:59:50 +0000158<h3>
Chris Lattnerbdfb3392004-01-05 05:06:33 +0000159 <a name="debugopt">Debugging optimized code</a>
NAKAMURA Takumi05d02652011-04-18 23:59:50 +0000160</h3>
Chris Lattnerbdfb3392004-01-05 05:06:33 +0000161
NAKAMURA Takumif5af6ad2011-04-23 00:30:22 +0000162<div>
Chris Lattnerbdfb3392004-01-05 05:06:33 +0000163
Misha Brukman82873732004-05-12 19:21:57 +0000164<p>An extremely high priority of LLVM debugging information is to make it
Bill Wendling48839d92009-05-17 05:52:39 +0000165 interact well with optimizations and analysis. In particular, the LLVM debug
166 information provides the following guarantees:</p>
Misha Brukman82873732004-05-12 19:21:57 +0000167
168<ul>
Bill Wendling48839d92009-05-17 05:52:39 +0000169 <li>LLVM debug information <b>always provides information to accurately read
170 the source-level state of the program</b>, regardless of which LLVM
171 optimizations have been run, and without any modification to the
172 optimizations themselves. However, some optimizations may impact the
173 ability to modify the current state of the program with a debugger, such
174 as setting program variables, or calling functions that have been
175 deleted.</li>
Chris Lattnerbdfb3392004-01-05 05:06:33 +0000176
Bill Wendling48839d92009-05-17 05:52:39 +0000177 <li>LLVM optimizations gracefully interact with debugging information. If
178 they are not aware of debug information, they are automatically disabled
179 as necessary in the cases that would invalidate the debug info. This
180 retains the LLVM features, making it easy to write new
181 transformations.</li>
Chris Lattnerbdfb3392004-01-05 05:06:33 +0000182
Bill Wendling48839d92009-05-17 05:52:39 +0000183 <li>As desired, LLVM optimizations can be upgraded to be aware of the LLVM
184 debugging information, allowing them to update the debugging information
185 as they perform aggressive optimizations. This means that, with effort,
186 the LLVM optimizers could optimize debug code just as well as non-debug
187 code.</li>
Chris Lattnerbdfb3392004-01-05 05:06:33 +0000188
Bill Wendling48839d92009-05-17 05:52:39 +0000189 <li>LLVM debug information does not prevent many important optimizations from
190 happening (for example inlining, basic block reordering/merging/cleanup,
191 tail duplication, etc), further reducing the amount of the compiler that
192 eventually is "aware" of debugging information.</li>
Chris Lattnerbdfb3392004-01-05 05:06:33 +0000193
Bill Wendling48839d92009-05-17 05:52:39 +0000194 <li>LLVM debug information is automatically optimized along with the rest of
195 the program, using existing facilities. For example, duplicate
196 information is automatically merged by the linker, and unused information
197 is automatically removed.</li>
Misha Brukman82873732004-05-12 19:21:57 +0000198</ul>
Chris Lattnerbdfb3392004-01-05 05:06:33 +0000199
Misha Brukman82873732004-05-12 19:21:57 +0000200<p>Basically, the debug information allows you to compile a program with
Bill Wendling48839d92009-05-17 05:52:39 +0000201 "<tt>-O0 -g</tt>" and get full debug information, allowing you to arbitrarily
202 modify the program as it executes from a debugger. Compiling a program with
203 "<tt>-O3 -g</tt>" gives you full debug information that is always available
204 and accurate for reading (e.g., you get accurate stack traces despite tail
205 call elimination and inlining), but you might lose the ability to modify the
206 program and call functions where were optimized out of the program, or
207 inlined away completely.</p>
Chris Lattnerbdfb3392004-01-05 05:06:33 +0000208
Misha Brukman96e00812008-12-16 02:54:22 +0000209<p><a href="TestingGuide.html#quicktestsuite">LLVM test suite</a> provides a
Bill Wendling48839d92009-05-17 05:52:39 +0000210 framework to test optimizer's handling of debugging information. It can be
211 run like this:</p>
Devang Patela5c05aa2008-11-21 19:35:57 +0000212
213<div class="doc_code">
214<pre>
215% cd llvm/projects/test-suite/MultiSource/Benchmarks # or some other level
216% make TEST=dbgopt
217</pre>
218</div>
219
Bill Wendling48839d92009-05-17 05:52:39 +0000220<p>This will test impact of debugging information on optimization passes. If
221 debugging information influences optimization passes then it will be reported
222 as a failure. See <a href="TestingGuide.html">TestingGuide</a> for more
223 information on LLVM test infrastructure and how to run various tests.</p>
Devang Patela5c05aa2008-11-21 19:35:57 +0000224
Chris Lattnerbdfb3392004-01-05 05:06:33 +0000225</div>
226
NAKAMURA Takumif5af6ad2011-04-23 00:30:22 +0000227</div>
228
Chris Lattnerbdfb3392004-01-05 05:06:33 +0000229<!-- *********************************************************************** -->
NAKAMURA Takumi05d02652011-04-18 23:59:50 +0000230<h2>
Chris Lattner8ff75902004-01-06 05:31:32 +0000231 <a name="format">Debugging information format</a>
NAKAMURA Takumi05d02652011-04-18 23:59:50 +0000232</h2>
Chris Lattnerbdfb3392004-01-05 05:06:33 +0000233<!-- *********************************************************************** -->
234
NAKAMURA Takumif5af6ad2011-04-23 00:30:22 +0000235<div>
Chris Lattnerbdfb3392004-01-05 05:06:33 +0000236
237<p>LLVM debugging information has been carefully designed to make it possible
Bill Wendling48839d92009-05-17 05:52:39 +0000238 for the optimizer to optimize the program and debugging information without
239 necessarily having to know anything about debugging information. In
John Criswellb34500f2010-03-17 15:01:50 +0000240 particular, the use of metadata avoids duplicated debugging information from
Devang Patele4b27562009-08-28 23:24:31 +0000241 the beginning, and the global dead code elimination pass automatically
242 deletes debugging information for a function if it decides to delete the
243 function. </p>
Chris Lattnerbdfb3392004-01-05 05:06:33 +0000244
245<p>To do this, most of the debugging information (descriptors for types,
Bill Wendling48839d92009-05-17 05:52:39 +0000246 variables, functions, source files, etc) is inserted by the language
Devang Patele4b27562009-08-28 23:24:31 +0000247 front-end in the form of LLVM metadata. </p>
Chris Lattnerbdfb3392004-01-05 05:06:33 +0000248
Jim Laskeycec12a52006-03-14 18:08:46 +0000249<p>Debug information is designed to be agnostic about the target debugger and
Bill Wendling48839d92009-05-17 05:52:39 +0000250 debugging information representation (e.g. DWARF/Stabs/etc). It uses a
Devang Patele4b27562009-08-28 23:24:31 +0000251 generic pass to decode the information that represents variables, types,
252 functions, namespaces, etc: this allows for arbitrary source-language
253 semantics and type-systems to be used, as long as there is a module
254 written for the target debugger to interpret the information. </p>
Chris Lattnerbdfb3392004-01-05 05:06:33 +0000255
Misha Brukman82873732004-05-12 19:21:57 +0000256<p>To provide basic functionality, the LLVM debugger does have to make some
Bill Wendling48839d92009-05-17 05:52:39 +0000257 assumptions about the source-level language being debugged, though it keeps
258 these to a minimum. The only common features that the LLVM debugger assumes
Devang Patel4b945502010-03-09 00:44:10 +0000259 exist are <a href="#format_files">source files</a>,
Bill Wendling48839d92009-05-17 05:52:39 +0000260 and <a href="#format_global_variables">program objects</a>. These abstract
261 objects are used by a debugger to form stack traces, show information about
262 local variables, etc.</p>
Chris Lattnerbdfb3392004-01-05 05:06:33 +0000263
264<p>This section of the documentation first describes the representation aspects
Bill Wendling48839d92009-05-17 05:52:39 +0000265 common to any source-language. The <a href="#ccxx_frontend">next section</a>
266 describes the data layout conventions used by the C and C++ front-ends.</p>
Chris Lattnerbdfb3392004-01-05 05:06:33 +0000267
Chris Lattnerbdfb3392004-01-05 05:06:33 +0000268<!-- ======================================================================= -->
NAKAMURA Takumi05d02652011-04-18 23:59:50 +0000269<h3>
Jim Laskeycec12a52006-03-14 18:08:46 +0000270 <a name="debug_info_descriptors">Debug information descriptors</a>
NAKAMURA Takumi05d02652011-04-18 23:59:50 +0000271</h3>
Chris Lattnerbdfb3392004-01-05 05:06:33 +0000272
NAKAMURA Takumif5af6ad2011-04-23 00:30:22 +0000273<div>
Bill Wendling48839d92009-05-17 05:52:39 +0000274
Jim Laskeycec12a52006-03-14 18:08:46 +0000275<p>In consideration of the complexity and volume of debug information, LLVM
Devang Patele4b27562009-08-28 23:24:31 +0000276 provides a specification for well formed debug descriptors. </p>
Chris Lattnerbdfb3392004-01-05 05:06:33 +0000277
Jim Laskeycec12a52006-03-14 18:08:46 +0000278<p>Consumers of LLVM debug information expect the descriptors for program
Bill Wendling48839d92009-05-17 05:52:39 +0000279 objects to start in a canonical format, but the descriptors can include
280 additional information appended at the end that is source-language
281 specific. All LLVM debugging information is versioned, allowing backwards
282 compatibility in the case that the core structures need to change in some
283 way. Also, all debugging information objects start with a tag to indicate
284 what type of object it is. The source-language is allowed to define its own
285 objects, by using unreserved tag numbers. We recommend using with tags in
Benjamin Kramer8040cd32009-10-12 14:46:08 +0000286 the range 0x1000 through 0x2000 (there is a defined enum DW_TAG_user_base =
Bill Wendling48839d92009-05-17 05:52:39 +0000287 0x1000.)</p>
Jim Laskeycec12a52006-03-14 18:08:46 +0000288
Devang Patele4b27562009-08-28 23:24:31 +0000289<p>The fields of debug descriptors used internally by LLVM
Nick Lewycky655fd032010-03-31 07:50:17 +0000290 are restricted to only the simple data types <tt>i32</tt>, <tt>i1</tt>,
291 <tt>float</tt>, <tt>double</tt>, <tt>mdstring</tt> and <tt>mdnode</tt>. </p>
Chris Lattnerbdfb3392004-01-05 05:06:33 +0000292
Bill Wendling48839d92009-05-17 05:52:39 +0000293<div class="doc_code">
Misha Brukman82873732004-05-12 19:21:57 +0000294<pre>
Devang Patele4b27562009-08-28 23:24:31 +0000295!1 = metadata !{
Nick Lewycky655fd032010-03-31 07:50:17 +0000296 i32, ;; A tag
Bill Wendling48839d92009-05-17 05:52:39 +0000297 ...
298}
Misha Brukman82873732004-05-12 19:21:57 +0000299</pre>
Bill Wendling48839d92009-05-17 05:52:39 +0000300</div>
Chris Lattnerbdfb3392004-01-05 05:06:33 +0000301
Jim Laskey7089f452006-06-16 13:14:03 +0000302<p><a name="LLVMDebugVersion">The first field of a descriptor is always an
Nick Lewycky655fd032010-03-31 07:50:17 +0000303 <tt>i32</tt> containing a tag value identifying the content of the
Bill Wendling48839d92009-05-17 05:52:39 +0000304 descriptor. The remaining fields are specific to the descriptor. The values
305 of tags are loosely bound to the tag values of DWARF information entries.
306 However, that does not restrict the use of the information supplied to DWARF
307 targets. To facilitate versioning of debug information, the tag is augmented
Nick Lewycky655fd032010-03-31 07:50:17 +0000308 with the current debug version (LLVMDebugVersion = 8 &lt;&lt; 16 or 0x80000 or
Devang Patel4b945502010-03-09 00:44:10 +0000309 524288.)</a></p>
Jim Laskeycec12a52006-03-14 18:08:46 +0000310
Jim Laskey7089f452006-06-16 13:14:03 +0000311<p>The details of the various descriptors follow.</p>
Jim Laskeycec12a52006-03-14 18:08:46 +0000312
Jim Laskeycec12a52006-03-14 18:08:46 +0000313<!-- ======================================================================= -->
NAKAMURA Takumi05d02652011-04-18 23:59:50 +0000314<h4>
Jim Laskeycec12a52006-03-14 18:08:46 +0000315 <a name="format_compile_units">Compile unit descriptors</a>
NAKAMURA Takumi05d02652011-04-18 23:59:50 +0000316</h4>
Jim Laskeycec12a52006-03-14 18:08:46 +0000317
NAKAMURA Takumif5af6ad2011-04-23 00:30:22 +0000318<div>
Jim Laskeycec12a52006-03-14 18:08:46 +0000319
Bill Wendling48839d92009-05-17 05:52:39 +0000320<div class="doc_code">
Jim Laskeycec12a52006-03-14 18:08:46 +0000321<pre>
Devang Patele4b27562009-08-28 23:24:31 +0000322!0 = metadata !{
323 i32, ;; Tag = 17 + <a href="#LLVMDebugVersion">LLVMDebugVersion</a>
324 ;; (DW_TAG_compile_unit)
325 i32, ;; Unused field.
326 i32, ;; DWARF language identifier (ex. DW_LANG_C89)
327 metadata, ;; Source file name
328 metadata, ;; Source file directory (includes trailing slash)
329 metadata ;; Producer (ex. "4.0.1 LLVM (LLVM research group)")
330 i1, ;; True if this is a main compile unit.
331 i1, ;; True if this is optimized.
332 metadata, ;; Flags
333 i32 ;; Runtime version
Bill Wendling48839d92009-05-17 05:52:39 +0000334}
Jim Laskeycec12a52006-03-14 18:08:46 +0000335</pre>
Bill Wendling48839d92009-05-17 05:52:39 +0000336</div>
Jim Laskeycec12a52006-03-14 18:08:46 +0000337
Bill Wendling48839d92009-05-17 05:52:39 +0000338<p>These descriptors contain a source language ID for the file (we use the DWARF
339 3.0 ID numbers, such as <tt>DW_LANG_C89</tt>, <tt>DW_LANG_C_plus_plus</tt>,
340 <tt>DW_LANG_Cobol74</tt>, etc), three strings describing the filename,
341 working directory of the compiler, and an identifier string for the compiler
342 that produced it.</p>
Jim Laskeycec12a52006-03-14 18:08:46 +0000343
Bill Wendling48839d92009-05-17 05:52:39 +0000344<p>Compile unit descriptors provide the root context for objects declared in a
Devang Patel4b945502010-03-09 00:44:10 +0000345 specific compilation unit. File descriptors are defined using this context.</p>
Jim Laskeycec12a52006-03-14 18:08:46 +0000346
Devang Patel4b945502010-03-09 00:44:10 +0000347</div>
348
349<!-- ======================================================================= -->
NAKAMURA Takumi05d02652011-04-18 23:59:50 +0000350<h4>
Devang Patel4b945502010-03-09 00:44:10 +0000351 <a name="format_files">File descriptors</a>
NAKAMURA Takumi05d02652011-04-18 23:59:50 +0000352</h4>
Devang Patel4b945502010-03-09 00:44:10 +0000353
NAKAMURA Takumif5af6ad2011-04-23 00:30:22 +0000354<div>
Devang Patel4b945502010-03-09 00:44:10 +0000355
356<div class="doc_code">
357<pre>
358!0 = metadata !{
359 i32, ;; Tag = 41 + <a href="#LLVMDebugVersion">LLVMDebugVersion</a>
360 ;; (DW_TAG_file_type)
361 metadata, ;; Source file name
362 metadata, ;; Source file directory (includes trailing slash)
363 metadata ;; Reference to compile unit where defined
364}
365</pre>
366</div>
367
John Criswellb34500f2010-03-17 15:01:50 +0000368<p>These descriptors contain information for a file. Global variables and top
Devang Patel4b945502010-03-09 00:44:10 +0000369 level functions would be defined using this context.k File descriptors also
370 provide context for source line correspondence. </p>
371
372<p>Each input file is encoded as a separate file descriptor in LLVM debugging
373 information output. Each file descriptor would be defined using a
374 compile unit. </p>
Bill Wendling48839d92009-05-17 05:52:39 +0000375
Jim Laskeycec12a52006-03-14 18:08:46 +0000376</div>
377
378<!-- ======================================================================= -->
NAKAMURA Takumi05d02652011-04-18 23:59:50 +0000379<h4>
Jim Laskeycec12a52006-03-14 18:08:46 +0000380 <a name="format_global_variables">Global variable descriptors</a>
NAKAMURA Takumi05d02652011-04-18 23:59:50 +0000381</h4>
Jim Laskeycec12a52006-03-14 18:08:46 +0000382
NAKAMURA Takumif5af6ad2011-04-23 00:30:22 +0000383<div>
Jim Laskeycec12a52006-03-14 18:08:46 +0000384
Bill Wendling48839d92009-05-17 05:52:39 +0000385<div class="doc_code">
Jim Laskeycec12a52006-03-14 18:08:46 +0000386<pre>
Devang Patele4b27562009-08-28 23:24:31 +0000387!1 = metadata !{
388 i32, ;; Tag = 52 + <a href="#LLVMDebugVersion">LLVMDebugVersion</a>
389 ;; (DW_TAG_variable)
390 i32, ;; Unused field.
391 metadata, ;; Reference to context descriptor
392 metadata, ;; Name
393 metadata, ;; Display name (fully qualified C++ name)
394 metadata, ;; MIPS linkage name (for C++)
Devang Patel4b945502010-03-09 00:44:10 +0000395 metadata, ;; Reference to file where defined
Devang Patele4b27562009-08-28 23:24:31 +0000396 i32, ;; Line number where defined
397 metadata, ;; Reference to type descriptor
398 i1, ;; True if the global is local to compile unit (static)
399 i1, ;; True if the global is defined in the compile unit (not extern)
Dan Gohmanfe47aae2010-05-28 17:13:49 +0000400 {}* ;; Reference to the global variable
Bill Wendling48839d92009-05-17 05:52:39 +0000401}
Jim Laskeycec12a52006-03-14 18:08:46 +0000402</pre>
Bill Wendling48839d92009-05-17 05:52:39 +0000403</div>
Jim Laskeycec12a52006-03-14 18:08:46 +0000404
405<p>These descriptors provide debug information about globals variables. The
Devang Patelda6eed32011-03-29 17:27:08 +0000406provide details such as name, type and where the variable is defined. All
407global variables are collected by named metadata <tt>!llvm.dbg.gv</tt>.</p>
Jim Laskeycec12a52006-03-14 18:08:46 +0000408
409</div>
410
411<!-- ======================================================================= -->
NAKAMURA Takumi05d02652011-04-18 23:59:50 +0000412<h4>
Jim Laskeycec12a52006-03-14 18:08:46 +0000413 <a name="format_subprograms">Subprogram descriptors</a>
NAKAMURA Takumi05d02652011-04-18 23:59:50 +0000414</h4>
Jim Laskeycec12a52006-03-14 18:08:46 +0000415
NAKAMURA Takumif5af6ad2011-04-23 00:30:22 +0000416<div>
Jim Laskeycec12a52006-03-14 18:08:46 +0000417
Bill Wendling48839d92009-05-17 05:52:39 +0000418<div class="doc_code">
Jim Laskeycec12a52006-03-14 18:08:46 +0000419<pre>
Devang Patele4b27562009-08-28 23:24:31 +0000420!2 = metadata !{
421 i32, ;; Tag = 46 + <a href="#LLVMDebugVersion">LLVMDebugVersion</a>
422 ;; (DW_TAG_subprogram)
423 i32, ;; Unused field.
424 metadata, ;; Reference to context descriptor
425 metadata, ;; Name
426 metadata, ;; Display name (fully qualified C++ name)
427 metadata, ;; MIPS linkage name (for C++)
Devang Patel4b945502010-03-09 00:44:10 +0000428 metadata, ;; Reference to file where defined
Devang Patele4b27562009-08-28 23:24:31 +0000429 i32, ;; Line number where defined
430 metadata, ;; Reference to type descriptor
431 i1, ;; True if the global is local to compile unit (static)
Devang Patel5e06bb82011-04-22 23:10:17 +0000432 i1, ;; True if the global is defined in the compile unit (not extern)
433 i32, ;; Virtuality, e.g. dwarf::DW_VIRTUALITY__virtual
434 i32, ;; Index into a virtual function
Devang Patel80ecc152010-06-04 22:49:55 +0000435 metadata, ;; indicates which base type contains the vtable pointer for the
436 ;; derived class
Devang Patel5e06bb82011-04-22 23:10:17 +0000437 i1, ;; isArtificial
438 i1, ;; isOptimized
439 Function *,;; Pointer to LLVM function
440 metadata, ;; Lists function template parameters
441 metadata ;; Function declaration descriptor
Bill Wendling48839d92009-05-17 05:52:39 +0000442}
Jim Laskeycec12a52006-03-14 18:08:46 +0000443</pre>
Bill Wendling48839d92009-05-17 05:52:39 +0000444</div>
Jim Laskeycec12a52006-03-14 18:08:46 +0000445
446<p>These descriptors provide debug information about functions, methods and
Bill Wendling48839d92009-05-17 05:52:39 +0000447 subprograms. They provide details such as name, return types and the source
Devang Patelda6eed32011-03-29 17:27:08 +0000448 location where the subprogram is defined.
449 All subprogram descriptors are collected by a named metadata
450 <tt>!llvm.dbg.sp</tt>.
451</p>
Jim Laskey3d11bee2006-03-15 19:10:52 +0000452
453</div>
Bill Wendling48839d92009-05-17 05:52:39 +0000454
Jim Laskey3d11bee2006-03-15 19:10:52 +0000455<!-- ======================================================================= -->
NAKAMURA Takumi05d02652011-04-18 23:59:50 +0000456<h4>
Jim Laskey3d11bee2006-03-15 19:10:52 +0000457 <a name="format_blocks">Block descriptors</a>
NAKAMURA Takumi05d02652011-04-18 23:59:50 +0000458</h4>
Jim Laskey3d11bee2006-03-15 19:10:52 +0000459
NAKAMURA Takumif5af6ad2011-04-23 00:30:22 +0000460<div>
Jim Laskey3d11bee2006-03-15 19:10:52 +0000461
Bill Wendling48839d92009-05-17 05:52:39 +0000462<div class="doc_code">
Jim Laskey3d11bee2006-03-15 19:10:52 +0000463<pre>
Devang Patele4b27562009-08-28 23:24:31 +0000464!3 = metadata !{
Devang Patelc79dda22010-10-04 16:51:59 +0000465 i32, ;; Tag = 11 + <a href="#LLVMDebugVersion">LLVMDebugVersion</a> (DW_TAG_lexical_block)
Devang Patel7f271fc2010-10-01 22:45:00 +0000466 metadata,;; Reference to context descriptor
467 i32, ;; Line number
Devang Patel90d81f12011-03-08 16:25:29 +0000468 i32, ;; Column number
469 metadata,;; Reference to source file
470 i32 ;; Unique ID to identify blocks from a template function
Bill Wendling48839d92009-05-17 05:52:39 +0000471}
Jim Laskey3d11bee2006-03-15 19:10:52 +0000472</pre>
Bill Wendling48839d92009-05-17 05:52:39 +0000473</div>
Jim Laskey3d11bee2006-03-15 19:10:52 +0000474
475<p>These descriptors provide debug information about nested blocks within a
Devang Patel7f271fc2010-10-01 22:45:00 +0000476 subprogram. The line number and column numbers are used to dinstinguish
477 two lexical blocks at same depth. </p>
Jim Laskey3d11bee2006-03-15 19:10:52 +0000478
Jim Laskeycec12a52006-03-14 18:08:46 +0000479</div>
480
481<!-- ======================================================================= -->
NAKAMURA Takumi05d02652011-04-18 23:59:50 +0000482<h4>
Jim Laskeycec12a52006-03-14 18:08:46 +0000483 <a name="format_basic_type">Basic type descriptors</a>
NAKAMURA Takumi05d02652011-04-18 23:59:50 +0000484</h4>
Jim Laskeycec12a52006-03-14 18:08:46 +0000485
NAKAMURA Takumif5af6ad2011-04-23 00:30:22 +0000486<div>
Jim Laskeycec12a52006-03-14 18:08:46 +0000487
Bill Wendling48839d92009-05-17 05:52:39 +0000488<div class="doc_code">
Jim Laskeycec12a52006-03-14 18:08:46 +0000489<pre>
Devang Patele4b27562009-08-28 23:24:31 +0000490!4 = metadata !{
491 i32, ;; Tag = 36 + <a href="#LLVMDebugVersion">LLVMDebugVersion</a>
492 ;; (DW_TAG_base_type)
493 metadata, ;; Reference to context (typically a compile unit)
494 metadata, ;; Name (may be "" for anonymous types)
Devang Patel4b945502010-03-09 00:44:10 +0000495 metadata, ;; Reference to file where defined (may be NULL)
Devang Patele4b27562009-08-28 23:24:31 +0000496 i32, ;; Line number where defined (may be 0)
497 i64, ;; Size in bits
498 i64, ;; Alignment in bits
499 i64, ;; Offset in bits
500 i32, ;; Flags
501 i32 ;; DWARF type encoding
Bill Wendling48839d92009-05-17 05:52:39 +0000502}
Jim Laskeycec12a52006-03-14 18:08:46 +0000503</pre>
Bill Wendling48839d92009-05-17 05:52:39 +0000504</div>
Jim Laskeycec12a52006-03-14 18:08:46 +0000505
506<p>These descriptors define primitive types used in the code. Example int, bool
Bill Wendling48839d92009-05-17 05:52:39 +0000507 and float. The context provides the scope of the type, which is usually the
508 top level. Since basic types are not usually user defined the compile unit
509 and line number can be left as NULL and 0. The size, alignment and offset
510 are expressed in bits and can be 64 bit values. The alignment is used to
511 round the offset when embedded in a
512 <a href="#format_composite_type">composite type</a> (example to keep float
513 doubles on 64 bit boundaries.) The offset is the bit offset if embedded in
514 a <a href="#format_composite_type">composite type</a>.</p>
Jim Laskeycec12a52006-03-14 18:08:46 +0000515
516<p>The type encoding provides the details of the type. The values are typically
Bill Wendling48839d92009-05-17 05:52:39 +0000517 one of the following:</p>
Jim Laskeycec12a52006-03-14 18:08:46 +0000518
Bill Wendling48839d92009-05-17 05:52:39 +0000519<div class="doc_code">
Jim Laskeycec12a52006-03-14 18:08:46 +0000520<pre>
Bill Wendling48839d92009-05-17 05:52:39 +0000521DW_ATE_address = 1
522DW_ATE_boolean = 2
523DW_ATE_float = 4
524DW_ATE_signed = 5
525DW_ATE_signed_char = 6
526DW_ATE_unsigned = 7
527DW_ATE_unsigned_char = 8
Jim Laskeycec12a52006-03-14 18:08:46 +0000528</pre>
Bill Wendling48839d92009-05-17 05:52:39 +0000529</div>
Jim Laskeycec12a52006-03-14 18:08:46 +0000530
531</div>
532
533<!-- ======================================================================= -->
NAKAMURA Takumi05d02652011-04-18 23:59:50 +0000534<h4>
Jim Laskeycec12a52006-03-14 18:08:46 +0000535 <a name="format_derived_type">Derived type descriptors</a>
NAKAMURA Takumi05d02652011-04-18 23:59:50 +0000536</h4>
Jim Laskeycec12a52006-03-14 18:08:46 +0000537
NAKAMURA Takumif5af6ad2011-04-23 00:30:22 +0000538<div>
Jim Laskeycec12a52006-03-14 18:08:46 +0000539
Bill Wendling48839d92009-05-17 05:52:39 +0000540<div class="doc_code">
Jim Laskeycec12a52006-03-14 18:08:46 +0000541<pre>
Devang Patele4b27562009-08-28 23:24:31 +0000542!5 = metadata !{
543 i32, ;; Tag (see below)
544 metadata, ;; Reference to context
545 metadata, ;; Name (may be "" for anonymous types)
Devang Patel4b945502010-03-09 00:44:10 +0000546 metadata, ;; Reference to file where defined (may be NULL)
Devang Patele4b27562009-08-28 23:24:31 +0000547 i32, ;; Line number where defined (may be 0)
Devang Patel0ffd10b2010-10-01 19:19:30 +0000548 i64, ;; Size in bits
549 i64, ;; Alignment in bits
550 i64, ;; Offset in bits
Devang Patele9db5e22011-04-16 00:11:51 +0000551 metadata, ;; Reference to type derived from
552 metadata, ;; (optional) Name of the Objective C property assoicated with
553 ;; Objective-C an ivar
554 metadata, ;; (optional) Name of the Objective C property getter selector.
555 metadata, ;; (optional) Name of the Objective C property setter selector.
556 i32 ;; (optional) Objective C property attributes.
Bill Wendling48839d92009-05-17 05:52:39 +0000557}
Jim Laskeycec12a52006-03-14 18:08:46 +0000558</pre>
Bill Wendling48839d92009-05-17 05:52:39 +0000559</div>
Jim Laskeycec12a52006-03-14 18:08:46 +0000560
561<p>These descriptors are used to define types derived from other types. The
562value of the tag varies depending on the meaning. The following are possible
Misha Brukman96e00812008-12-16 02:54:22 +0000563tag values:</p>
Jim Laskeycec12a52006-03-14 18:08:46 +0000564
Bill Wendling48839d92009-05-17 05:52:39 +0000565<div class="doc_code">
Jim Laskeycec12a52006-03-14 18:08:46 +0000566<pre>
Bill Wendling48839d92009-05-17 05:52:39 +0000567DW_TAG_formal_parameter = 5
568DW_TAG_member = 13
569DW_TAG_pointer_type = 15
570DW_TAG_reference_type = 16
571DW_TAG_typedef = 22
572DW_TAG_const_type = 38
573DW_TAG_volatile_type = 53
574DW_TAG_restrict_type = 55
Jim Laskeycec12a52006-03-14 18:08:46 +0000575</pre>
Bill Wendling48839d92009-05-17 05:52:39 +0000576</div>
Jim Laskeycec12a52006-03-14 18:08:46 +0000577
Bill Wendling48839d92009-05-17 05:52:39 +0000578<p><tt>DW_TAG_member</tt> is used to define a member of
579 a <a href="#format_composite_type">composite type</a>
580 or <a href="#format_subprograms">subprogram</a>. The type of the member is
581 the <a href="#format_derived_type">derived
582 type</a>. <tt>DW_TAG_formal_parameter</tt> is used to define a member which
583 is a formal argument of a subprogram.</p>
Jim Laskeycec12a52006-03-14 18:08:46 +0000584
Bill Wendling48839d92009-05-17 05:52:39 +0000585<p><tt>DW_TAG_typedef</tt> is used to provide a name for the derived type.</p>
Jim Laskeycec12a52006-03-14 18:08:46 +0000586
Bill Wendling48839d92009-05-17 05:52:39 +0000587<p><tt>DW_TAG_pointer_type</tt>,<tt>DW_TAG_reference_type</tt>,
588 <tt>DW_TAG_const_type</tt>, <tt>DW_TAG_volatile_type</tt>
589 and <tt>DW_TAG_restrict_type</tt> are used to qualify
590 the <a href="#format_derived_type">derived type</a>. </p>
Jim Laskeycec12a52006-03-14 18:08:46 +0000591
592<p><a href="#format_derived_type">Derived type</a> location can be determined
Bill Wendling48839d92009-05-17 05:52:39 +0000593 from the compile unit and line number. The size, alignment and offset are
594 expressed in bits and can be 64 bit values. The alignment is used to round
595 the offset when embedded in a <a href="#format_composite_type">composite
596 type</a> (example to keep float doubles on 64 bit boundaries.) The offset is
597 the bit offset if embedded in a <a href="#format_composite_type">composite
598 type</a>.</p>
Jim Laskeycec12a52006-03-14 18:08:46 +0000599
Devang Patel37280782011-02-03 00:22:17 +0000600<p>Note that the <tt>void *</tt> type is expressed as a type derived from NULL.
601</p>
Jim Laskeycec12a52006-03-14 18:08:46 +0000602
603</div>
604
605<!-- ======================================================================= -->
NAKAMURA Takumi05d02652011-04-18 23:59:50 +0000606<h4>
Jim Laskeycec12a52006-03-14 18:08:46 +0000607 <a name="format_composite_type">Composite type descriptors</a>
NAKAMURA Takumi05d02652011-04-18 23:59:50 +0000608</h4>
Jim Laskeycec12a52006-03-14 18:08:46 +0000609
NAKAMURA Takumif5af6ad2011-04-23 00:30:22 +0000610<div>
Jim Laskeycec12a52006-03-14 18:08:46 +0000611
Bill Wendling48839d92009-05-17 05:52:39 +0000612<div class="doc_code">
Jim Laskeycec12a52006-03-14 18:08:46 +0000613<pre>
Devang Patele4b27562009-08-28 23:24:31 +0000614!6 = metadata !{
615 i32, ;; Tag (see below)
616 metadata, ;; Reference to context
617 metadata, ;; Name (may be "" for anonymous types)
Devang Patel4b945502010-03-09 00:44:10 +0000618 metadata, ;; Reference to file where defined (may be NULL)
Devang Patele4b27562009-08-28 23:24:31 +0000619 i32, ;; Line number where defined (may be 0)
620 i64, ;; Size in bits
621 i64, ;; Alignment in bits
622 i64, ;; Offset in bits
623 i32, ;; Flags
624 metadata, ;; Reference to type derived from
625 metadata, ;; Reference to array of member descriptors
626 i32 ;; Runtime languages
Bill Wendling48839d92009-05-17 05:52:39 +0000627}
Jim Laskeycec12a52006-03-14 18:08:46 +0000628</pre>
Bill Wendling48839d92009-05-17 05:52:39 +0000629</div>
Jim Laskeycec12a52006-03-14 18:08:46 +0000630
631<p>These descriptors are used to define types that are composed of 0 or more
632elements. The value of the tag varies depending on the meaning. The following
Misha Brukman96e00812008-12-16 02:54:22 +0000633are possible tag values:</p>
Jim Laskeycec12a52006-03-14 18:08:46 +0000634
Bill Wendling48839d92009-05-17 05:52:39 +0000635<div class="doc_code">
Jim Laskeycec12a52006-03-14 18:08:46 +0000636<pre>
Bill Wendling48839d92009-05-17 05:52:39 +0000637DW_TAG_array_type = 1
638DW_TAG_enumeration_type = 4
639DW_TAG_structure_type = 19
640DW_TAG_union_type = 23
641DW_TAG_vector_type = 259
Bruno Cardoso Lopesd80ddc02009-05-29 17:08:57 +0000642DW_TAG_subroutine_type = 21
643DW_TAG_inheritance = 28
Jim Laskeycec12a52006-03-14 18:08:46 +0000644</pre>
Bill Wendling48839d92009-05-17 05:52:39 +0000645</div>
Jim Laskeycec12a52006-03-14 18:08:46 +0000646
Jim Laskeyf8a01a92006-06-15 20:51:43 +0000647<p>The vector flag indicates that an array type is a native packed vector.</p>
648
Jim Laskey7089f452006-06-16 13:14:03 +0000649<p>The members of array types (tag = <tt>DW_TAG_array_type</tt>) or vector types
Bill Wendling48839d92009-05-17 05:52:39 +0000650 (tag = <tt>DW_TAG_vector_type</tt>) are <a href="#format_subrange">subrange
651 descriptors</a>, each representing the range of subscripts at that level of
652 indexing.</p>
Jim Laskeycec12a52006-03-14 18:08:46 +0000653
654<p>The members of enumeration types (tag = <tt>DW_TAG_enumeration_type</tt>) are
Bill Wendling48839d92009-05-17 05:52:39 +0000655 <a href="#format_enumeration">enumerator descriptors</a>, each representing
Devang Patelda6eed32011-03-29 17:27:08 +0000656 the definition of enumeration value for the set. All enumeration type
657 descriptors are collected by named metadata <tt>!llvm.dbg.enum</tt>.</p>
Jim Laskeycec12a52006-03-14 18:08:46 +0000658
659<p>The members of structure (tag = <tt>DW_TAG_structure_type</tt>) or union (tag
Bill Wendling48839d92009-05-17 05:52:39 +0000660 = <tt>DW_TAG_union_type</tt>) types are any one of
661 the <a href="#format_basic_type">basic</a>,
662 <a href="#format_derived_type">derived</a>
663 or <a href="#format_composite_type">composite</a> type descriptors, each
664 representing a field member of the structure or union.</p>
Jim Laskeycec12a52006-03-14 18:08:46 +0000665
Jim Laskey4a9df242006-08-21 21:21:06 +0000666<p>For C++ classes (tag = <tt>DW_TAG_structure_type</tt>), member descriptors
Bill Wendling48839d92009-05-17 05:52:39 +0000667 provide information about base classes, static members and member
668 functions. If a member is a <a href="#format_derived_type">derived type
669 descriptor</a> and has a tag of <tt>DW_TAG_inheritance</tt>, then the type
670 represents a base class. If the member of is
671 a <a href="#format_global_variables">global variable descriptor</a> then it
672 represents a static member. And, if the member is
673 a <a href="#format_subprograms">subprogram descriptor</a> then it represents
674 a member function. For static members and member
675 functions, <tt>getName()</tt> returns the members link or the C++ mangled
676 name. <tt>getDisplayName()</tt> the simplied version of the name.</p>
Jim Laskey4a9df242006-08-21 21:21:06 +0000677
Bill Wendling48839d92009-05-17 05:52:39 +0000678<p>The first member of subroutine (tag = <tt>DW_TAG_subroutine_type</tt>) type
679 elements is the return type for the subroutine. The remaining elements are
680 the formal arguments to the subroutine.</p>
Jim Laskey094ee722006-06-20 21:13:20 +0000681
Jim Laskeycec12a52006-03-14 18:08:46 +0000682<p><a href="#format_composite_type">Composite type</a> location can be
Bill Wendling48839d92009-05-17 05:52:39 +0000683 determined from the compile unit and line number. The size, alignment and
684 offset are expressed in bits and can be 64 bit values. The alignment is used
685 to round the offset when embedded in
686 a <a href="#format_composite_type">composite type</a> (as an example, to keep
687 float doubles on 64 bit boundaries.) The offset is the bit offset if embedded
688 in a <a href="#format_composite_type">composite type</a>.</p>
Jim Laskeycec12a52006-03-14 18:08:46 +0000689
690</div>
691
692<!-- ======================================================================= -->
NAKAMURA Takumi05d02652011-04-18 23:59:50 +0000693<h4>
Jim Laskeycec12a52006-03-14 18:08:46 +0000694 <a name="format_subrange">Subrange descriptors</a>
NAKAMURA Takumi05d02652011-04-18 23:59:50 +0000695</h4>
Jim Laskeycec12a52006-03-14 18:08:46 +0000696
NAKAMURA Takumif5af6ad2011-04-23 00:30:22 +0000697<div>
Jim Laskeycec12a52006-03-14 18:08:46 +0000698
Bill Wendling48839d92009-05-17 05:52:39 +0000699<div class="doc_code">
Jim Laskeycec12a52006-03-14 18:08:46 +0000700<pre>
Devang Patel37280782011-02-03 00:22:17 +0000701!42 = metadata !{
Bill Wendling48839d92009-05-17 05:52:39 +0000702 i32, ;; Tag = 33 + <a href="#LLVMDebugVersion">LLVMDebugVersion</a> (DW_TAG_subrange_type)
703 i64, ;; Low value
704 i64 ;; High value
705}
Jim Laskeycec12a52006-03-14 18:08:46 +0000706</pre>
Bill Wendling48839d92009-05-17 05:52:39 +0000707</div>
Jim Laskeycec12a52006-03-14 18:08:46 +0000708
709<p>These descriptors are used to define ranges of array subscripts for an array
Bill Wendling48839d92009-05-17 05:52:39 +0000710 <a href="#format_composite_type">composite type</a>. The low value defines
711 the lower bounds typically zero for C/C++. The high value is the upper
712 bounds. Values are 64 bit. High - low + 1 is the size of the array. If low
Devang Patel3f932a72011-04-08 23:39:38 +0000713 > high the array bounds are not included in generated debugging information.
714</p>
Jim Laskeycec12a52006-03-14 18:08:46 +0000715
716</div>
717
718<!-- ======================================================================= -->
NAKAMURA Takumi05d02652011-04-18 23:59:50 +0000719<h4>
Jim Laskeycec12a52006-03-14 18:08:46 +0000720 <a name="format_enumeration">Enumerator descriptors</a>
NAKAMURA Takumi05d02652011-04-18 23:59:50 +0000721</h4>
Jim Laskeycec12a52006-03-14 18:08:46 +0000722
NAKAMURA Takumif5af6ad2011-04-23 00:30:22 +0000723<div>
Jim Laskeycec12a52006-03-14 18:08:46 +0000724
Bill Wendling48839d92009-05-17 05:52:39 +0000725<div class="doc_code">
Jim Laskeycec12a52006-03-14 18:08:46 +0000726<pre>
Devang Patele4b27562009-08-28 23:24:31 +0000727!6 = metadata !{
728 i32, ;; Tag = 40 + <a href="#LLVMDebugVersion">LLVMDebugVersion</a>
729 ;; (DW_TAG_enumerator)
730 metadata, ;; Name
731 i64 ;; Value
Bill Wendling48839d92009-05-17 05:52:39 +0000732}
Jim Laskeycec12a52006-03-14 18:08:46 +0000733</pre>
Bill Wendling48839d92009-05-17 05:52:39 +0000734</div>
Jim Laskeycec12a52006-03-14 18:08:46 +0000735
Bill Wendling48839d92009-05-17 05:52:39 +0000736<p>These descriptors are used to define members of an
737 enumeration <a href="#format_composite_type">composite type</a>, it
738 associates the name to the value.</p>
Jim Laskeycec12a52006-03-14 18:08:46 +0000739
740</div>
741
742<!-- ======================================================================= -->
NAKAMURA Takumi05d02652011-04-18 23:59:50 +0000743<h4>
Jim Laskey383e0092006-03-23 17:54:33 +0000744 <a name="format_variables">Local variables</a>
NAKAMURA Takumi05d02652011-04-18 23:59:50 +0000745</h4>
Jim Laskey383e0092006-03-23 17:54:33 +0000746
NAKAMURA Takumif5af6ad2011-04-23 00:30:22 +0000747<div>
Bill Wendling48839d92009-05-17 05:52:39 +0000748
749<div class="doc_code">
Jim Laskey383e0092006-03-23 17:54:33 +0000750<pre>
Devang Patele4b27562009-08-28 23:24:31 +0000751!7 = metadata !{
752 i32, ;; Tag (see below)
753 metadata, ;; Context
754 metadata, ;; Name
Devang Patel4b945502010-03-09 00:44:10 +0000755 metadata, ;; Reference to file where defined
Devang Patela83688f2011-03-08 16:29:40 +0000756 i32, ;; 24 bit - Line number where defined
757 ;; 8 bit - Argument number. 1 indicates 1st argument.
Devang Patele4b27562009-08-28 23:24:31 +0000758 metadata ;; Type descriptor
Bill Wendling48839d92009-05-17 05:52:39 +0000759}
Jim Laskey383e0092006-03-23 17:54:33 +0000760</pre>
Bill Wendling48839d92009-05-17 05:52:39 +0000761</div>
Jim Laskey383e0092006-03-23 17:54:33 +0000762
763<p>These descriptors are used to define variables local to a sub program. The
Bill Wendling48839d92009-05-17 05:52:39 +0000764 value of the tag depends on the usage of the variable:</p>
Jim Laskey383e0092006-03-23 17:54:33 +0000765
Bill Wendling48839d92009-05-17 05:52:39 +0000766<div class="doc_code">
Jim Laskey383e0092006-03-23 17:54:33 +0000767<pre>
Bill Wendling48839d92009-05-17 05:52:39 +0000768DW_TAG_auto_variable = 256
769DW_TAG_arg_variable = 257
770DW_TAG_return_variable = 258
Jim Laskey383e0092006-03-23 17:54:33 +0000771</pre>
Bill Wendling48839d92009-05-17 05:52:39 +0000772</div>
Jim Laskey383e0092006-03-23 17:54:33 +0000773
774<p>An auto variable is any variable declared in the body of the function. An
Bill Wendling48839d92009-05-17 05:52:39 +0000775 argument variable is any variable that appears as a formal argument to the
776 function. A return variable is used to track the result of a function and
777 has no source correspondent.</p>
Jim Laskey383e0092006-03-23 17:54:33 +0000778
Jim Laskey2d395d92006-03-24 09:20:27 +0000779<p>The context is either the subprogram or block where the variable is defined.
Bill Wendling48839d92009-05-17 05:52:39 +0000780 Name the source variable name. Compile unit and line indicate where the
781 variable was defined. Type descriptor defines the declared type of the
782 variable.</p>
Jim Laskey383e0092006-03-23 17:54:33 +0000783
784</div>
785
NAKAMURA Takumif5af6ad2011-04-23 00:30:22 +0000786</div>
787
Jim Laskey383e0092006-03-23 17:54:33 +0000788<!-- ======================================================================= -->
NAKAMURA Takumi05d02652011-04-18 23:59:50 +0000789<h3>
Jim Laskeycec12a52006-03-14 18:08:46 +0000790 <a name="format_common_intrinsics">Debugger intrinsic functions</a>
NAKAMURA Takumi05d02652011-04-18 23:59:50 +0000791</h3>
Jim Laskeycec12a52006-03-14 18:08:46 +0000792
NAKAMURA Takumif5af6ad2011-04-23 00:30:22 +0000793<div>
Jim Laskeycec12a52006-03-14 18:08:46 +0000794
795<p>LLVM uses several intrinsic functions (name prefixed with "llvm.dbg") to
Bill Wendling48839d92009-05-17 05:52:39 +0000796 provide debug information at various points in generated code.</p>
Jim Laskeycec12a52006-03-14 18:08:46 +0000797
Jim Laskeycec12a52006-03-14 18:08:46 +0000798<!-- ======================================================================= -->
NAKAMURA Takumi05d02652011-04-18 23:59:50 +0000799<h4>
Jim Laskeycec12a52006-03-14 18:08:46 +0000800 <a name="format_common_declare">llvm.dbg.declare</a>
NAKAMURA Takumi05d02652011-04-18 23:59:50 +0000801</h4>
Jim Laskeycec12a52006-03-14 18:08:46 +0000802
NAKAMURA Takumif5af6ad2011-04-23 00:30:22 +0000803<div>
Jim Laskeycec12a52006-03-14 18:08:46 +0000804<pre>
Devang Patel4c7c0c62010-10-01 19:22:16 +0000805 void %<a href="#format_common_declare">llvm.dbg.declare</a>(metadata, metadata)
Jim Laskeycec12a52006-03-14 18:08:46 +0000806</pre>
807
Jim Laskey2d395d92006-03-24 09:20:27 +0000808<p>This intrinsic provides information about a local element (ex. variable.) The
NAKAMURA Takumi4d6deb02011-04-09 09:51:57 +0000809 first argument is metadata holding alloca for the variable. The
Devang Patele136e502011-02-01 17:22:12 +0000810 second argument is metadata containing description of the variable. </p>
Jim Laskeycec12a52006-03-14 18:08:46 +0000811</div>
812
813<!-- ======================================================================= -->
NAKAMURA Takumi05d02652011-04-18 23:59:50 +0000814<h4>
Victor Hernandez67a1a542010-01-11 22:53:48 +0000815 <a name="format_common_value">llvm.dbg.value</a>
NAKAMURA Takumi05d02652011-04-18 23:59:50 +0000816</h4>
Victor Hernandez67a1a542010-01-11 22:53:48 +0000817
NAKAMURA Takumif5af6ad2011-04-23 00:30:22 +0000818<div>
Victor Hernandez67a1a542010-01-11 22:53:48 +0000819<pre>
Dan Gohman3dfb3cf2010-05-28 17:07:41 +0000820 void %<a href="#format_common_value">llvm.dbg.value</a>(metadata, i64, metadata)
Victor Hernandez67a1a542010-01-11 22:53:48 +0000821</pre>
822
823<p>This intrinsic provides information when a user source variable is set to a
824 new value. The first argument is the new value (wrapped as metadata). The
825 second argument is the offset in the user source variable where the new value
Devang Patele136e502011-02-01 17:22:12 +0000826 is written. The third argument is metadata containing description of the
827 user source variable. </p>
Victor Hernandez67a1a542010-01-11 22:53:48 +0000828</div>
829
NAKAMURA Takumif5af6ad2011-04-23 00:30:22 +0000830</div>
831
Victor Hernandez67a1a542010-01-11 22:53:48 +0000832<!-- ======================================================================= -->
NAKAMURA Takumi05d02652011-04-18 23:59:50 +0000833<h3>
Chris Lattner8ff75902004-01-06 05:31:32 +0000834 <a name="format_common_lifetime">Object lifetimes and scoping</a>
NAKAMURA Takumi05d02652011-04-18 23:59:50 +0000835</h3>
Chris Lattnerbdfb3392004-01-05 05:06:33 +0000836
NAKAMURA Takumif5af6ad2011-04-23 00:30:22 +0000837<div>
Bill Wendlingcf493b82009-12-01 00:53:11 +0000838<p>In many languages, the local variables in functions can have their lifetimes
839 or scopes limited to a subset of a function. In the C family of languages,
Bill Wendling48839d92009-05-17 05:52:39 +0000840 for example, variables are only live (readable and writable) within the
841 source block that they are defined in. In functional languages, values are
842 only readable after they have been defined. Though this is a very obvious
Bill Wendlingcf493b82009-12-01 00:53:11 +0000843 concept, it is non-trivial to model in LLVM, because it has no notion of
Bill Wendling48839d92009-05-17 05:52:39 +0000844 scoping in this sense, and does not want to be tied to a language's scoping
845 rules.</p>
Chris Lattnerbdfb3392004-01-05 05:06:33 +0000846
Bill Wendlingcf493b82009-12-01 00:53:11 +0000847<p>In order to handle this, the LLVM debug format uses the metadata attached to
Nick Lewycky655fd032010-03-31 07:50:17 +0000848 llvm instructions to encode line number and scoping information. Consider
849 the following C fragment, for example:</p>
Chris Lattnerbdfb3392004-01-05 05:06:33 +0000850
Bill Wendling48839d92009-05-17 05:52:39 +0000851<div class="doc_code">
Misha Brukman82873732004-05-12 19:21:57 +0000852<pre>
Chris Lattnerbdfb3392004-01-05 05:06:33 +00008531. void foo() {
Devang Patel744950d2009-11-25 23:28:01 +00008542. int X = 21;
8553. int Y = 22;
Chris Lattnerbdfb3392004-01-05 05:06:33 +00008564. {
Devang Patel744950d2009-11-25 23:28:01 +00008575. int Z = 23;
8586. Z = X;
Chris Lattnerbdfb3392004-01-05 05:06:33 +00008597. }
Devang Patel744950d2009-11-25 23:28:01 +00008608. X = Y;
Chris Lattnerbdfb3392004-01-05 05:06:33 +00008619. }
Misha Brukman82873732004-05-12 19:21:57 +0000862</pre>
Bill Wendling48839d92009-05-17 05:52:39 +0000863</div>
Chris Lattnerbdfb3392004-01-05 05:06:33 +0000864
Jim Laskeycec12a52006-03-14 18:08:46 +0000865<p>Compiled to LLVM, this function would be represented like this:</p>
Chris Lattnerbdfb3392004-01-05 05:06:33 +0000866
Bill Wendling48839d92009-05-17 05:52:39 +0000867<div class="doc_code">
Misha Brukman82873732004-05-12 19:21:57 +0000868<pre>
Bill Wendlingcf493b82009-12-01 00:53:11 +0000869define void @foo() nounwind ssp {
Jim Laskeycec12a52006-03-14 18:08:46 +0000870entry:
Bill Wendling02216ff2009-12-01 00:59:58 +0000871 %X = alloca i32, align 4 ; &lt;i32*&gt; [#uses=4]
872 %Y = alloca i32, align 4 ; &lt;i32*&gt; [#uses=4]
873 %Z = alloca i32, align 4 ; &lt;i32*&gt; [#uses=3]
Dan Gohmanfe47aae2010-05-28 17:13:49 +0000874 %0 = bitcast i32* %X to {}* ; &lt;{}*&gt; [#uses=1]
Devang Patel37280782011-02-03 00:22:17 +0000875 call void @llvm.dbg.declare(metadata !{i32 * %X}, metadata !0), !dbg !7
Devang Patel744950d2009-11-25 23:28:01 +0000876 store i32 21, i32* %X, !dbg !8
Dan Gohmanfe47aae2010-05-28 17:13:49 +0000877 %1 = bitcast i32* %Y to {}* ; &lt;{}*&gt; [#uses=1]
Devang Patel37280782011-02-03 00:22:17 +0000878 call void @llvm.dbg.declare(metadata !{i32 * %Y}, metadata !9), !dbg !10
Devang Patel744950d2009-11-25 23:28:01 +0000879 store i32 22, i32* %Y, !dbg !11
Dan Gohmanfe47aae2010-05-28 17:13:49 +0000880 %2 = bitcast i32* %Z to {}* ; &lt;{}*&gt; [#uses=1]
Devang Patel37280782011-02-03 00:22:17 +0000881 call void @llvm.dbg.declare(metadata !{i32 * %Z}, metadata !12), !dbg !14
Devang Patel744950d2009-11-25 23:28:01 +0000882 store i32 23, i32* %Z, !dbg !15
Bill Wendling02216ff2009-12-01 00:59:58 +0000883 %tmp = load i32* %X, !dbg !16 ; &lt;i32&gt; [#uses=1]
884 %tmp1 = load i32* %Y, !dbg !16 ; &lt;i32&gt; [#uses=1]
885 %add = add nsw i32 %tmp, %tmp1, !dbg !16 ; &lt;i32&gt; [#uses=1]
Devang Patel744950d2009-11-25 23:28:01 +0000886 store i32 %add, i32* %Z, !dbg !16
Bill Wendling02216ff2009-12-01 00:59:58 +0000887 %tmp2 = load i32* %Y, !dbg !17 ; &lt;i32&gt; [#uses=1]
Devang Patel744950d2009-11-25 23:28:01 +0000888 store i32 %tmp2, i32* %X, !dbg !17
889 ret void, !dbg !18
Chris Lattnerbdfb3392004-01-05 05:06:33 +0000890}
Devang Patel744950d2009-11-25 23:28:01 +0000891
Devang Patel37280782011-02-03 00:22:17 +0000892declare void @llvm.dbg.declare(metadata, metadata) nounwind readnone
Devang Patel744950d2009-11-25 23:28:01 +0000893
894!0 = metadata !{i32 459008, metadata !1, metadata !"X",
895 metadata !3, i32 2, metadata !6}; [ DW_TAG_auto_variable ]
896!1 = metadata !{i32 458763, metadata !2}; [DW_TAG_lexical_block ]
897!2 = metadata !{i32 458798, i32 0, metadata !3, metadata !"foo", metadata !"foo",
898 metadata !"foo", metadata !3, i32 1, metadata !4,
899 i1 false, i1 true}; [DW_TAG_subprogram ]
900!3 = metadata !{i32 458769, i32 0, i32 12, metadata !"foo.c",
901 metadata !"/private/tmp", metadata !"clang 1.1", i1 true,
902 i1 false, metadata !"", i32 0}; [DW_TAG_compile_unit ]
903!4 = metadata !{i32 458773, metadata !3, metadata !"", null, i32 0, i64 0, i64 0,
904 i64 0, i32 0, null, metadata !5, i32 0}; [DW_TAG_subroutine_type ]
905!5 = metadata !{null}
906!6 = metadata !{i32 458788, metadata !3, metadata !"int", metadata !3, i32 0,
907 i64 32, i64 32, i64 0, i32 0, i32 5}; [DW_TAG_base_type ]
908!7 = metadata !{i32 2, i32 7, metadata !1, null}
909!8 = metadata !{i32 2, i32 3, metadata !1, null}
910!9 = metadata !{i32 459008, metadata !1, metadata !"Y", metadata !3, i32 3,
911 metadata !6}; [ DW_TAG_auto_variable ]
912!10 = metadata !{i32 3, i32 7, metadata !1, null}
913!11 = metadata !{i32 3, i32 3, metadata !1, null}
914!12 = metadata !{i32 459008, metadata !13, metadata !"Z", metadata !3, i32 5,
915 metadata !6}; [ DW_TAG_auto_variable ]
916!13 = metadata !{i32 458763, metadata !1}; [DW_TAG_lexical_block ]
917!14 = metadata !{i32 5, i32 9, metadata !13, null}
918!15 = metadata !{i32 5, i32 5, metadata !13, null}
919!16 = metadata !{i32 6, i32 5, metadata !13, null}
920!17 = metadata !{i32 8, i32 3, metadata !1, null}
921!18 = metadata !{i32 9, i32 1, metadata !2, null}
Misha Brukman82873732004-05-12 19:21:57 +0000922</pre>
Chris Lattnerbdfb3392004-01-05 05:06:33 +0000923</div>
924
Bill Wendlingcf493b82009-12-01 00:53:11 +0000925<p>This example illustrates a few important details about LLVM debugging
926 information. In particular, it shows how the <tt>llvm.dbg.declare</tt>
927 intrinsic and location information, which are attached to an instruction,
928 are applied together to allow a debugger to analyze the relationship between
929 statements, variable definitions, and the code used to implement the
930 function.</p>
Chris Lattnerbdfb3392004-01-05 05:06:33 +0000931
Bill Wendlingcf493b82009-12-01 00:53:11 +0000932<div class="doc_code">
Bill Wendling02216ff2009-12-01 00:59:58 +0000933<pre>
Devang Patel37280782011-02-03 00:22:17 +0000934call void @llvm.dbg.declare(metadata, metadata !0), !dbg !7
Bill Wendlingcf493b82009-12-01 00:53:11 +0000935</pre>
936</div>
937
938<p>The first intrinsic
Devang Patel744950d2009-11-25 23:28:01 +0000939 <tt>%<a href="#format_common_declare">llvm.dbg.declare</a></tt>
Bill Wendlingcf493b82009-12-01 00:53:11 +0000940 encodes debugging information for the variable <tt>X</tt>. The metadata
941 <tt>!dbg !7</tt> attached to the intrinsic provides scope information for the
942 variable <tt>X</tt>.</p>
Bill Wendling48839d92009-05-17 05:52:39 +0000943
Bill Wendlingcf493b82009-12-01 00:53:11 +0000944<div class="doc_code">
945<pre>
946!7 = metadata !{i32 2, i32 7, metadata !1, null}
947!1 = metadata !{i32 458763, metadata !2}; [DW_TAG_lexical_block ]
948!2 = metadata !{i32 458798, i32 0, metadata !3, metadata !"foo",
949 metadata !"foo", metadata !"foo", metadata !3, i32 1,
950 metadata !4, i1 false, i1 true}; [DW_TAG_subprogram ]
951</pre>
952</div>
953
954<p>Here <tt>!7</tt> is metadata providing location information. It has four
955 fields: line number, column number, scope, and original scope. The original
956 scope represents inline location if this instruction is inlined inside a
957 caller, and is null otherwise. In this example, scope is encoded by
Devang Patel744950d2009-11-25 23:28:01 +0000958 <tt>!1</tt>. <tt>!1</tt> represents a lexical block inside the scope
959 <tt>!2</tt>, where <tt>!2</tt> is a
Bill Wendlingcf493b82009-12-01 00:53:11 +0000960 <a href="#format_subprograms">subprogram descriptor</a>. This way the
961 location information attached to the intrinsics indicates that the
962 variable <tt>X</tt> is declared at line number 2 at a function level scope in
963 function <tt>foo</tt>.</p>
Bill Wendling48839d92009-05-17 05:52:39 +0000964
Devang Patel744950d2009-11-25 23:28:01 +0000965<p>Now lets take another example.</p>
Bill Wendling48839d92009-05-17 05:52:39 +0000966
Bill Wendlingcf493b82009-12-01 00:53:11 +0000967<div class="doc_code">
Bill Wendling02216ff2009-12-01 00:59:58 +0000968<pre>
Devang Patel37280782011-02-03 00:22:17 +0000969call void @llvm.dbg.declare(metadata, metadata !12), !dbg !14
Bill Wendlingcf493b82009-12-01 00:53:11 +0000970</pre>
971</div>
972
973<p>The second intrinsic
Devang Patel744950d2009-11-25 23:28:01 +0000974 <tt>%<a href="#format_common_declare">llvm.dbg.declare</a></tt>
Bill Wendlingcf493b82009-12-01 00:53:11 +0000975 encodes debugging information for variable <tt>Z</tt>. The metadata
976 <tt>!dbg !14</tt> attached to the intrinsic provides scope information for
977 the variable <tt>Z</tt>.</p>
Bill Wendling48839d92009-05-17 05:52:39 +0000978
Bill Wendlingcf493b82009-12-01 00:53:11 +0000979<div class="doc_code">
980<pre>
981!13 = metadata !{i32 458763, metadata !1}; [DW_TAG_lexical_block ]
982!14 = metadata !{i32 5, i32 9, metadata !13, null}
983</pre>
984</div>
Bill Wendling48839d92009-05-17 05:52:39 +0000985
John Criswellb34500f2010-03-17 15:01:50 +0000986<p>Here <tt>!14</tt> indicates that <tt>Z</tt> is declared at line number 5 and
Bill Wendlingcf493b82009-12-01 00:53:11 +0000987 column number 9 inside of lexical scope <tt>!13</tt>. The lexical scope
988 itself resides inside of lexical scope <tt>!1</tt> described above.</p>
989
990<p>The scope information attached with each instruction provides a
991 straightforward way to find instructions covered by a scope.</p>
992
Bill Wendling48839d92009-05-17 05:52:39 +0000993</div>
Chris Lattnerbdfb3392004-01-05 05:06:33 +0000994
NAKAMURA Takumif5af6ad2011-04-23 00:30:22 +0000995</div>
996
Chris Lattnerbdfb3392004-01-05 05:06:33 +0000997<!-- *********************************************************************** -->
NAKAMURA Takumi05d02652011-04-18 23:59:50 +0000998<h2>
Chris Lattner8ff75902004-01-06 05:31:32 +0000999 <a name="ccxx_frontend">C/C++ front-end specific debug information</a>
NAKAMURA Takumi05d02652011-04-18 23:59:50 +00001000</h2>
Misha Brukman94218a72004-12-09 20:27:37 +00001001<!-- *********************************************************************** -->
Chris Lattnerbdfb3392004-01-05 05:06:33 +00001002
NAKAMURA Takumif5af6ad2011-04-23 00:30:22 +00001003<div>
Chris Lattnerbdfb3392004-01-05 05:06:33 +00001004
Misha Brukman82873732004-05-12 19:21:57 +00001005<p>The C and C++ front-ends represent information about the program in a format
Bill Wendling48839d92009-05-17 05:52:39 +00001006 that is effectively identical
1007 to <a href="http://www.eagercon.com/dwarf/dwarf3std.htm">DWARF 3.0</a> in
1008 terms of information content. This allows code generators to trivially
1009 support native debuggers by generating standard dwarf information, and
1010 contains enough information for non-dwarf targets to translate it as
1011 needed.</p>
Chris Lattnerbdfb3392004-01-05 05:06:33 +00001012
Jim Laskeycec12a52006-03-14 18:08:46 +00001013<p>This section describes the forms used to represent C and C++ programs. Other
Bill Wendling48839d92009-05-17 05:52:39 +00001014 languages could pattern themselves after this (which itself is tuned to
1015 representing programs in the same way that DWARF 3 does), or they could
1016 choose to provide completely different forms if they don't fit into the DWARF
1017 model. As support for debugging information gets added to the various LLVM
1018 source-language front-ends, the information used should be documented
1019 here.</p>
Chris Lattnerbdfb3392004-01-05 05:06:33 +00001020
Jim Laskeycec12a52006-03-14 18:08:46 +00001021<p>The following sections provide examples of various C/C++ constructs and the
Bill Wendling48839d92009-05-17 05:52:39 +00001022 debug information that would best describe those constructs.</p>
Jim Laskeycec12a52006-03-14 18:08:46 +00001023
Chris Lattnerbdfb3392004-01-05 05:06:33 +00001024<!-- ======================================================================= -->
NAKAMURA Takumi05d02652011-04-18 23:59:50 +00001025<h3>
Jim Laskeycec12a52006-03-14 18:08:46 +00001026 <a name="ccxx_compile_units">C/C++ source file information</a>
NAKAMURA Takumi05d02652011-04-18 23:59:50 +00001027</h3>
Chris Lattnerbdfb3392004-01-05 05:06:33 +00001028
NAKAMURA Takumif5af6ad2011-04-23 00:30:22 +00001029<div>
Chris Lattnerbdfb3392004-01-05 05:06:33 +00001030
Bill Wendling48839d92009-05-17 05:52:39 +00001031<p>Given the source files <tt>MySource.cpp</tt> and <tt>MyHeader.h</tt> located
1032 in the directory <tt>/Users/mine/sources</tt>, the following code:</p>
Chris Lattner8ff75902004-01-06 05:31:32 +00001033
Bill Wendling48839d92009-05-17 05:52:39 +00001034<div class="doc_code">
Jim Laskeycec12a52006-03-14 18:08:46 +00001035<pre>
1036#include "MyHeader.h"
Chris Lattner8ff75902004-01-06 05:31:32 +00001037
Jim Laskeycec12a52006-03-14 18:08:46 +00001038int main(int argc, char *argv[]) {
1039 return 0;
1040}
1041</pre>
Bill Wendling48839d92009-05-17 05:52:39 +00001042</div>
Chris Lattner8ff75902004-01-06 05:31:32 +00001043
Misha Brukman96e00812008-12-16 02:54:22 +00001044<p>a C/C++ front-end would generate the following descriptors:</p>
Jim Laskeycec12a52006-03-14 18:08:46 +00001045
Bill Wendling48839d92009-05-17 05:52:39 +00001046<div class="doc_code">
Jim Laskeycec12a52006-03-14 18:08:46 +00001047<pre>
1048...
1049;;
Devang Patel4b945502010-03-09 00:44:10 +00001050;; Define the compile unit for the main source file "/Users/mine/sources/MySource.cpp".
Jim Laskeycec12a52006-03-14 18:08:46 +00001051;;
Devang Patel4b945502010-03-09 00:44:10 +00001052!2 = metadata !{
1053 i32 524305, ;; Tag
Devang Patele4b27562009-08-28 23:24:31 +00001054 i32 0, ;; Unused
1055 i32 4, ;; Language Id
1056 metadata !"MySource.cpp",
1057 metadata !"/Users/mine/sources",
1058 metadata !"4.2.1 (Based on Apple Inc. build 5649) (LLVM build 00)",
1059 i1 true, ;; Main Compile Unit
1060 i1 false, ;; Optimized compile unit
1061 metadata !"", ;; Compiler flags
1062 i32 0} ;; Runtime version
1063
Jim Laskeycec12a52006-03-14 18:08:46 +00001064;;
Devang Patel4b945502010-03-09 00:44:10 +00001065;; Define the file for the file "/Users/mine/sources/MySource.cpp".
Jim Laskeycec12a52006-03-14 18:08:46 +00001066;;
Devang Patele4b27562009-08-28 23:24:31 +00001067!1 = metadata !{
Devang Patel4b945502010-03-09 00:44:10 +00001068 i32 524329, ;; Tag
1069 metadata !"MySource.cpp",
Devang Patele4b27562009-08-28 23:24:31 +00001070 metadata !"/Users/mine/sources",
Devang Patel9fea9c22010-07-13 16:53:20 +00001071 metadata !2 ;; Compile unit
Devang Patel4b945502010-03-09 00:44:10 +00001072}
1073
1074;;
1075;; Define the file for the file "/Users/mine/sources/Myheader.h"
1076;;
1077!3 = metadata !{
1078 i32 524329, ;; Tag
1079 metadata !"Myheader.h"
1080 metadata !"/Users/mine/sources",
Devang Patel9fea9c22010-07-13 16:53:20 +00001081 metadata !2 ;; Compile unit
Devang Patel4b945502010-03-09 00:44:10 +00001082}
Jim Laskeycec12a52006-03-14 18:08:46 +00001083
Jim Laskeycec12a52006-03-14 18:08:46 +00001084...
1085</pre>
Bill Wendling48839d92009-05-17 05:52:39 +00001086</div>
Jim Laskeycec12a52006-03-14 18:08:46 +00001087
Devang Pateld98ec5f2010-03-26 19:08:36 +00001088<p>llvm::Instruction provides easy access to metadata attached with an
1089instruction. One can extract line number information encoded in LLVM IR
1090using <tt>Instruction::getMetadata()</tt> and
1091<tt>DILocation::getLineNumber()</tt>.
1092<pre>
1093 if (MDNode *N = I->getMetadata("dbg")) { // Here I is an LLVM instruction
1094 DILocation Loc(N); // DILocation is in DebugInfo.h
1095 unsigned Line = Loc.getLineNumber();
1096 StringRef File = Loc.getFilename();
1097 StringRef Dir = Loc.getDirectory();
1098 }
1099</pre>
Chris Lattner8ff75902004-01-06 05:31:32 +00001100</div>
1101
1102<!-- ======================================================================= -->
NAKAMURA Takumi05d02652011-04-18 23:59:50 +00001103<h3>
Jim Laskeycec12a52006-03-14 18:08:46 +00001104 <a name="ccxx_global_variable">C/C++ global variable information</a>
NAKAMURA Takumi05d02652011-04-18 23:59:50 +00001105</h3>
Chris Lattner8ff75902004-01-06 05:31:32 +00001106
NAKAMURA Takumif5af6ad2011-04-23 00:30:22 +00001107<div>
Jim Laskeycec12a52006-03-14 18:08:46 +00001108
Misha Brukman96e00812008-12-16 02:54:22 +00001109<p>Given an integer global variable declared as follows:</p>
Jim Laskeycec12a52006-03-14 18:08:46 +00001110
Bill Wendling48839d92009-05-17 05:52:39 +00001111<div class="doc_code">
Jim Laskeycec12a52006-03-14 18:08:46 +00001112<pre>
1113int MyGlobal = 100;
1114</pre>
Bill Wendling48839d92009-05-17 05:52:39 +00001115</div>
Jim Laskeycec12a52006-03-14 18:08:46 +00001116
Misha Brukman96e00812008-12-16 02:54:22 +00001117<p>a C/C++ front-end would generate the following descriptors:</p>
Jim Laskeycec12a52006-03-14 18:08:46 +00001118
Bill Wendling48839d92009-05-17 05:52:39 +00001119<div class="doc_code">
Jim Laskeycec12a52006-03-14 18:08:46 +00001120<pre>
1121;;
Jim Laskeycec12a52006-03-14 18:08:46 +00001122;; Define the global itself.
1123;;
1124%MyGlobal = global int 100
1125...
1126;;
Devang Patele4b27562009-08-28 23:24:31 +00001127;; List of debug info of globals
Jim Laskeycec12a52006-03-14 18:08:46 +00001128;;
Devang Patele4b27562009-08-28 23:24:31 +00001129!llvm.dbg.gv = !{!0}
Jim Laskeycec12a52006-03-14 18:08:46 +00001130
1131;;
1132;; Define the global variable descriptor. Note the reference to the global
1133;; variable anchor and the global variable itself.
1134;;
Devang Patele4b27562009-08-28 23:24:31 +00001135!0 = metadata !{
Devang Patel4b945502010-03-09 00:44:10 +00001136 i32 524340, ;; Tag
Devang Patele4b27562009-08-28 23:24:31 +00001137 i32 0, ;; Unused
1138 metadata !1, ;; Context
1139 metadata !"MyGlobal", ;; Name
1140 metadata !"MyGlobal", ;; Display Name
1141 metadata !"MyGlobal", ;; Linkage Name
Devang Patel4b945502010-03-09 00:44:10 +00001142 metadata !3, ;; Compile Unit
Devang Patele4b27562009-08-28 23:24:31 +00001143 i32 1, ;; Line Number
Devang Patel4b945502010-03-09 00:44:10 +00001144 metadata !4, ;; Type
Devang Patele4b27562009-08-28 23:24:31 +00001145 i1 false, ;; Is a local variable
1146 i1 true, ;; Is this a definition
1147 i32* @MyGlobal ;; The global variable
1148}
1149
Jim Laskeycec12a52006-03-14 18:08:46 +00001150;;
1151;; Define the basic type of 32 bit signed integer. Note that since int is an
1152;; intrinsic type the source file is NULL and line 0.
1153;;
Devang Patel4b945502010-03-09 00:44:10 +00001154!4 = metadata !{
1155 i32 524324, ;; Tag
Devang Patele4b27562009-08-28 23:24:31 +00001156 metadata !1, ;; Context
1157 metadata !"int", ;; Name
Devang Patel4b945502010-03-09 00:44:10 +00001158 metadata !1, ;; File
Devang Patele4b27562009-08-28 23:24:31 +00001159 i32 0, ;; Line number
1160 i64 32, ;; Size in Bits
1161 i64 32, ;; Align in Bits
1162 i64 0, ;; Offset in Bits
1163 i32 0, ;; Flags
1164 i32 5 ;; Encoding
1165}
Jim Laskeycec12a52006-03-14 18:08:46 +00001166
Jim Laskeycec12a52006-03-14 18:08:46 +00001167</pre>
Bill Wendling48839d92009-05-17 05:52:39 +00001168</div>
Jim Laskeycec12a52006-03-14 18:08:46 +00001169
Chris Lattner8ff75902004-01-06 05:31:32 +00001170</div>
Chris Lattnerbdfb3392004-01-05 05:06:33 +00001171
Jim Laskeycec12a52006-03-14 18:08:46 +00001172<!-- ======================================================================= -->
NAKAMURA Takumi05d02652011-04-18 23:59:50 +00001173<h3>
Jim Laskeycec12a52006-03-14 18:08:46 +00001174 <a name="ccxx_subprogram">C/C++ function information</a>
NAKAMURA Takumi05d02652011-04-18 23:59:50 +00001175</h3>
Jim Laskeycec12a52006-03-14 18:08:46 +00001176
NAKAMURA Takumif5af6ad2011-04-23 00:30:22 +00001177<div>
Jim Laskeycec12a52006-03-14 18:08:46 +00001178
Misha Brukman96e00812008-12-16 02:54:22 +00001179<p>Given a function declared as follows:</p>
Jim Laskeycec12a52006-03-14 18:08:46 +00001180
Bill Wendling48839d92009-05-17 05:52:39 +00001181<div class="doc_code">
Jim Laskeycec12a52006-03-14 18:08:46 +00001182<pre>
1183int main(int argc, char *argv[]) {
1184 return 0;
1185}
1186</pre>
Bill Wendling48839d92009-05-17 05:52:39 +00001187</div>
Jim Laskeycec12a52006-03-14 18:08:46 +00001188
Misha Brukman96e00812008-12-16 02:54:22 +00001189<p>a C/C++ front-end would generate the following descriptors:</p>
Jim Laskeycec12a52006-03-14 18:08:46 +00001190
Bill Wendling48839d92009-05-17 05:52:39 +00001191<div class="doc_code">
Jim Laskeycec12a52006-03-14 18:08:46 +00001192<pre>
1193;;
Jim Laskeycec12a52006-03-14 18:08:46 +00001194;; Define the anchor for subprograms. Note that the second field of the
1195;; anchor is 46, which is the same as the tag for subprograms
1196;; (46 = DW_TAG_subprogram.)
1197;;
Devang Patel4b945502010-03-09 00:44:10 +00001198!6 = metadata !{
1199 i32 524334, ;; Tag
Devang Patele4b27562009-08-28 23:24:31 +00001200 i32 0, ;; Unused
1201 metadata !1, ;; Context
1202 metadata !"main", ;; Name
1203 metadata !"main", ;; Display name
1204 metadata !"main", ;; Linkage name
Devang Patel4b945502010-03-09 00:44:10 +00001205 metadata !1, ;; File
Devang Patele4b27562009-08-28 23:24:31 +00001206 i32 1, ;; Line number
Devang Patel4b945502010-03-09 00:44:10 +00001207 metadata !4, ;; Type
Devang Patele4b27562009-08-28 23:24:31 +00001208 i1 false, ;; Is local
Devang Patelda194752011-04-05 22:52:06 +00001209 i1 true, ;; Is definition
1210 i32 0, ;; Virtuality attribute, e.g. pure virtual function
1211 i32 0, ;; Index into virtual table for C++ methods
1212 i32 0, ;; Type that holds virtual table.
1213 i32 0, ;; Flags
1214 i1 false, ;; True if this function is optimized
1215 Function *, ;; Pointer to llvm::Function
1216 null ;; Function template parameters
Devang Patele4b27562009-08-28 23:24:31 +00001217}
Jim Laskeycec12a52006-03-14 18:08:46 +00001218;;
1219;; Define the subprogram itself.
1220;;
Devang Patele4b27562009-08-28 23:24:31 +00001221define i32 @main(i32 %argc, i8** %argv) {
Jim Laskeycec12a52006-03-14 18:08:46 +00001222...
1223}
1224</pre>
Bill Wendling48839d92009-05-17 05:52:39 +00001225</div>
Jim Laskeycec12a52006-03-14 18:08:46 +00001226
1227</div>
1228
1229<!-- ======================================================================= -->
NAKAMURA Takumi05d02652011-04-18 23:59:50 +00001230<h3>
Jim Laskeycec12a52006-03-14 18:08:46 +00001231 <a name="ccxx_basic_types">C/C++ basic types</a>
NAKAMURA Takumi05d02652011-04-18 23:59:50 +00001232</h3>
Jim Laskeycec12a52006-03-14 18:08:46 +00001233
NAKAMURA Takumif5af6ad2011-04-23 00:30:22 +00001234<div>
Jim Laskeycec12a52006-03-14 18:08:46 +00001235
Misha Brukman96e00812008-12-16 02:54:22 +00001236<p>The following are the basic type descriptors for C/C++ core types:</p>
Jim Laskeycec12a52006-03-14 18:08:46 +00001237
Jim Laskeycec12a52006-03-14 18:08:46 +00001238<!-- ======================================================================= -->
NAKAMURA Takumi05d02652011-04-18 23:59:50 +00001239<h4>
Jim Laskeycec12a52006-03-14 18:08:46 +00001240 <a name="ccxx_basic_type_bool">bool</a>
NAKAMURA Takumi05d02652011-04-18 23:59:50 +00001241</h4>
Jim Laskeycec12a52006-03-14 18:08:46 +00001242
NAKAMURA Takumif5af6ad2011-04-23 00:30:22 +00001243<div>
Jim Laskeycec12a52006-03-14 18:08:46 +00001244
Bill Wendling48839d92009-05-17 05:52:39 +00001245<div class="doc_code">
Jim Laskeycec12a52006-03-14 18:08:46 +00001246<pre>
Devang Patele4b27562009-08-28 23:24:31 +00001247!2 = metadata !{
Devang Patel4b945502010-03-09 00:44:10 +00001248 i32 524324, ;; Tag
Devang Patele4b27562009-08-28 23:24:31 +00001249 metadata !1, ;; Context
1250 metadata !"bool", ;; Name
Devang Patel4b945502010-03-09 00:44:10 +00001251 metadata !1, ;; File
Devang Patele4b27562009-08-28 23:24:31 +00001252 i32 0, ;; Line number
1253 i64 8, ;; Size in Bits
1254 i64 8, ;; Align in Bits
1255 i64 0, ;; Offset in Bits
1256 i32 0, ;; Flags
1257 i32 2 ;; Encoding
1258}
Jim Laskeycec12a52006-03-14 18:08:46 +00001259</pre>
Bill Wendling48839d92009-05-17 05:52:39 +00001260</div>
Jim Laskeycec12a52006-03-14 18:08:46 +00001261
1262</div>
1263
1264<!-- ======================================================================= -->
NAKAMURA Takumi05d02652011-04-18 23:59:50 +00001265<h4>
Jim Laskeycec12a52006-03-14 18:08:46 +00001266 <a name="ccxx_basic_char">char</a>
NAKAMURA Takumi05d02652011-04-18 23:59:50 +00001267</h4>
Jim Laskeycec12a52006-03-14 18:08:46 +00001268
NAKAMURA Takumif5af6ad2011-04-23 00:30:22 +00001269<div>
Jim Laskeycec12a52006-03-14 18:08:46 +00001270
Bill Wendling48839d92009-05-17 05:52:39 +00001271<div class="doc_code">
Jim Laskeycec12a52006-03-14 18:08:46 +00001272<pre>
Devang Patele4b27562009-08-28 23:24:31 +00001273!2 = metadata !{
Devang Patel4b945502010-03-09 00:44:10 +00001274 i32 524324, ;; Tag
Devang Patele4b27562009-08-28 23:24:31 +00001275 metadata !1, ;; Context
1276 metadata !"char", ;; Name
Devang Patel4b945502010-03-09 00:44:10 +00001277 metadata !1, ;; File
Devang Patele4b27562009-08-28 23:24:31 +00001278 i32 0, ;; Line number
1279 i64 8, ;; Size in Bits
1280 i64 8, ;; Align in Bits
1281 i64 0, ;; Offset in Bits
1282 i32 0, ;; Flags
1283 i32 6 ;; Encoding
1284}
Jim Laskeycec12a52006-03-14 18:08:46 +00001285</pre>
Bill Wendling48839d92009-05-17 05:52:39 +00001286</div>
Jim Laskeycec12a52006-03-14 18:08:46 +00001287
1288</div>
1289
1290<!-- ======================================================================= -->
NAKAMURA Takumi05d02652011-04-18 23:59:50 +00001291<h4>
Jim Laskeycec12a52006-03-14 18:08:46 +00001292 <a name="ccxx_basic_unsigned_char">unsigned char</a>
NAKAMURA Takumi05d02652011-04-18 23:59:50 +00001293</h4>
Jim Laskeycec12a52006-03-14 18:08:46 +00001294
NAKAMURA Takumif5af6ad2011-04-23 00:30:22 +00001295<div>
Jim Laskeycec12a52006-03-14 18:08:46 +00001296
Bill Wendling48839d92009-05-17 05:52:39 +00001297<div class="doc_code">
Jim Laskeycec12a52006-03-14 18:08:46 +00001298<pre>
Devang Patele4b27562009-08-28 23:24:31 +00001299!2 = metadata !{
Devang Patel4b945502010-03-09 00:44:10 +00001300 i32 524324, ;; Tag
Devang Patele4b27562009-08-28 23:24:31 +00001301 metadata !1, ;; Context
1302 metadata !"unsigned char",
Devang Patel4b945502010-03-09 00:44:10 +00001303 metadata !1, ;; File
Devang Patele4b27562009-08-28 23:24:31 +00001304 i32 0, ;; Line number
1305 i64 8, ;; Size in Bits
1306 i64 8, ;; Align in Bits
1307 i64 0, ;; Offset in Bits
1308 i32 0, ;; Flags
1309 i32 8 ;; Encoding
1310}
Jim Laskeycec12a52006-03-14 18:08:46 +00001311</pre>
Bill Wendling48839d92009-05-17 05:52:39 +00001312</div>
Jim Laskeycec12a52006-03-14 18:08:46 +00001313
1314</div>
1315
1316<!-- ======================================================================= -->
NAKAMURA Takumi05d02652011-04-18 23:59:50 +00001317<h4>
Jim Laskeycec12a52006-03-14 18:08:46 +00001318 <a name="ccxx_basic_short">short</a>
NAKAMURA Takumi05d02652011-04-18 23:59:50 +00001319</h4>
Jim Laskeycec12a52006-03-14 18:08:46 +00001320
NAKAMURA Takumif5af6ad2011-04-23 00:30:22 +00001321<div>
Jim Laskeycec12a52006-03-14 18:08:46 +00001322
Bill Wendling48839d92009-05-17 05:52:39 +00001323<div class="doc_code">
Jim Laskeycec12a52006-03-14 18:08:46 +00001324<pre>
Devang Patele4b27562009-08-28 23:24:31 +00001325!2 = metadata !{
Devang Patel4b945502010-03-09 00:44:10 +00001326 i32 524324, ;; Tag
Devang Patele4b27562009-08-28 23:24:31 +00001327 metadata !1, ;; Context
1328 metadata !"short int",
Devang Patel4b945502010-03-09 00:44:10 +00001329 metadata !1, ;; File
Devang Patele4b27562009-08-28 23:24:31 +00001330 i32 0, ;; Line number
1331 i64 16, ;; Size in Bits
1332 i64 16, ;; Align in Bits
1333 i64 0, ;; Offset in Bits
1334 i32 0, ;; Flags
1335 i32 5 ;; Encoding
1336}
Jim Laskeycec12a52006-03-14 18:08:46 +00001337</pre>
Bill Wendling48839d92009-05-17 05:52:39 +00001338</div>
Jim Laskeycec12a52006-03-14 18:08:46 +00001339
1340</div>
1341
1342<!-- ======================================================================= -->
NAKAMURA Takumi05d02652011-04-18 23:59:50 +00001343<h4>
Jim Laskeycec12a52006-03-14 18:08:46 +00001344 <a name="ccxx_basic_unsigned_short">unsigned short</a>
NAKAMURA Takumi05d02652011-04-18 23:59:50 +00001345</h4>
Jim Laskeycec12a52006-03-14 18:08:46 +00001346
NAKAMURA Takumif5af6ad2011-04-23 00:30:22 +00001347<div>
Jim Laskeycec12a52006-03-14 18:08:46 +00001348
Bill Wendling48839d92009-05-17 05:52:39 +00001349<div class="doc_code">
Jim Laskeycec12a52006-03-14 18:08:46 +00001350<pre>
Devang Patele4b27562009-08-28 23:24:31 +00001351!2 = metadata !{
Devang Patel4b945502010-03-09 00:44:10 +00001352 i32 524324, ;; Tag
Devang Patele4b27562009-08-28 23:24:31 +00001353 metadata !1, ;; Context
1354 metadata !"short unsigned int",
Devang Patel4b945502010-03-09 00:44:10 +00001355 metadata !1, ;; File
Devang Patele4b27562009-08-28 23:24:31 +00001356 i32 0, ;; Line number
1357 i64 16, ;; Size in Bits
1358 i64 16, ;; Align in Bits
1359 i64 0, ;; Offset in Bits
1360 i32 0, ;; Flags
1361 i32 7 ;; Encoding
1362}
Jim Laskeycec12a52006-03-14 18:08:46 +00001363</pre>
Bill Wendling48839d92009-05-17 05:52:39 +00001364</div>
Jim Laskeycec12a52006-03-14 18:08:46 +00001365
1366</div>
1367
1368<!-- ======================================================================= -->
NAKAMURA Takumi05d02652011-04-18 23:59:50 +00001369<h4>
Jim Laskeycec12a52006-03-14 18:08:46 +00001370 <a name="ccxx_basic_int">int</a>
NAKAMURA Takumi05d02652011-04-18 23:59:50 +00001371</h4>
Jim Laskeycec12a52006-03-14 18:08:46 +00001372
NAKAMURA Takumif5af6ad2011-04-23 00:30:22 +00001373<div>
Jim Laskeycec12a52006-03-14 18:08:46 +00001374
Bill Wendling48839d92009-05-17 05:52:39 +00001375<div class="doc_code">
Jim Laskeycec12a52006-03-14 18:08:46 +00001376<pre>
Devang Patele4b27562009-08-28 23:24:31 +00001377!2 = metadata !{
Devang Patel4b945502010-03-09 00:44:10 +00001378 i32 524324, ;; Tag
Devang Patele4b27562009-08-28 23:24:31 +00001379 metadata !1, ;; Context
1380 metadata !"int", ;; Name
Devang Patel4b945502010-03-09 00:44:10 +00001381 metadata !1, ;; File
Devang Patele4b27562009-08-28 23:24:31 +00001382 i32 0, ;; Line number
1383 i64 32, ;; Size in Bits
1384 i64 32, ;; Align in Bits
1385 i64 0, ;; Offset in Bits
1386 i32 0, ;; Flags
1387 i32 5 ;; Encoding
1388}
Bill Wendling48839d92009-05-17 05:52:39 +00001389</pre></div>
Jim Laskeycec12a52006-03-14 18:08:46 +00001390
1391</div>
1392
1393<!-- ======================================================================= -->
NAKAMURA Takumi05d02652011-04-18 23:59:50 +00001394<h4>
Jim Laskeycec12a52006-03-14 18:08:46 +00001395 <a name="ccxx_basic_unsigned_int">unsigned int</a>
NAKAMURA Takumi05d02652011-04-18 23:59:50 +00001396</h4>
Jim Laskeycec12a52006-03-14 18:08:46 +00001397
NAKAMURA Takumif5af6ad2011-04-23 00:30:22 +00001398<div>
Jim Laskeycec12a52006-03-14 18:08:46 +00001399
Bill Wendling48839d92009-05-17 05:52:39 +00001400<div class="doc_code">
Jim Laskeycec12a52006-03-14 18:08:46 +00001401<pre>
Devang Patele4b27562009-08-28 23:24:31 +00001402!2 = metadata !{
Devang Patel4b945502010-03-09 00:44:10 +00001403 i32 524324, ;; Tag
Devang Patele4b27562009-08-28 23:24:31 +00001404 metadata !1, ;; Context
1405 metadata !"unsigned int",
Devang Patel4b945502010-03-09 00:44:10 +00001406 metadata !1, ;; File
Devang Patele4b27562009-08-28 23:24:31 +00001407 i32 0, ;; Line number
1408 i64 32, ;; Size in Bits
1409 i64 32, ;; Align in Bits
1410 i64 0, ;; Offset in Bits
1411 i32 0, ;; Flags
1412 i32 7 ;; Encoding
1413}
Jim Laskeycec12a52006-03-14 18:08:46 +00001414</pre>
Bill Wendling48839d92009-05-17 05:52:39 +00001415</div>
Jim Laskeycec12a52006-03-14 18:08:46 +00001416
1417</div>
1418
1419<!-- ======================================================================= -->
NAKAMURA Takumi05d02652011-04-18 23:59:50 +00001420<h4>
Jim Laskeycec12a52006-03-14 18:08:46 +00001421 <a name="ccxx_basic_long_long">long long</a>
NAKAMURA Takumi05d02652011-04-18 23:59:50 +00001422</h4>
Jim Laskeycec12a52006-03-14 18:08:46 +00001423
NAKAMURA Takumif5af6ad2011-04-23 00:30:22 +00001424<div>
Jim Laskeycec12a52006-03-14 18:08:46 +00001425
Bill Wendling48839d92009-05-17 05:52:39 +00001426<div class="doc_code">
Jim Laskeycec12a52006-03-14 18:08:46 +00001427<pre>
Devang Patele4b27562009-08-28 23:24:31 +00001428!2 = metadata !{
Devang Patel4b945502010-03-09 00:44:10 +00001429 i32 524324, ;; Tag
Devang Patele4b27562009-08-28 23:24:31 +00001430 metadata !1, ;; Context
1431 metadata !"long long int",
Devang Patel4b945502010-03-09 00:44:10 +00001432 metadata !1, ;; File
Devang Patele4b27562009-08-28 23:24:31 +00001433 i32 0, ;; Line number
1434 i64 64, ;; Size in Bits
1435 i64 64, ;; Align in Bits
1436 i64 0, ;; Offset in Bits
1437 i32 0, ;; Flags
1438 i32 5 ;; Encoding
1439}
Jim Laskeycec12a52006-03-14 18:08:46 +00001440</pre>
Bill Wendling48839d92009-05-17 05:52:39 +00001441</div>
Jim Laskeycec12a52006-03-14 18:08:46 +00001442
1443</div>
1444
1445<!-- ======================================================================= -->
NAKAMURA Takumi05d02652011-04-18 23:59:50 +00001446<h4>
Jim Laskeycec12a52006-03-14 18:08:46 +00001447 <a name="ccxx_basic_unsigned_long_long">unsigned long long</a>
NAKAMURA Takumi05d02652011-04-18 23:59:50 +00001448</h4>
Jim Laskeycec12a52006-03-14 18:08:46 +00001449
NAKAMURA Takumif5af6ad2011-04-23 00:30:22 +00001450<div>
Jim Laskeycec12a52006-03-14 18:08:46 +00001451
Bill Wendling48839d92009-05-17 05:52:39 +00001452<div class="doc_code">
Jim Laskeycec12a52006-03-14 18:08:46 +00001453<pre>
Devang Patele4b27562009-08-28 23:24:31 +00001454!2 = metadata !{
Devang Patel4b945502010-03-09 00:44:10 +00001455 i32 524324, ;; Tag
Devang Patele4b27562009-08-28 23:24:31 +00001456 metadata !1, ;; Context
1457 metadata !"long long unsigned int",
Devang Patel4b945502010-03-09 00:44:10 +00001458 metadata !1, ;; File
Devang Patele4b27562009-08-28 23:24:31 +00001459 i32 0, ;; Line number
1460 i64 64, ;; Size in Bits
1461 i64 64, ;; Align in Bits
1462 i64 0, ;; Offset in Bits
1463 i32 0, ;; Flags
1464 i32 7 ;; Encoding
1465}
Jim Laskeycec12a52006-03-14 18:08:46 +00001466</pre>
Bill Wendling48839d92009-05-17 05:52:39 +00001467</div>
Jim Laskeycec12a52006-03-14 18:08:46 +00001468
1469</div>
1470
1471<!-- ======================================================================= -->
NAKAMURA Takumi05d02652011-04-18 23:59:50 +00001472<h4>
Jim Laskeycec12a52006-03-14 18:08:46 +00001473 <a name="ccxx_basic_float">float</a>
NAKAMURA Takumi05d02652011-04-18 23:59:50 +00001474</h4>
Jim Laskeycec12a52006-03-14 18:08:46 +00001475
NAKAMURA Takumif5af6ad2011-04-23 00:30:22 +00001476<div>
Jim Laskeycec12a52006-03-14 18:08:46 +00001477
Bill Wendling48839d92009-05-17 05:52:39 +00001478<div class="doc_code">
Jim Laskeycec12a52006-03-14 18:08:46 +00001479<pre>
Devang Patele4b27562009-08-28 23:24:31 +00001480!2 = metadata !{
Devang Patel4b945502010-03-09 00:44:10 +00001481 i32 524324, ;; Tag
Devang Patele4b27562009-08-28 23:24:31 +00001482 metadata !1, ;; Context
1483 metadata !"float",
Devang Patel4b945502010-03-09 00:44:10 +00001484 metadata !1, ;; File
Devang Patele4b27562009-08-28 23:24:31 +00001485 i32 0, ;; Line number
1486 i64 32, ;; Size in Bits
1487 i64 32, ;; Align in Bits
1488 i64 0, ;; Offset in Bits
1489 i32 0, ;; Flags
1490 i32 4 ;; Encoding
1491}
Jim Laskeycec12a52006-03-14 18:08:46 +00001492</pre>
Bill Wendling48839d92009-05-17 05:52:39 +00001493</div>
Jim Laskeycec12a52006-03-14 18:08:46 +00001494
1495</div>
1496
1497<!-- ======================================================================= -->
NAKAMURA Takumi05d02652011-04-18 23:59:50 +00001498<h4>
Jim Laskeycec12a52006-03-14 18:08:46 +00001499 <a name="ccxx_basic_double">double</a>
NAKAMURA Takumi05d02652011-04-18 23:59:50 +00001500</h4>
Jim Laskeycec12a52006-03-14 18:08:46 +00001501
NAKAMURA Takumif5af6ad2011-04-23 00:30:22 +00001502<div>
Jim Laskeycec12a52006-03-14 18:08:46 +00001503
Bill Wendling48839d92009-05-17 05:52:39 +00001504<div class="doc_code">
Jim Laskeycec12a52006-03-14 18:08:46 +00001505<pre>
Devang Patele4b27562009-08-28 23:24:31 +00001506!2 = metadata !{
Devang Patel4b945502010-03-09 00:44:10 +00001507 i32 524324, ;; Tag
Devang Patele4b27562009-08-28 23:24:31 +00001508 metadata !1, ;; Context
1509 metadata !"double",;; Name
Devang Patel4b945502010-03-09 00:44:10 +00001510 metadata !1, ;; File
Devang Patele4b27562009-08-28 23:24:31 +00001511 i32 0, ;; Line number
1512 i64 64, ;; Size in Bits
1513 i64 64, ;; Align in Bits
1514 i64 0, ;; Offset in Bits
1515 i32 0, ;; Flags
1516 i32 4 ;; Encoding
1517}
Jim Laskeycec12a52006-03-14 18:08:46 +00001518</pre>
Bill Wendling48839d92009-05-17 05:52:39 +00001519</div>
Jim Laskeycec12a52006-03-14 18:08:46 +00001520
1521</div>
1522
NAKAMURA Takumif5af6ad2011-04-23 00:30:22 +00001523</div>
1524
Jim Laskeycec12a52006-03-14 18:08:46 +00001525<!-- ======================================================================= -->
NAKAMURA Takumi05d02652011-04-18 23:59:50 +00001526<h3>
Jim Laskeycec12a52006-03-14 18:08:46 +00001527 <a name="ccxx_derived_types">C/C++ derived types</a>
NAKAMURA Takumi05d02652011-04-18 23:59:50 +00001528</h3>
Jim Laskeycec12a52006-03-14 18:08:46 +00001529
NAKAMURA Takumif5af6ad2011-04-23 00:30:22 +00001530<div>
Jim Laskeycec12a52006-03-14 18:08:46 +00001531
Misha Brukman96e00812008-12-16 02:54:22 +00001532<p>Given the following as an example of C/C++ derived type:</p>
Jim Laskeycec12a52006-03-14 18:08:46 +00001533
Bill Wendling48839d92009-05-17 05:52:39 +00001534<div class="doc_code">
Jim Laskeycec12a52006-03-14 18:08:46 +00001535<pre>
1536typedef const int *IntPtr;
1537</pre>
Bill Wendling48839d92009-05-17 05:52:39 +00001538</div>
Jim Laskeycec12a52006-03-14 18:08:46 +00001539
Misha Brukman96e00812008-12-16 02:54:22 +00001540<p>a C/C++ front-end would generate the following descriptors:</p>
Jim Laskeycec12a52006-03-14 18:08:46 +00001541
Bill Wendling48839d92009-05-17 05:52:39 +00001542<div class="doc_code">
Jim Laskeycec12a52006-03-14 18:08:46 +00001543<pre>
1544;;
1545;; Define the typedef "IntPtr".
1546;;
Devang Patele4b27562009-08-28 23:24:31 +00001547!2 = metadata !{
Devang Patel4b945502010-03-09 00:44:10 +00001548 i32 524310, ;; Tag
Devang Patele4b27562009-08-28 23:24:31 +00001549 metadata !1, ;; Context
1550 metadata !"IntPtr", ;; Name
Devang Patel4b945502010-03-09 00:44:10 +00001551 metadata !3, ;; File
Devang Patele4b27562009-08-28 23:24:31 +00001552 i32 0, ;; Line number
1553 i64 0, ;; Size in bits
1554 i64 0, ;; Align in bits
1555 i64 0, ;; Offset in bits
1556 i32 0, ;; Flags
1557 metadata !4 ;; Derived From type
1558}
Jim Laskeycec12a52006-03-14 18:08:46 +00001559
1560;;
1561;; Define the pointer type.
1562;;
Devang Patele4b27562009-08-28 23:24:31 +00001563!4 = metadata !{
Devang Patel4b945502010-03-09 00:44:10 +00001564 i32 524303, ;; Tag
Devang Patele4b27562009-08-28 23:24:31 +00001565 metadata !1, ;; Context
1566 metadata !"", ;; Name
Devang Patel4b945502010-03-09 00:44:10 +00001567 metadata !1, ;; File
Devang Patele4b27562009-08-28 23:24:31 +00001568 i32 0, ;; Line number
1569 i64 64, ;; Size in bits
1570 i64 64, ;; Align in bits
1571 i64 0, ;; Offset in bits
1572 i32 0, ;; Flags
1573 metadata !5 ;; Derived From type
1574}
Jim Laskeycec12a52006-03-14 18:08:46 +00001575;;
1576;; Define the const type.
1577;;
Devang Patele4b27562009-08-28 23:24:31 +00001578!5 = metadata !{
Devang Patel4b945502010-03-09 00:44:10 +00001579 i32 524326, ;; Tag
Devang Patele4b27562009-08-28 23:24:31 +00001580 metadata !1, ;; Context
1581 metadata !"", ;; Name
Devang Patel4b945502010-03-09 00:44:10 +00001582 metadata !1, ;; File
Devang Patele4b27562009-08-28 23:24:31 +00001583 i32 0, ;; Line number
1584 i64 32, ;; Size in bits
1585 i64 32, ;; Align in bits
1586 i64 0, ;; Offset in bits
1587 i32 0, ;; Flags
1588 metadata !6 ;; Derived From type
1589}
Jim Laskeycec12a52006-03-14 18:08:46 +00001590;;
1591;; Define the int type.
1592;;
Devang Patele4b27562009-08-28 23:24:31 +00001593!6 = metadata !{
Devang Patel4b945502010-03-09 00:44:10 +00001594 i32 524324, ;; Tag
Devang Patele4b27562009-08-28 23:24:31 +00001595 metadata !1, ;; Context
1596 metadata !"int", ;; Name
Devang Patel4b945502010-03-09 00:44:10 +00001597 metadata !1, ;; File
Devang Patele4b27562009-08-28 23:24:31 +00001598 i32 0, ;; Line number
1599 i64 32, ;; Size in bits
1600 i64 32, ;; Align in bits
1601 i64 0, ;; Offset in bits
1602 i32 0, ;; Flags
1603 5 ;; Encoding
1604}
Jim Laskeycec12a52006-03-14 18:08:46 +00001605</pre>
Bill Wendling48839d92009-05-17 05:52:39 +00001606</div>
Jim Laskeycec12a52006-03-14 18:08:46 +00001607
1608</div>
1609
1610<!-- ======================================================================= -->
NAKAMURA Takumi05d02652011-04-18 23:59:50 +00001611<h3>
Jim Laskeycec12a52006-03-14 18:08:46 +00001612 <a name="ccxx_composite_types">C/C++ struct/union types</a>
NAKAMURA Takumi05d02652011-04-18 23:59:50 +00001613</h3>
Jim Laskeycec12a52006-03-14 18:08:46 +00001614
NAKAMURA Takumif5af6ad2011-04-23 00:30:22 +00001615<div>
Jim Laskeycec12a52006-03-14 18:08:46 +00001616
Misha Brukman96e00812008-12-16 02:54:22 +00001617<p>Given the following as an example of C/C++ struct type:</p>
Jim Laskeycec12a52006-03-14 18:08:46 +00001618
Bill Wendling48839d92009-05-17 05:52:39 +00001619<div class="doc_code">
Jim Laskeycec12a52006-03-14 18:08:46 +00001620<pre>
1621struct Color {
1622 unsigned Red;
1623 unsigned Green;
1624 unsigned Blue;
1625};
1626</pre>
Bill Wendling48839d92009-05-17 05:52:39 +00001627</div>
Jim Laskeycec12a52006-03-14 18:08:46 +00001628
Misha Brukman96e00812008-12-16 02:54:22 +00001629<p>a C/C++ front-end would generate the following descriptors:</p>
Jim Laskeycec12a52006-03-14 18:08:46 +00001630
Bill Wendling48839d92009-05-17 05:52:39 +00001631<div class="doc_code">
Jim Laskeycec12a52006-03-14 18:08:46 +00001632<pre>
1633;;
1634;; Define basic type for unsigned int.
1635;;
Devang Patele4b27562009-08-28 23:24:31 +00001636!5 = metadata !{
Devang Patel4b945502010-03-09 00:44:10 +00001637 i32 524324, ;; Tag
Devang Patele4b27562009-08-28 23:24:31 +00001638 metadata !1, ;; Context
1639 metadata !"unsigned int",
Devang Patel4b945502010-03-09 00:44:10 +00001640 metadata !1, ;; File
Devang Patele4b27562009-08-28 23:24:31 +00001641 i32 0, ;; Line number
1642 i64 32, ;; Size in Bits
1643 i64 32, ;; Align in Bits
1644 i64 0, ;; Offset in Bits
1645 i32 0, ;; Flags
1646 i32 7 ;; Encoding
1647}
Jim Laskeycec12a52006-03-14 18:08:46 +00001648;;
1649;; Define composite type for struct Color.
1650;;
Devang Patele4b27562009-08-28 23:24:31 +00001651!2 = metadata !{
Devang Patel4b945502010-03-09 00:44:10 +00001652 i32 524307, ;; Tag
Devang Patele4b27562009-08-28 23:24:31 +00001653 metadata !1, ;; Context
1654 metadata !"Color", ;; Name
1655 metadata !1, ;; Compile unit
1656 i32 1, ;; Line number
1657 i64 96, ;; Size in bits
1658 i64 32, ;; Align in bits
1659 i64 0, ;; Offset in bits
1660 i32 0, ;; Flags
1661 null, ;; Derived From
1662 metadata !3, ;; Elements
1663 i32 0 ;; Runtime Language
1664}
Jim Laskeycec12a52006-03-14 18:08:46 +00001665
1666;;
1667;; Define the Red field.
1668;;
Devang Patele4b27562009-08-28 23:24:31 +00001669!4 = metadata !{
Devang Patel4b945502010-03-09 00:44:10 +00001670 i32 524301, ;; Tag
Devang Patele4b27562009-08-28 23:24:31 +00001671 metadata !1, ;; Context
1672 metadata !"Red", ;; Name
Devang Patel4b945502010-03-09 00:44:10 +00001673 metadata !1, ;; File
Devang Patele4b27562009-08-28 23:24:31 +00001674 i32 2, ;; Line number
1675 i64 32, ;; Size in bits
1676 i64 32, ;; Align in bits
1677 i64 0, ;; Offset in bits
1678 i32 0, ;; Flags
1679 metadata !5 ;; Derived From type
1680}
Jim Laskeycec12a52006-03-14 18:08:46 +00001681
1682;;
1683;; Define the Green field.
1684;;
Devang Patele4b27562009-08-28 23:24:31 +00001685!6 = metadata !{
Devang Patel4b945502010-03-09 00:44:10 +00001686 i32 524301, ;; Tag
Devang Patele4b27562009-08-28 23:24:31 +00001687 metadata !1, ;; Context
1688 metadata !"Green", ;; Name
Devang Patel4b945502010-03-09 00:44:10 +00001689 metadata !1, ;; File
Devang Patele4b27562009-08-28 23:24:31 +00001690 i32 3, ;; Line number
1691 i64 32, ;; Size in bits
1692 i64 32, ;; Align in bits
1693 i64 32, ;; Offset in bits
1694 i32 0, ;; Flags
1695 metadata !5 ;; Derived From type
1696}
Jim Laskeycec12a52006-03-14 18:08:46 +00001697
1698;;
1699;; Define the Blue field.
1700;;
Devang Patele4b27562009-08-28 23:24:31 +00001701!7 = metadata !{
Devang Patel4b945502010-03-09 00:44:10 +00001702 i32 524301, ;; Tag
Devang Patele4b27562009-08-28 23:24:31 +00001703 metadata !1, ;; Context
1704 metadata !"Blue", ;; Name
Devang Patel4b945502010-03-09 00:44:10 +00001705 metadata !1, ;; File
Devang Patele4b27562009-08-28 23:24:31 +00001706 i32 4, ;; Line number
1707 i64 32, ;; Size in bits
1708 i64 32, ;; Align in bits
1709 i64 64, ;; Offset in bits
1710 i32 0, ;; Flags
1711 metadata !5 ;; Derived From type
1712}
Jim Laskeycec12a52006-03-14 18:08:46 +00001713
1714;;
1715;; Define the array of fields used by the composite type Color.
1716;;
Devang Patele4b27562009-08-28 23:24:31 +00001717!3 = metadata !{metadata !4, metadata !6, metadata !7}
Jim Laskeycec12a52006-03-14 18:08:46 +00001718</pre>
Bill Wendling48839d92009-05-17 05:52:39 +00001719</div>
Jim Laskeycec12a52006-03-14 18:08:46 +00001720
1721</div>
1722
1723<!-- ======================================================================= -->
NAKAMURA Takumi05d02652011-04-18 23:59:50 +00001724<h3>
Jim Laskeycec12a52006-03-14 18:08:46 +00001725 <a name="ccxx_enumeration_types">C/C++ enumeration types</a>
NAKAMURA Takumi05d02652011-04-18 23:59:50 +00001726</h3>
Jim Laskeycec12a52006-03-14 18:08:46 +00001727
NAKAMURA Takumif5af6ad2011-04-23 00:30:22 +00001728<div>
Jim Laskeycec12a52006-03-14 18:08:46 +00001729
Misha Brukman96e00812008-12-16 02:54:22 +00001730<p>Given the following as an example of C/C++ enumeration type:</p>
Jim Laskeycec12a52006-03-14 18:08:46 +00001731
Bill Wendling48839d92009-05-17 05:52:39 +00001732<div class="doc_code">
Jim Laskeycec12a52006-03-14 18:08:46 +00001733<pre>
1734enum Trees {
1735 Spruce = 100,
1736 Oak = 200,
1737 Maple = 300
1738};
1739</pre>
Bill Wendling48839d92009-05-17 05:52:39 +00001740</div>
Jim Laskeycec12a52006-03-14 18:08:46 +00001741
Misha Brukman96e00812008-12-16 02:54:22 +00001742<p>a C/C++ front-end would generate the following descriptors:</p>
Jim Laskeycec12a52006-03-14 18:08:46 +00001743
Bill Wendling48839d92009-05-17 05:52:39 +00001744<div class="doc_code">
Jim Laskeycec12a52006-03-14 18:08:46 +00001745<pre>
1746;;
1747;; Define composite type for enum Trees
1748;;
Devang Patele4b27562009-08-28 23:24:31 +00001749!2 = metadata !{
Devang Patel4b945502010-03-09 00:44:10 +00001750 i32 524292, ;; Tag
Devang Patele4b27562009-08-28 23:24:31 +00001751 metadata !1, ;; Context
1752 metadata !"Trees", ;; Name
Devang Patel4b945502010-03-09 00:44:10 +00001753 metadata !1, ;; File
Devang Patele4b27562009-08-28 23:24:31 +00001754 i32 1, ;; Line number
1755 i64 32, ;; Size in bits
1756 i64 32, ;; Align in bits
1757 i64 0, ;; Offset in bits
1758 i32 0, ;; Flags
1759 null, ;; Derived From type
1760 metadata !3, ;; Elements
1761 i32 0 ;; Runtime language
1762}
Devang Patel2a610c72009-08-25 05:24:07 +00001763
Devang Patel82459882009-08-26 05:01:18 +00001764;;
1765;; Define the array of enumerators used by composite type Trees.
1766;;
Devang Patele4b27562009-08-28 23:24:31 +00001767!3 = metadata !{metadata !4, metadata !5, metadata !6}
1768
1769;;
1770;; Define Spruce enumerator.
1771;;
Devang Patel4b945502010-03-09 00:44:10 +00001772!4 = metadata !{i32 524328, metadata !"Spruce", i64 100}
Devang Patele4b27562009-08-28 23:24:31 +00001773
1774;;
1775;; Define Oak enumerator.
1776;;
Devang Patel4b945502010-03-09 00:44:10 +00001777!5 = metadata !{i32 524328, metadata !"Oak", i64 200}
Devang Patele4b27562009-08-28 23:24:31 +00001778
1779;;
1780;; Define Maple enumerator.
1781;;
Devang Patel4b945502010-03-09 00:44:10 +00001782!6 = metadata !{i32 524328, metadata !"Maple", i64 300}
Devang Patele4b27562009-08-28 23:24:31 +00001783
Jim Laskeycec12a52006-03-14 18:08:46 +00001784</pre>
Bill Wendling48839d92009-05-17 05:52:39 +00001785</div>
Jim Laskeycec12a52006-03-14 18:08:46 +00001786
1787</div>
Chris Lattnerbdfb3392004-01-05 05:06:33 +00001788
NAKAMURA Takumif5af6ad2011-04-23 00:30:22 +00001789</div>
1790
Chris Lattnerbdfb3392004-01-05 05:06:33 +00001791<!-- *********************************************************************** -->
Misha Brukman82873732004-05-12 19:21:57 +00001792
Chris Lattnerbdfb3392004-01-05 05:06:33 +00001793<hr>
Misha Brukman82873732004-05-12 19:21:57 +00001794<address>
1795 <a href="http://jigsaw.w3.org/css-validator/check/referer"><img
Misha Brukman44408702008-12-11 17:34:48 +00001796 src="http://jigsaw.w3.org/css-validator/images/vcss-blue" alt="Valid CSS"></a>
Misha Brukman82873732004-05-12 19:21:57 +00001797 <a href="http://validator.w3.org/check/referer"><img
Misha Brukman44408702008-12-11 17:34:48 +00001798 src="http://www.w3.org/Icons/valid-html401-blue" alt="Valid HTML 4.01"></a>
Misha Brukman82873732004-05-12 19:21:57 +00001799
1800 <a href="mailto:sabre@nondot.org">Chris Lattner</a><br>
NAKAMURA Takumib9a33632011-04-09 02:13:37 +00001801 <a href="http://llvm.org/">LLVM Compiler Infrastructure</a><br>
Chris Lattnerbdfb3392004-01-05 05:06:33 +00001802 Last modified: $Date$
Misha Brukman82873732004-05-12 19:21:57 +00001803</address>
Chris Lattnerbdfb3392004-01-05 05:06:33 +00001804
1805</body>
1806</html>