diff options
Diffstat (limited to 'docs')
44 files changed, 1140 insertions, 365 deletions
diff --git a/docs/AdvancedGetElementPtr.html b/docs/AdvancedGetElementPtr.html new file mode 100644 index 0000000..1d37278 --- /dev/null +++ b/docs/AdvancedGetElementPtr.html @@ -0,0 +1,362 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" + "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> + <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> + <title>The Revenge Of The Often Misunderstood GEP Instruction</title> + <link rel="stylesheet" href="llvm.css" type="text/css"> + <style type="text/css"> + TABLE { text-align: left; border: 1px solid black; border-collapse: collapse; margin: 0 0 0 0; } + </style> +</head> +<body> + +<div class="doc_title"> + The Revenge Of The Often Misunderstood GEP Instruction +</div> + +<!-- *********************************************************************** --> +<div class="doc_section"><a name="intro"><b>Introduction</b></a></div> +<!-- *********************************************************************** --> +<div class="doc_text"> + <p>GEP was mysterious and wily at first, but it turned out that the basic + workings were fairly comprehensible. However the dragon was merely subdued; + now it's back, and it has more fundamental complexity to confront. This + document seeks to uncover misunderstandings of the GEP operator that tend + to persist past initial confusion about the funky "extra 0" thing. Here we + show that the GEP instruction is really not quite as simple as it seems, + even after the initial confusion is overcome.</p> +</div> + +<!-- *********************************************************************** --> +<div class="doc_subsection"> + <a name="lead0"><b>How is GEP different from ptrtoint, arithmetic, + and inttoptr?</b></a> +</div> +<div class="doc_text"> + <p>It's very similar; there are only subtle differences.</p> + + <p>With ptrtoint, you have to pick an integer type. One approach is to pick i64; + this is safe on everything LLVM supports (LLVM internally assumes pointers + are never wider than 64 bits in many places), and the optimizer will actually + narrow the i64 arithmetic down to the actual pointer size on targets which + don't support 64-bit arithmetic in most cases. However, there are some cases + where it doesn't do this. With GEP you can avoid this problem. + + <p>Also, GEP carries additional pointer aliasing rules. It's invalid to take a + GEP from one object, address into a different separately allocated + object, and dereference it. IR producers (front-ends) must follow this rule, + and consumers (optimizers, specifically alias analysis) benefit from being + able to rely on it.</p> + + <p>And, GEP is more concise in common cases.</p> + + <p>However, for the underlying integer computation implied, there + is no difference.</p> + +</div> + +<!-- *********************************************************************** --> +<div class="doc_subsection"> + <a name="lead0"><b>I'm writing a backend for a target which needs custom + lowering for GEP. How do I do this?</b></a> +</div> +<div class="doc_text"> + <p>You don't. The integer computation implied by a GEP is target-independent. + Typically what you'll need to do is make your backend pattern-match + expressions trees involving ADD, MUL, etc., which are what GEP is lowered + into. This has the advantage of letting your code work correctly in more + cases.</p> + + <p>GEP does use target-dependent parameters for the size and layout of data + types, which targets can customize.</p> + + <p>If you require support for addressing units which are not 8 bits, you'll + need to fix a lot of code in the backend, with GEP lowering being only a + small piece of the overall picture.</p> + +</div> + +<!-- *********************************************************************** --> +<div class="doc_subsection"> + <a name="lead0"><b>Why do struct member indices always use i32?</b></a> +</div> +<div class="doc_text"> + <p>The specific type i32 is probably just a historical artifact, however it's + wide enough for all practical purposes, so there's been no need to change it. + It doesn't necessarily imply i32 address arithmetic; it's just an identifier + which identifies a field in a struct. Requiring that all struct indices be + the same reduces the range of possibilities for cases where two GEPs are + effectively the same but have distinct operand types.</p> + +</div> + +<!-- *********************************************************************** --> +<div class="doc_subsection"> + <a name="lead0"><b>How does VLA addressing work with GEPs?</b></a> +</div> +<div class="doc_text"> + <p>GEPs don't natively support VLAs. LLVM's type system is entirely static, + and GEP address computations are guided by an LLVM type.</p> + + <p>VLA indices can be implemented as linearized indices. For example, an + expression like X[a][b][c], must be effectively lowered into a form + like X[a*m+b*n+c], so that it appears to the GEP as a single-dimensional + array reference.</p> + + <p>This means if you want to write an analysis which understands array + indices and you want to support VLAs, your code will have to be + prepared to reverse-engineer the linearization. One way to solve this + problem is to use the ScalarEvolution library, which always presents + VLA and non-VLA indexing in the same manner.</p> + +</div> + +<!-- *********************************************************************** --> +<div class="doc_subsection"> + <a name="lead0"><b>What happens if an array index is out of bounds?</b></a> +</div> +<div class="doc_text"> + <p>There are two senses in which an array index can be out of bounds.</p> + + <p>First, there's the array type which comes from the (static) type of + the first operand to the GEP. Indices greater than the number of elements + in the corresponding static array type are valid. There is no problem with + out of bounds indices in this sense. Indexing into an array only depends + on the size of the array element, not the number of elements.</p> + + <p>A common example of how this is used is arrays where the size is not known. + It's common to use array types with zero length to represent these. The + fact that the static type says there are zero elements is irrelevant; it's + perfectly valid to compute arbitrary element indices, as the computation + only depends on the size of the array element, not the number of + elements. Note that zero-sized arrays are not a special case here.</p> + + <p>This sense is unconnected with <tt>inbounds</tt> keyword. The + <tt>inbounds</tt> keyword is designed to describe low-level pointer + arithmetic overflow conditions, rather than high-level array + indexing rules. + + <p>Analysis passes which wish to understand array indexing should not + assume that the static array type bounds are respected.</p> + + <p>The second sense of being out of bounds is computing an address that's + beyond the actual underlying allocated object.</p> + + <p>With the <tt>inbounds</tt> keyword, the result value of the GEP is + undefined if the address is outside the actual underlying allocated + object and not the address one-past-the-end.</p> + + <p>Without the <tt>inbounds</tt> keyword, there are no restrictions + on computing out-of-bounds addresses. Obviously, performing a load or + a store requires an address of allocated and sufficiently aligned + memory. But the GEP itself is only concerned with computing addresses.</p> + +</div> + +<!-- *********************************************************************** --> +<div class="doc_subsection"> + <a name="lead0"><b>Can array indices be negative?</b></a> +</div> +<div class="doc_text"> + <p>Yes. This is basically a special case of array indices being out + of bounds.</p> + +</div> + +<!-- *********************************************************************** --> +<div class="doc_subsection"> + <a name="lead0"><b>Can I compare two values computed with GEPs?</b></a> +</div> +<div class="doc_text"> + <p>Yes. If both addresses are within the same allocated object, or + one-past-the-end, you'll get the comparison result you expect. If either + is outside of it, integer arithmetic wrapping may occur, so the + comparison may not be meaningful.</p> + +</div> + +<!-- *********************************************************************** --> +<div class="doc_subsection"> + <a name="lead0"><b>Can I do GEP with a different pointer type than the type of + the underlying object?</b></a> +</div> +<div class="doc_text"> + <p>Yes. There are no restrictions on bitcasting a pointer value to an arbitrary + pointer type. The types in a GEP serve only to define the parameters for the + underlying integer computation. They need not correspond with the actual + type of the underlying object.</p> + + <p>Furthermore, loads and stores don't have to use the same types as the type + of the underlying object. Types in this context serve only to specify + memory size and alignment. Beyond that there are merely a hint to the + optimizer indicating how the value will likely be used.</p> + +</div> + +<!-- *********************************************************************** --> +<div class="doc_subsection"> + <a name="lead0"><b>Can I cast an object's address to integer and add it + to null?</b></a> +</div> +<div class="doc_text"> + <p>You can compute an address that way, but if you use GEP to do the add, + you can't use that pointer to actually access the object, unless the + object is managed outside of LLVM.</p> + + <p>The underlying integer computation is sufficiently defined; null has a + defined value -- zero -- and you can add whatever value you want to it.</p> + + <p>However, it's invalid to access (load from or store to) an LLVM-aware + object with such a pointer. This includes GlobalVariables, Allocas, and + objects pointed to by noalias pointers.</p> + + <p>If you really need this functionality, you can do the arithmetic with + explicit integer instructions, and use inttoptr to convert the result to + an address. Most of GEP's special aliasing rules do not apply to pointers + computed from ptrtoint, arithmetic, and inttoptr sequences.</p> + +</div> + +<!-- *********************************************************************** --> +<div class="doc_subsection"> + <a name="lead0"><b>Can I compute the distance between two objects, and add + that value to one address to compute the other address?</b></a> +</div> +<div class="doc_text"> + <p>As with arithmetic on null, You can use GEP to compute an address that + way, but you can't use that pointer to actually access the object if you + do, unless the object is managed outside of LLVM.</p> + + <p>Also as above, ptrtoint and inttoptr provide an alternative way to do this + which do not have this restriction.</p> + +</div> + +<!-- *********************************************************************** --> +<div class="doc_subsection"> + <a name="lead0"><b>Can I do type-based alias analysis on LLVM IR?</b></a> +</div> +<div class="doc_text"> + <p>You can't do type-based alias analysis using LLVM's built-in type system, + because LLVM has no restrictions on mixing types in addressing, loads or + stores.</p> + + <p>It would be possible to add special annotations to the IR, probably using + metadata, to describe a different type system (such as the C type system), + and do type-based aliasing on top of that. This is a much bigger + undertaking though.</p> + +</div> + +<!-- *********************************************************************** --> + +<div class="doc_subsection"> + <a name="lead0"><b>What's an uglygep?</b></a> +</div> +<div class="doc_text"> + <p>Some LLVM optimizers operate on GEPs by internally lowering them into + more primitive integer expressions, which allows them to be combined + with other integer expressions and/or split into multiple separate + integer expressions. If they've made non-trivial changes, translating + back into LLVM IR can involve reverse-engineering the structure of + the addressing in order to fit it into the static type of the original + first operand. It isn't always possibly to fully reconstruct this + structure; sometimes the underlying addressing doesn't correspond with + the static type at all. In such cases the optimizer instead will emit + a GEP with the base pointer casted to a simple address-unit pointer, + using the name "uglygep". This isn't pretty, but it's just as + valid, and it's sufficient to preserve the pointer aliasing guarantees + that GEP provides.</p> + +</div> + +<!-- *********************************************************************** --> + +<div class="doc_subsection"> + <a name="lead0"><b>Can GEP index into vector elements?</b></a> +</div> +<div class="doc_text"> + <p>Sort of. This hasn't always been forcefully disallowed, though it's + not recommended. It leads to awkward special cases in the optimizers. + In the future, it may be outright disallowed.</p> + + <p>Instead, you should cast your pointer types and use arrays instead of + vectors for addressing. Arrays have the same in-memory representation + as vectors, so the addressing is interchangeable.</p> + +</div> + +<!-- *********************************************************************** --> + +<div class="doc_subsection"> + <a name="lead0"><b>Can GEP index into unions?</b></a> +</div> +<div class="doc_text"> + <p>Unknown.</p> + +</div> + +<!-- *********************************************************************** --> + +<div class="doc_subsection"> + <a name="lead0"><b>What happens if a GEP computation overflows?</b></a> +</div> +<div class="doc_text"> + <p>If the GEP has the <tt>inbounds</tt> keyword, the result value is + undefined.</p> + + <p>Otherwise, the result value is the result from evaluating the implied + two's complement integer computation. However, since there's no + guarantee of where an object will be allocated in the address space, + such values have limited meaning.</p> + +</div> + +<!-- *********************************************************************** --> + +<div class="doc_subsection"> + <a name="lead0"><b>What effect do address spaces have on GEPs?</b></a> +</div> +<div class="doc_text"> + <p>None, except that the address space qualifier on the first operand pointer + type always matches the address space qualifier on the result type.</p> + +</div> + +<!-- *********************************************************************** --> + +<div class="doc_subsection"> + <a name="lead0"><b>Why is GEP designed this way?</b></a> +</div> +<div class="doc_text"> + <p>The design of GEP has the following goals, in rough unofficial + order of priority:</p> + <ul> + <li>Support C, C-like languages, and languages which can be + conceptually lowered into C (this covers a lot).</li> + <li>Support optimizations such as those that are common in + C compilers.</li> + <li>Provide a consistent method for computing addresses so that + address computations don't need to be a part of load and + store instructions in the IR.</li> + <li>Support non-C-like languages, to the extent that it doesn't + interfere with other goals.</li> + <li>Minimize target-specific information in the IR.</li> + </ul> +</div> + +<!-- *********************************************************************** --> + +<hr> +<address> + <a href="http://jigsaw.w3.org/css-validator/check/referer"><img + src="http://jigsaw.w3.org/css-validator/images/vcss-blue" alt="Valid CSS"></a> + <a href="http://validator.w3.org/check/referer"><img + src="http://www.w3.org/Icons/valid-html401-blue" alt="Valid HTML 4.01"></a> + <a href="http://llvm.org">The LLVM Compiler Infrastructure</a><br/> + Last modified: $Date: 2010-02-18 19:40:29 +0100 (Thu, 18 Feb 2010) $ +</address> +</body> +</html> + diff --git a/docs/AliasAnalysis.html b/docs/AliasAnalysis.html index 6903ede..ef0f414 100644 --- a/docs/AliasAnalysis.html +++ b/docs/AliasAnalysis.html @@ -403,7 +403,7 @@ implementing, you just override the interfaces you can improve.</p> href="#basic-aa">basicaa</a></tt> and <a href="#no-aa"><tt>no-aa</tt></a> passes) every alias analysis pass chains to another alias analysis implementation (for example, the user can specify "<tt>-basicaa -ds-aa --anders-aa -licm</tt>" to get the maximum benefit from the three alias +-licm</tt>" to get the maximum benefit from both alias analyses). The alias analysis class automatically takes care of most of this for methods that you don't override. For methods that you do override, in code paths that return a conservative MayAlias or Mod/Ref result, simply return @@ -705,25 +705,6 @@ non-address taken globals), but is very quick analysis.</p> <!-- _______________________________________________________________________ --> <div class="doc_subsubsection"> - <a name="anders-aa">The <tt>-anders-aa</tt> pass</a> -</div> - -<div class="doc_text"> - -<p>The <tt>-anders-aa</tt> pass implements the well-known "Andersen's algorithm" -for interprocedural alias analysis. This algorithm is a subset-based, -flow-insensitive, context-insensitive, and field-insensitive alias analysis that -is widely believed to be fairly precise. Unfortunately, this algorithm is also -O(N<sup>3</sup>). The LLVM implementation currently does not implement any of -the refinements (such as "online cycle elimination" or "offline variable -substitution") to improve its efficiency, so it can be quite slow in common -cases. -</p> - -</div> - -<!-- _______________________________________________________________________ --> -<div class="doc_subsubsection"> <a name="steens-aa">The <tt>-steens-aa</tt> pass</a> </div> @@ -855,7 +836,7 @@ pointer.</p> <div class="doc_text"> <p>These passes are useful for evaluating the various alias analysis -implementations. You can use them with commands like '<tt>opt -anders-aa -ds-aa +implementations. You can use them with commands like '<tt>opt -ds-aa -aa-eval foo.bc -disable-output -stats</tt>'.</p> </div> @@ -949,7 +930,7 @@ analysis directly.</p> <a href="mailto:sabre@nondot.org">Chris Lattner</a><br> <a href="http://llvm.org">LLVM Compiler Infrastructure</a><br> - Last modified: $Date: 2009-11-22 17:01:44 +0100 (Sun, 22 Nov 2009) $ + Last modified: $Date: 2010-03-01 20:24:17 +0100 (Mon, 01 Mar 2010) $ </address> </body> diff --git a/docs/CodeGenerator.html b/docs/CodeGenerator.html index 2eb7abc..ad6222d 100644 --- a/docs/CodeGenerator.html +++ b/docs/CodeGenerator.html @@ -1041,9 +1041,9 @@ ret <div class="doc_code"> <pre> -%t1 = add float %W, %X -%t2 = mul float %t1, %Y -%t3 = add float %t2, %Z +%t1 = fadd float %W, %X +%t2 = fmul float %t1, %Y +%t3 = fadd float %t2, %Z </pre> </div> @@ -2116,7 +2116,7 @@ MOVSX32rm16 -> movsx, 32-bit register, 16-bit memory <a href="mailto:sabre@nondot.org">Chris Lattner</a><br> <a href="http://llvm.org">The LLVM Compiler Infrastructure</a><br> - Last modified: $Date: 2010-01-11 19:53:47 +0100 (Mon, 11 Jan 2010) $ + Last modified: $Date: 2010-03-02 02:11:08 +0100 (Tue, 02 Mar 2010) $ </address> </body> diff --git a/docs/CodingStandards.html b/docs/CodingStandards.html index f93e1ea..8dc5678 100644 --- a/docs/CodingStandards.html +++ b/docs/CodingStandards.html @@ -194,9 +194,9 @@ something sane goes a long ways towards avoiding writing documentation.</p> <b>Method information</b> <p>Methods defined in a class (as well as any global functions) should also be -documented properly. A quick note about what it does any a description of the +documented properly. A quick note about what it does and a description of the borderline behaviour is all that is necessary here (unless something -particularly tricky or insideous is going on). The hope is that people can +particularly tricky or insidious is going on). The hope is that people can figure out how to use your interfaces without reading the code itself... that is the goal metric.</p> @@ -1346,7 +1346,7 @@ something.</p> <a href="mailto:sabre@nondot.org">Chris Lattner</a><br> <a href="http://llvm.org">LLVM Compiler Infrastructure</a><br> - Last modified: $Date: 2009-10-12 16:46:08 +0200 (Mon, 12 Oct 2009) $ + Last modified: $Date: 2010-02-26 21:18:32 +0100 (Fri, 26 Feb 2010) $ </address> </body> diff --git a/docs/CommandGuide/FileCheck.pod b/docs/CommandGuide/FileCheck.pod index 32516ad..433979a 100644 --- a/docs/CommandGuide/FileCheck.pod +++ b/docs/CommandGuide/FileCheck.pod @@ -25,7 +25,7 @@ match. The file to verify is always read from standard input. =over -=item B<--help> +=item B<-help> Print a summary of command line options. diff --git a/docs/CommandGuide/bugpoint.pod b/docs/CommandGuide/bugpoint.pod index 204ea4d..7afeea1 100644 --- a/docs/CommandGuide/bugpoint.pod +++ b/docs/CommandGuide/bugpoint.pod @@ -85,7 +85,7 @@ mis-management. Continually randomize the specified passes and run them on the test program until a bug is found or the user kills B<bugpoint>. -=item B<--help> +=item B<-help> Print a summary of command line options. @@ -99,9 +99,9 @@ it runs, to come from that file. Load the dynamic object F<plugin> into B<bugpoint> itself. This object should register new optimization passes. Once loaded, the object will add new command line options to enable various optimizations. To see the new complete list of -optimizations, use the B<--help> and B<--load> options together; for example: +optimizations, use the B<-help> and B<--load> options together; for example: - bugpoint --load myNewPass.so --help + bugpoint --load myNewPass.so -help =item B<--mlimit> F<megabytes> diff --git a/docs/CommandGuide/index.html b/docs/CommandGuide/index.html index 14635dd..d0212b9 100644 --- a/docs/CommandGuide/index.html +++ b/docs/CommandGuide/index.html @@ -17,7 +17,7 @@ for all of the LLVM tools. These pages describe how to use the LLVM commands and what their options are. Note that these pages do not describe all of the options available for all tools. To get a complete listing, pass the -<tt>--help</tt> (general options) or <tt>--help-hidden</tt> (general+debugging +<tt>-help</tt> (general options) or <tt>-help-hidden</tt> (general+debugging options) arguments to the tool you are interested in.</p> </div> @@ -148,7 +148,7 @@ options) arguments to the tool you are interested in.</p> src="http://www.w3.org/Icons/valid-html401-blue" alt="Valid HTML 4.01"></a> <a href="http://llvm.org">LLVM Compiler Infrastructure</a><br> - Last modified: $Date: 2009-10-19 05:54:13 +0200 (Mon, 19 Oct 2009) $ + Last modified: $Date: 2010-02-18 15:08:13 +0100 (Thu, 18 Feb 2010) $ </address> </body> diff --git a/docs/CommandGuide/llc.pod b/docs/CommandGuide/llc.pod index 8adfb68..ac24aab 100644 --- a/docs/CommandGuide/llc.pod +++ b/docs/CommandGuide/llc.pod @@ -38,7 +38,7 @@ Other B<llc> options are as follows: =over -=item B<--help> +=item B<-help> Print a summary of command line options. @@ -56,7 +56,7 @@ string. =item B<-march>=I<arch> Specify the architecture for which to generate assembly, overriding the target -encoded in the input file. See the output of B<llc --help> for a list of +encoded in the input file. See the output of B<llc -help> for a list of valid architectures. By default this is inferred from the target triple or autodetected to the current architecture. diff --git a/docs/CommandGuide/lli.pod b/docs/CommandGuide/lli.pod index e9fdf74..6d1e1c6 100644 --- a/docs/CommandGuide/lli.pod +++ b/docs/CommandGuide/lli.pod @@ -73,7 +73,7 @@ architecture which is not compatible with the current system. =item B<-march>=I<arch> Specify the architecture for which to generate assembly, overriding the target -encoded in the bitcode file. See the output of B<llc --help> for a list of +encoded in the bitcode file. See the output of B<llc -help> for a list of valid architectures. By default this is inferred from the target triple or autodetected to the current architecture. @@ -170,7 +170,7 @@ Instruction schedulers available (before register allocation): =item B<-regalloc>=I<allocator> -Register allocator to use: (default = linearscan) +Register allocator to use (default=linearscan) =bigblock: Big-block register allocator =linearscan: linear scan register allocator =local - local register allocator @@ -186,7 +186,7 @@ Choose relocation model from: =item B<-spiller> -Spiller to use: (default: local) +Spiller to use (default=local) =simple: simple spiller =local: local spiller diff --git a/docs/CommandGuide/llvm-as.pod b/docs/CommandGuide/llvm-as.pod index 045a924..185c009 100644 --- a/docs/CommandGuide/llvm-as.pod +++ b/docs/CommandGuide/llvm-as.pod @@ -50,7 +50,7 @@ Enable binary output on terminals. Normally, B<llvm-as> will refuse to write raw bitcode output if the output stream is a terminal. With this option, B<llvm-as> will write raw bitcode regardless of the output device. -=item B<--help> +=item B<-help> Print a summary of command line options. diff --git a/docs/CommandGuide/llvm-bcanalyzer.pod b/docs/CommandGuide/llvm-bcanalyzer.pod index f60b513..b0bc0cd 100644 --- a/docs/CommandGuide/llvm-bcanalyzer.pod +++ b/docs/CommandGuide/llvm-bcanalyzer.pod @@ -43,7 +43,7 @@ Causes B<llvm-bcanalyzer> to verify the module produced by reading the bitcode. This ensures that the statistics generated are based on a consistent module. -=item B<--help> +=item B<-help> Print a summary of command line options. diff --git a/docs/CommandGuide/llvm-config.pod b/docs/CommandGuide/llvm-config.pod index 06f10de..4e38dae 100644 --- a/docs/CommandGuide/llvm-config.pod +++ b/docs/CommandGuide/llvm-config.pod @@ -30,7 +30,7 @@ To link against the JIT: Print the version number of LLVM. -=item B<--help> +=item B<-help> Print a summary of B<llvm-config> arguments. diff --git a/docs/CommandGuide/llvm-dis.pod b/docs/CommandGuide/llvm-dis.pod index 2b83290..5b2f4ef 100644 --- a/docs/CommandGuide/llvm-dis.pod +++ b/docs/CommandGuide/llvm-dis.pod @@ -33,7 +33,7 @@ Enable binary output on terminals. Normally, B<llvm-dis> will refuse to write raw bitcode output if the output stream is a terminal. With this option, B<llvm-dis> will write raw bitcode regardless of the output device. -=item B<--help> +=item B<-help> Print a summary of command line options. diff --git a/docs/CommandGuide/llvm-extract.pod b/docs/CommandGuide/llvm-extract.pod index 02f38ad..d4baab7 100644 --- a/docs/CommandGuide/llvm-extract.pod +++ b/docs/CommandGuide/llvm-extract.pod @@ -42,7 +42,7 @@ specified multiple times to extract multiple functions at once. Extract the global variable named I<global-name> from the LLVM bitcode. May be specified multiple times to extract multiple global variables at once. -=item B<--help> +=item B<-help> Print a summary of command line options. diff --git a/docs/CommandGuide/llvm-link.pod b/docs/CommandGuide/llvm-link.pod index e1a1267..8d06cc9 100644 --- a/docs/CommandGuide/llvm-link.pod +++ b/docs/CommandGuide/llvm-link.pod @@ -51,7 +51,7 @@ Write output in LLVM intermediate language (instead of bitcode). If specified, B<llvm-link> prints a human-readable version of the output bitcode file to standard error. -=item B<--help> +=item B<-help> Print a summary of command line options. diff --git a/docs/CommandGuide/llvm-nm.pod b/docs/CommandGuide/llvm-nm.pod index 995ac08..a580d3f 100644 --- a/docs/CommandGuide/llvm-nm.pod +++ b/docs/CommandGuide/llvm-nm.pod @@ -77,7 +77,7 @@ Use POSIX.2 output format. Alias for B<--format=posix>. Use BSD output format. Alias for B<--format=bsd>. -=item B<--help> +=item B<-help> Print a summary of command-line options and their meanings. diff --git a/docs/CommandGuide/llvm-prof.pod b/docs/CommandGuide/llvm-prof.pod index 381387d..9541b05 100644 --- a/docs/CommandGuide/llvm-prof.pod +++ b/docs/CommandGuide/llvm-prof.pod @@ -18,7 +18,7 @@ where the program hotspots are. This program is often used in conjunction with the F<utils/profile.pl> script. This script automatically instruments a program, runs it with the JIT, then runs B<llvm-prof> to format a report. To get more information about -F<utils/profile.pl>, execute it with the B<--help> option. +F<utils/profile.pl>, execute it with the B<-help> option. =head1 OPTIONS diff --git a/docs/CommandGuide/llvm-ranlib.pod b/docs/CommandGuide/llvm-ranlib.pod index 130edb0..53cd34b 100644 --- a/docs/CommandGuide/llvm-ranlib.pod +++ b/docs/CommandGuide/llvm-ranlib.pod @@ -6,7 +6,7 @@ llvm-ranlib - Generate index for LLVM archive =head1 SYNOPSIS -B<llvm-ranlib> [--version] [--help] <archive-file> +B<llvm-ranlib> [--version] [-help] <archive-file> =head1 DESCRIPTION @@ -30,7 +30,7 @@ Specifies the archive-file to which the symbol table is added or updated. Print the version of B<llvm-ranlib> and exit without building a symbol table. -=item F<--help> +=item F<-help> Print usage help for B<llvm-ranlib> and exit without building a symbol table. diff --git a/docs/CommandGuide/llvmc.pod b/docs/CommandGuide/llvmc.pod index e5e0651..d237ca4 100644 --- a/docs/CommandGuide/llvmc.pod +++ b/docs/CommandGuide/llvmc.pod @@ -77,11 +77,11 @@ Store temporary files in the given directory. This directory is deleted on exit unless I<--save-temps> is specified. If I<--save-temps=obj> is also specified, I<--temp-dir> is given the precedence. -=item B<--help> +=item B<-help> Print a summary of command-line options and exit. -=item B<--help-hidden> +=item B<-help-hidden> Print a summary of command-line options and exit. Print help even for options intended for developers. diff --git a/docs/CommandGuide/tblgen.pod b/docs/CommandGuide/tblgen.pod index c8244af..d127492 100644 --- a/docs/CommandGuide/tblgen.pod +++ b/docs/CommandGuide/tblgen.pod @@ -26,7 +26,7 @@ to read as input. =over -=item B<--help> +=item B<-help> Print a summary of command line options. diff --git a/docs/CommandLine.html b/docs/CommandLine.html index 7e6e2f2..092fd2b 100644 --- a/docs/CommandLine.html +++ b/docs/CommandLine.html @@ -44,7 +44,7 @@ <li><a href="#modifiers">Option Modifiers</a> <ul> - <li><a href="#hiding">Hiding an option from <tt>--help</tt> + <li><a href="#hiding">Hiding an option from <tt>-help</tt> output</a></li> <li><a href="#numoccurrences">Controlling the number of occurrences required and allowed</a></li> @@ -161,7 +161,7 @@ you declare it. <a href="#customparser">Custom parsers</a> are no problem.</li> <li>Labor Saving: The CommandLine library cuts down on the amount of grunt work that you, the user, have to do. For example, it automatically provides a -<tt>--help</tt> option that shows the available command line options for your +<tt>-help</tt> option that shows the available command line options for your tool. Additionally, it does most of the basic correctness checking for you.</li> @@ -239,14 +239,14 @@ href="#list">"<tt>cl::list</tt> template</a>), and tell the CommandLine library that the data type that we are parsing is a string.</p> <p>The second and third parameters (which are optional) are used to specify what -to output for the "<tt>--help</tt>" option. In this case, we get a line that +to output for the "<tt>-help</tt>" option. In this case, we get a line that looks like this:</p> <div class="doc_code"><pre> USAGE: compiler [options] OPTIONS: - -help - display available options (--help-hidden for more) + -help - display available options (-help-hidden for more) <b>-o <filename> - Specify output filename</b> </pre></div> @@ -308,14 +308,14 @@ the CommandLine library will automatically issue an error if the argument is not specified, which shifts all of the command line option verification code out of your application into the library. This is just one example of how using flags can alter the default behaviour of the library, on a per-option basis. By -adding one of the declarations above, the <tt>--help</tt> option synopsis is now +adding one of the declarations above, the <tt>-help</tt> option synopsis is now extended to:</p> <div class="doc_code"><pre> USAGE: compiler [options] <b><input file></b> OPTIONS: - -help - display available options (--help-hidden for more) + -help - display available options (-help-hidden for more) -o <filename> - Specify output filename </pre></div> @@ -346,8 +346,8 @@ declaring options of boolean type like this:</p> ("<tt>Force</tt>", "<tt>Quiet</tt>", and "<tt>Quiet2</tt>") to recognize these options. Note that the "<tt>-q</tt>" option is specified with the "<a href="#cl::Hidden"><tt>cl::Hidden</tt></a>" flag. This modifier prevents it -from being shown by the standard "<tt>--help</tt>" output (note that it is still -shown in the "<tt>--help-hidden</tt>" output).</p> +from being shown by the standard "<tt>-help</tt>" output (note that it is still +shown in the "<tt>-help-hidden</tt>" output).</p> <p>The CommandLine library uses a <a href="#builtinparsers">different parser</a> for different data types. For example, in the string case, the argument passed @@ -372,7 +372,7 @@ href="#doubleparser">double</a>, and <a href="#intparser">int</a> parsers work like you would expect, using the '<tt>strtol</tt>' and '<tt>strtod</tt>' C library calls to parse the string value into the specified data type.</p> -<p>With the declarations above, "<tt>compiler --help</tt>" emits this:</p> +<p>With the declarations above, "<tt>compiler -help</tt>" emits this:</p> <div class="doc_code"><pre> USAGE: compiler [options] <input file> @@ -381,10 +381,10 @@ OPTIONS: <b>-f - Enable binary output on terminals</b> -o - Override output filename <b>-quiet - Don't print informational messages</b> - -help - display available options (--help-hidden for more) + -help - display available options (-help-hidden for more) </pre></div> -<p>and "<tt>compiler --help-hidden</tt>" prints this:</p> +<p>and "<tt>compiler -help-hidden</tt>" prints this:</p> <div class="doc_code"><pre> USAGE: compiler [options] <input file> @@ -394,7 +394,7 @@ OPTIONS: -o - Override output filename <b>-q - Don't print informational messages</b> -quiet - Don't print informational messages - -help - display available options (--help-hidden for more) + -help - display available options (-help-hidden for more) </pre></div> <p>This brief example has shown you how to use the '<tt><a @@ -438,7 +438,7 @@ the <tt><a href="#cl::aliasopt">cl::aliasopt</a></tt> modifier) whenever it is specified. Because aliases do not hold state, the only thing the program has to query is the <tt>Quiet</tt> variable now. Another nice feature of aliases is that they automatically hide themselves from the <tt>-help</tt> output -(although, again, they are still visible in the <tt>--help-hidden +(although, again, they are still visible in the <tt>-help-hidden output</tt>).</p> <p>Now the application code can simply use:</p> @@ -531,7 +531,7 @@ OPTIONS: -O2 - Enable default optimizations -O3 - Enable expensive optimizations</b> -f - Enable binary output on terminals - -help - display available options (--help-hidden for more) + -help - display available options (-help-hidden for more) -o <filename> - Specify output filename -quiet - Don't print informational messages </pre></div> @@ -599,7 +599,7 @@ enum DebugLev { <p>This definition defines an enumerated command line variable of type "<tt>enum DebugLev</tt>", which works exactly the same way as before. The difference here is just the interface exposed to the user of your program and the help output by -the "<tt>--help</tt>" option:</p> +the "<tt>-help</tt>" option:</p> <div class="doc_code"><pre> USAGE: compiler [options] <input file> @@ -615,7 +615,7 @@ OPTIONS: =quick - enable quick debug information =detailed - enable detailed debug information</b> -f - Enable binary output on terminals - -help - display available options (--help-hidden for more) + -help - display available options (-help-hidden for more) -o <filename> - Specify output filename -quiet - Don't print informational messages </pre></div> @@ -706,7 +706,7 @@ checking we have to do.</p> <div class="doc_text"> <p>Instead of collecting sets of options in a list, it is also possible to -gather information for enum values in a <b>bit vector</b>. The represention used by +gather information for enum values in a <b>bit vector</b>. The representation used by the <a href="#bits"><tt>cl::bits</tt></a> class is an <tt>unsigned</tt> integer. An enum value is represented by a 0/1 in the enum's ordinal value bit position. 1 indicating that the enum was specified, 0 otherwise. As each @@ -794,7 +794,7 @@ USAGE: compiler [options] <input file> OPTIONS: ... - -help - display available options (--help-hidden for more) + -help - display available options (-help-hidden for more) -o <filename> - Specify output filename </pre></div> @@ -835,14 +835,14 @@ Using the CommandLine library, this would be specified as:</p> <a href="#cl::opt">cl::opt</a><string> Filename(<a href="#cl::Positional">cl::Positional</a>, <a href="#cl::desc">cl::desc</a>("<i><input file></i>"), <a href="#cl::init">cl::init</a>("<i>-</i>")); </pre></div> -<p>Given these two option declarations, the <tt>--help</tt> output for our grep +<p>Given these two option declarations, the <tt>-help</tt> output for our grep replacement would look like this:</p> <div class="doc_code"><pre> USAGE: spiffygrep [options] <b><regular expression> <input file></b> OPTIONS: - -help - display available options (--help-hidden for more) + -help - display available options (-help-hidden for more) </pre></div> <p>... and the resultant program could be used just like the standard @@ -872,7 +872,7 @@ Note that the system <tt>grep</tt> has the same problem:</p> <div class="doc_code"><pre> $ spiffygrep '-foo' test.txt - Unknown command line argument '-foo'. Try: spiffygrep --help' + Unknown command line argument '-foo'. Try: spiffygrep -help' $ grep '-foo' test.txt grep: illegal option -- f @@ -986,7 +986,7 @@ shell itself. Using the CommandLine library, we would specify this as:</p> USAGE: spiffysh [options] <b><input script> <program arguments>...</b> OPTIONS: - -help - display available options (--help-hidden for more) + -help - display available options (-help-hidden for more) <b>-x - Enable trace output</b> </pre></div> @@ -1098,11 +1098,11 @@ This option is specified in simple double quotes: </li> <li><a name="cl::desc">The <b><tt>cl::desc</tt></b></a> attribute specifies a -description for the option to be shown in the <tt>--help</tt> output for the +description for the option to be shown in the <tt>-help</tt> output for the program.</li> <li><a name="cl::value_desc">The <b><tt>cl::value_desc</tt></b></a> attribute -specifies a string that can be used to fine tune the <tt>--help</tt> output for +specifies a string that can be used to fine tune the <tt>-help</tt> output for a command line option. Look <a href="#value_desc_example">here</a> for an example.</li> @@ -1130,7 +1130,7 @@ the string-to-value mapping to be used by the generic parser. It takes a <b>clEnumValEnd terminated</b> list of (option, value, description) triplets that specify the option name, the value mapped to, and the description shown in the -<tt>--help</tt> for the tool. Because the generic parser is used most +<tt>-help</tt> for the tool. Because the generic parser is used most frequently with enum values, two macros are often useful: <ol> @@ -1175,13 +1175,13 @@ obviously).</li> <p>Option modifiers are the flags and expressions that you pass into the constructors for <tt><a href="#cl::opt">cl::opt</a></tt> and <tt><a href="#cl::list">cl::list</a></tt>. These modifiers give you the ability to -tweak how options are parsed and how <tt>--help</tt> output is generated to fit +tweak how options are parsed and how <tt>-help</tt> output is generated to fit your application well.</p> <p>These options fall into five main categories:</p> <ol> -<li><a href="#hiding">Hiding an option from <tt>--help</tt> output</a></li> +<li><a href="#hiding">Hiding an option from <tt>-help</tt> output</a></li> <li><a href="#numoccurrences">Controlling the number of occurrences required and allowed</a></li> <li><a href="#valrequired">Controlling whether or not a value must be @@ -1200,14 +1200,14 @@ usually shouldn't have to worry about these.</p> <!-- _______________________________________________________________________ --> <div class="doc_subsubsection"> - <a name="hiding">Hiding an option from <tt>--help</tt> output</a> + <a name="hiding">Hiding an option from <tt>-help</tt> output</a> </div> <div class="doc_text"> <p>The <tt>cl::NotHidden</tt>, <tt>cl::Hidden</tt>, and <tt>cl::ReallyHidden</tt> modifiers are used to control whether or not an option -appears in the <tt>--help</tt> and <tt>--help-hidden</tt> output for the +appears in the <tt>-help</tt> and <tt>-help-hidden</tt> output for the compiled program:</p> <ul> @@ -1219,8 +1219,8 @@ in both help listings.</li> <li><a name="cl::Hidden">The <b><tt>cl::Hidden</tt></b></a> modifier (which is the default for <tt><a href="#cl::alias">cl::alias</a></tt> options) indicates that -the option should not appear in the <tt>--help</tt> output, but should appear in -the <tt>--help-hidden</tt> output.</li> +the option should not appear in the <tt>-help</tt> output, but should appear in +the <tt>-help-hidden</tt> output.</li> <li><a name="cl::ReallyHidden">The <b><tt>cl::ReallyHidden</tt></b></a> modifier indicates that the option should not appear in any help output.</li> @@ -1508,7 +1508,7 @@ available.</p> <p>The <tt>cl::ParseCommandLineOptions</tt> function requires two parameters (<tt>argc</tt> and <tt>argv</tt>), but may also take an optional third parameter which holds <a href="#description">additional extra text</a> to emit when the -<tt>--help</tt> option is invoked, and a fourth boolean parameter that enables +<tt>-help</tt> option is invoked, and a fourth boolean parameter that enables <a href="#response">response files</a>.</p> </div> @@ -1535,7 +1535,7 @@ does.</p> not be available, it can't just look in <tt>argv[0]</tt>), the name of the environment variable to examine, the optional <a href="#description">additional extra text</a> to emit when the -<tt>--help</tt> option is invoked, and the boolean +<tt>-help</tt> option is invoked, and the boolean switch that controls whether <a href="#response">response files</a> should be read.</p> @@ -1689,7 +1689,7 @@ the conversion from string to data.</p> <div class="doc_text"> <p>The <tt>cl::extrahelp</tt> class is a nontemplated class that allows extra -help text to be printed out for the <tt>--help</tt> option.</p> +help text to be printed out for the <tt>-help</tt> option.</p> <div class="doc_code"><pre> <b>namespace</b> cl { @@ -1906,7 +1906,7 @@ MFS(<i>"max-file-size"</i>, <a href="#cl::desc">cl::desc</a>(<i>"Maximum file si <div class="doc_code"><pre> OPTIONS: - -help - display available options (--help-hidden for more) + -help - display available options (-help-hidden for more) ... <b>-max-file-size=<size> - Maximum file size to accept</b> </pre></div> @@ -1972,7 +1972,7 @@ tutorial.</p> <a href="mailto:sabre@nondot.org">Chris Lattner</a><br> <a href="http://llvm.org">LLVM Compiler Infrastructure</a><br> - Last modified: $Date: 2009-10-12 16:46:08 +0200 (Mon, 12 Oct 2009) $ + Last modified: $Date: 2010-02-26 21:18:32 +0100 (Fri, 26 Feb 2010) $ </address> </body> diff --git a/docs/CompilerDriver.html b/docs/CompilerDriver.html index b69b8c9..a0eed43 100644 --- a/docs/CompilerDriver.html +++ b/docs/CompilerDriver.html @@ -132,7 +132,7 @@ directory with the compilation graph description in Graphviz format (identical to the file used by the <tt class="docutils literal"><span class="pre">--view-graph</span></tt> option). The <tt class="docutils literal"><span class="pre">-o</span></tt> option can be used to set the output file name. Hidden option, useful for debugging LLVMC plugins.</li> -<li><tt class="docutils literal"><span class="pre">--help</span></tt>, <tt class="docutils literal"><span class="pre">--help-hidden</span></tt>, <tt class="docutils literal"><span class="pre">--version</span></tt> - These options have +<li><tt class="docutils literal"><span class="pre">-help</span></tt>, <tt class="docutils literal"><span class="pre">-help-hidden</span></tt>, <tt class="docutils literal"><span class="pre">--version</span></tt> - These options have their standard meaning.</li> </ul> </div> @@ -325,7 +325,7 @@ aliased option name. Usage example: <tt class="docutils literal"><span class="pr <li><p class="first">Possible option properties:</p> <blockquote> <ul class="simple"> -<li><tt class="docutils literal"><span class="pre">help</span></tt> - help string associated with this option. Used for <tt class="docutils literal"><span class="pre">--help</span></tt> +<li><tt class="docutils literal"><span class="pre">help</span></tt> - help string associated with this option. Used for <tt class="docutils literal"><span class="pre">-help</span></tt> output.</li> <li><tt class="docutils literal"><span class="pre">required</span></tt> - this option must be specified exactly once (or, in case of the list options without the <tt class="docutils literal"><span class="pre">multi_val</span></tt> property, at least @@ -338,7 +338,7 @@ it is synonymous with <tt class="docutils literal"><span class="pre">required</s for list options in conjunction with <tt class="docutils literal"><span class="pre">multi_val</span></tt>. Incompatible with <tt class="docutils literal"><span class="pre">required</span></tt> and <tt class="docutils literal"><span class="pre">one_or_more</span></tt>.</li> <li><tt class="docutils literal"><span class="pre">hidden</span></tt> - the description of this option will not appear in -the <tt class="docutils literal"><span class="pre">--help</span></tt> output (but will appear in the <tt class="docutils literal"><span class="pre">--help-hidden</span></tt> +the <tt class="docutils literal"><span class="pre">-help</span></tt> output (but will appear in the <tt class="docutils literal"><span class="pre">-help-hidden</span></tt> output).</li> <li><tt class="docutils literal"><span class="pre">really_hidden</span></tt> - the option will not be mentioned in any help output.</li> @@ -748,7 +748,7 @@ the <tt class="docutils literal"><span class="pre">Base</span></tt> plugin behav <a href="mailto:foldr@codedgers.com">Mikhail Glushenkov</a><br /> <a href="http://llvm.org">LLVM Compiler Infrastructure</a><br /> -Last modified: $Date: 2009-12-23 13:49:51 +0100 (Wed, 23 Dec 2009) $ +Last modified: $Date: 2010-02-18 15:08:13 +0100 (Thu, 18 Feb 2010) $ </address></div> </div> </div> diff --git a/docs/DeveloperPolicy.html b/docs/DeveloperPolicy.html index 4986606..1f9451d 100644 --- a/docs/DeveloperPolicy.html +++ b/docs/DeveloperPolicy.html @@ -520,7 +520,7 @@ Changes</a></div> <p>We intend to keep LLVM perpetually open source and to use a liberal open source license. The current license is the <a href="http://www.opensource.org/licenses/UoI-NCSA.php">University of - llinois/NCSA Open Source License</a>, which boils down to this:</p> + Illinois/NCSA Open Source License</a>, which boils down to this:</p> <ul> <li>You can freely distribute LLVM.</li> @@ -601,7 +601,7 @@ Changes</a></div> Written by the <a href="mailto:llvm-oversight@cs.uiuc.edu">LLVM Oversight Group</a><br> <a href="http://llvm.org">The LLVM Compiler Infrastructure</a><br> - Last modified: $Date: 2009-10-10 23:37:16 +0200 (Sat, 10 Oct 2009) $ + Last modified: $Date: 2010-02-26 21:18:32 +0100 (Fri, 26 Feb 2010) $ </address> </body> </html> diff --git a/docs/FAQ.html b/docs/FAQ.html index 0074638..31fc0c0 100644 --- a/docs/FAQ.html +++ b/docs/FAQ.html @@ -437,7 +437,7 @@ Stop. <div class="answer"> <p>The <tt>GNUmakefile</tt> in the top-level directory of LLVM-GCC is a special <tt>Makefile</tt> used by Apple to invoke the <tt>build_gcc</tt> script after - setting up a special environment. This has the unforunate side-effect that + setting up a special environment. This has the unfortunate side-effect that trying to build LLVM-GCC with srcdir == objdir in a "non-Apple way" invokes the <tt>GNUmakefile</tt> instead of <tt>Makefile</tt>. Because the environment isn't set up correctly to do this, the build fails.</p> @@ -931,7 +931,7 @@ F.i: src="http://www.w3.org/Icons/valid-html401-blue" alt="Valid HTML 4.01"></a> <a href="http://llvm.org">LLVM Compiler Infrastructure</a><br> - Last modified: $Date: 2009-10-12 16:46:08 +0200 (Mon, 12 Oct 2009) $ + Last modified: $Date: 2010-02-26 00:41:41 +0100 (Fri, 26 Feb 2010) $ </address> </body> diff --git a/docs/GetElementPtr.html b/docs/GetElementPtr.html index d5863e8..f6dd71f 100644 --- a/docs/GetElementPtr.html +++ b/docs/GetElementPtr.html @@ -17,7 +17,7 @@ <ol> <li><a href="#intro">Introduction</a></li> - <li><a href="#questions">The Questions</a> + <li><a href="#addresses">Address Computation</a> <ol> <li><a href="#extra_index">Why is the extra 0 index required?</a></li> <li><a href="#deref">What is dereferenced by GEP?</a></li> @@ -25,6 +25,30 @@ subsequent ones?</a></li> <li><a href="#lead0">Why don't GEP x,0,0,1 and GEP x,1 alias? </a></li> <li><a href="#trail0">Why do GEP x,1,0,0 and GEP x,1 alias? </a></li> + <li><a href="#vectors">Can GEP index into vector elements?</a> + <li><a href="#unions">Can GEP index into unions?</a> + <li><a href="#addrspace">What effect do address spaces have on GEPs?</a> + <li><a href="#int">How is GEP different from ptrtoint, arithmetic, and inttoptr?</a></li> + <li><a href="#be">I'm writing a backend for a target which needs custom lowering for GEP. How do I do this?</a> + <li><a href="#vla">How does VLA addressing work with GEPs?</a> + </ol></li> + <li><a href="#rules">Rules</a> + <ol> + <li><a href="#bounds">What happens if an array index is out of bounds?</a> + <li><a href="#negative">Can array indices be negative?</a> + <li><a href="#compare">Can I compare two values computed with GEPs?</a> + <li><a href="#types">Can I do GEP with a different pointer type than the type of the underlying object?</a> + <li><a href="#null">Can I cast an object's address to integer and add it to null?</a> + <li><a href="#ptrdiff">Can I compute the distance between two objects, and add that value to one address to compute the other address?</a> + <li><a href="#tbaa">Can I do type-based alias analysis on LLVM IR?</a> + <li><a href="#overflow">What happens if a GEP computation overflows?</a> + <li><a href="#check">How can I tell if my front-end is following the rules?</a> + </ol></li> + <li><a href="#rationale">Rationale</a> + <ol> + <li><a href="#goals">Why is GEP designed this way?</a></li> + <li><a href="#i32">Why do struct member indices always use i32?</a></li> + <li><a href="#uglygep">What's an uglygep?</a> </ol></li> <li><a href="#summary">Summary</a></li> </ol> @@ -37,9 +61,10 @@ <!-- *********************************************************************** --> <div class="doc_section"><a name="intro"><b>Introduction</b></a></div> <!-- *********************************************************************** --> + <div class="doc_text"> <p>This document seeks to dispel the mystery and confusion surrounding LLVM's - GetElementPtr (GEP) instruction. Questions about the wiley GEP instruction are + GetElementPtr (GEP) instruction. Questions about the wily GEP instruction are probably the most frequently occurring questions once a developer gets down to coding with LLVM. Here we lay out the sources of confusion and show that the GEP instruction is really quite simple. @@ -47,22 +72,14 @@ </div> <!-- *********************************************************************** --> -<div class="doc_section"><a name="questions"><b>The Questions</b></a></div> +<div class="doc_section"><a name="addresses"><b>Address Computation</b></a></div> <!-- *********************************************************************** --> <div class="doc_text"> <p>When people are first confronted with the GEP instruction, they tend to relate it to known concepts from other programming paradigms, most notably C - array indexing and field selection. However, GEP is a little different and - this leads to the following questions; all of which are answered in the - following sections.</p> - <ol> - <li><a href="#firstptr">What is the first index of the GEP instruction?</a> - </li> - <li><a href="#extra_index">Why is the extra 0 index required?</a></li> - <li><a href="#deref">What is dereferenced by GEP?</a></li> - <li><a href="#lead0">Why don't GEP x,0,0,1 and GEP x,1 alias? </a></li> - <li><a href="#trail0">Why do GEP x,1,0,0 and GEP x,1 alias? </a></li> - </ol> + array indexing and field selection. GEP closely resembles C array indexing + and field selection, however it's is a little different and this leads to + the following questions.</p> </div> <!-- *********************************************************************** --> @@ -85,7 +102,7 @@ X = &Foo->F; <p>it is natural to think that there is only one index, the selection of the field <tt>F</tt>. However, in this example, <tt>Foo</tt> is a pointer. That - pointer must be indexed explicitly in LLVM. C, on the other hand, indexs + pointer must be indexed explicitly in LLVM. C, on the other hand, indices through it transparently. To arrive at the same address location as the C code, you would provide the GEP instruction with two index operands. The first operand indexes through the pointer; the second operand indexes the @@ -155,7 +172,7 @@ entry: <div class="doc_code"> <pre> -%MyVar = unintialized global i32 +%MyVar = uninitialized global i32 ... %idx1 = getelementptr i32* %MyVar, i64 0 %idx2 = getelementptr i32* %MyVar, i64 1 @@ -210,7 +227,7 @@ idx3 = (char*) &MyVar + 8 field of the structure <tt>%MyStruct</tt>. When people first look at it, they wonder why the <tt>i64 0</tt> index is needed. However, a closer inspection of how globals and GEPs work reveals the need. Becoming aware of the following - facts will dispell the confusion:</p> + facts will dispel the confusion:</p> <ol> <li>The type of <tt>%MyStruct</tt> is <i>not</i> <tt>{ float*, i32 }</tt> but rather <tt>{ float*, i32 }*</tt>. That is, <tt>%MyStruct</tt> is a @@ -297,8 +314,8 @@ idx3 = (char*) &MyVar + 8 <div class="doc_code"> <pre> %MyVar = global { [10 x i32 ] } -%idx1 = getlementptr { [10 x i32 ] }* %MyVar, i64 0, i32 0, i64 1 -%idx2 = getlementptr { [10 x i32 ] }* %MyVar, i64 1 +%idx1 = getelementptr { [10 x i32 ] }* %MyVar, i64 0, i32 0, i64 1 +%idx2 = getelementptr { [10 x i32 ] }* %MyVar, i64 1 </pre> </div> @@ -326,8 +343,8 @@ idx3 = (char*) &MyVar + 8 <div class="doc_code"> <pre> %MyVar = global { [10 x i32 ] } -%idx1 = getlementptr { [10 x i32 ] }* %MyVar, i64 1, i32 0, i64 0 -%idx2 = getlementptr { [10 x i32 ] }* %MyVar, i64 1 +%idx1 = getelementptr { [10 x i32 ] }* %MyVar, i64 1, i32 0, i64 0 +%idx2 = getelementptr { [10 x i32 ] }* %MyVar, i64 1 </pre> </div> @@ -337,6 +354,352 @@ idx3 = (char*) &MyVar + 8 </div> <!-- *********************************************************************** --> + +<div class="doc_subsection"> + <a name="vectors"><b>Can GEP index into vector elements?</b></a> +</div> +<div class="doc_text"> + <p>This hasn't always been forcefully disallowed, though it's not recommended. + It leads to awkward special cases in the optimizers, and fundamental + inconsistency in the IR. In the future, it will probably be outright + disallowed.</p> + +</div> + +<!-- *********************************************************************** --> + +<div class="doc_subsection"> + <a name="unions"><b>Can GEP index into unions?</b></a> +</div> +<div class="doc_text"> + <p>Unknown.</p> + +</div> + +<!-- *********************************************************************** --> + +<div class="doc_subsection"> + <a name="addrspace"><b>What effect do address spaces have on GEPs?</b></a> +</div> +<div class="doc_text"> + <p>None, except that the address space qualifier on the first operand pointer + type always matches the address space qualifier on the result type.</p> + +</div> + +<!-- *********************************************************************** --> + +<div class="doc_subsection"> + <a name="int"><b>How is GEP different from ptrtoint, arithmetic, + and inttoptr?</b></a> +</div> +<div class="doc_text"> + <p>It's very similar; there are only subtle differences.</p> + + <p>With ptrtoint, you have to pick an integer type. One approach is to pick i64; + this is safe on everything LLVM supports (LLVM internally assumes pointers + are never wider than 64 bits in many places), and the optimizer will actually + narrow the i64 arithmetic down to the actual pointer size on targets which + don't support 64-bit arithmetic in most cases. However, there are some cases + where it doesn't do this. With GEP you can avoid this problem. + + <p>Also, GEP carries additional pointer aliasing rules. It's invalid to take a + GEP from one object, address into a different separately allocated + object, and dereference it. IR producers (front-ends) must follow this rule, + and consumers (optimizers, specifically alias analysis) benefit from being + able to rely on it. See the <a href="#rules">Rules</a> section for more + information.</p> + + <p>And, GEP is more concise in common cases.</p> + + <p>However, for the underlying integer computation implied, there + is no difference.</p> + +</div> + +<!-- *********************************************************************** --> + +<div class="doc_subsection"> + <a name="be"><b>I'm writing a backend for a target which needs custom + lowering for GEP. How do I do this?</b></a> +</div> +<div class="doc_text"> + <p>You don't. The integer computation implied by a GEP is target-independent. + Typically what you'll need to do is make your backend pattern-match + expressions trees involving ADD, MUL, etc., which are what GEP is lowered + into. This has the advantage of letting your code work correctly in more + cases.</p> + + <p>GEP does use target-dependent parameters for the size and layout of data + types, which targets can customize.</p> + + <p>If you require support for addressing units which are not 8 bits, you'll + need to fix a lot of code in the backend, with GEP lowering being only a + small piece of the overall picture.</p> + +</div> + +<!-- *********************************************************************** --> + +<div class="doc_subsection"> + <a name="vla"><b>How does VLA addressing work with GEPs?</b></a> +</div> +<div class="doc_text"> + <p>GEPs don't natively support VLAs. LLVM's type system is entirely static, + and GEP address computations are guided by an LLVM type.</p> + + <p>VLA indices can be implemented as linearized indices. For example, an + expression like X[a][b][c], must be effectively lowered into a form + like X[a*m+b*n+c], so that it appears to the GEP as a single-dimensional + array reference.</p> + + <p>This means if you want to write an analysis which understands array + indices and you want to support VLAs, your code will have to be + prepared to reverse-engineer the linearization. One way to solve this + problem is to use the ScalarEvolution library, which always presents + VLA and non-VLA indexing in the same manner.</p> +</div> + +<!-- *********************************************************************** --> +<div class="doc_section"><a name="rules"><b>Rules</b></a></div> +<!-- *********************************************************************** --> + +<!-- *********************************************************************** --> + +<div class="doc_subsection"> + <a name="bounds"><b>What happens if an array index is out of bounds?</b></a> +</div> +<div class="doc_text"> + <p>There are two senses in which an array index can be out of bounds.</p> + + <p>First, there's the array type which comes from the (static) type of + the first operand to the GEP. Indices greater than the number of elements + in the corresponding static array type are valid. There is no problem with + out of bounds indices in this sense. Indexing into an array only depends + on the size of the array element, not the number of elements.</p> + + <p>A common example of how this is used is arrays where the size is not known. + It's common to use array types with zero length to represent these. The + fact that the static type says there are zero elements is irrelevant; it's + perfectly valid to compute arbitrary element indices, as the computation + only depends on the size of the array element, not the number of + elements. Note that zero-sized arrays are not a special case here.</p> + + <p>This sense is unconnected with <tt>inbounds</tt> keyword. The + <tt>inbounds</tt> keyword is designed to describe low-level pointer + arithmetic overflow conditions, rather than high-level array + indexing rules. + + <p>Analysis passes which wish to understand array indexing should not + assume that the static array type bounds are respected.</p> + + <p>The second sense of being out of bounds is computing an address that's + beyond the actual underlying allocated object.</p> + + <p>With the <tt>inbounds</tt> keyword, the result value of the GEP is + undefined if the address is outside the actual underlying allocated + object and not the address one-past-the-end.</p> + + <p>Without the <tt>inbounds</tt> keyword, there are no restrictions + on computing out-of-bounds addresses. Obviously, performing a load or + a store requires an address of allocated and sufficiently aligned + memory. But the GEP itself is only concerned with computing addresses.</p> + +</div> + +<!-- *********************************************************************** --> +<div class="doc_subsection"> + <a name="negative"><b>Can array indices be negative?</b></a> +</div> +<div class="doc_text"> + <p>Yes. This is basically a special case of array indices being out + of bounds.</p> + +</div> + +<!-- *********************************************************************** --> +<div class="doc_subsection"> + <a name="compare"><b>Can I compare two values computed with GEPs?</b></a> +</div> +<div class="doc_text"> + <p>Yes. If both addresses are within the same allocated object, or + one-past-the-end, you'll get the comparison result you expect. If either + is outside of it, integer arithmetic wrapping may occur, so the + comparison may not be meaningful.</p> + +</div> + +<!-- *********************************************************************** --> +<div class="doc_subsection"> + <a name="types"><b>Can I do GEP with a different pointer type than the type of + the underlying object?</b></a> +</div> +<div class="doc_text"> + <p>Yes. There are no restrictions on bitcasting a pointer value to an arbitrary + pointer type. The types in a GEP serve only to define the parameters for the + underlying integer computation. They need not correspond with the actual + type of the underlying object.</p> + + <p>Furthermore, loads and stores don't have to use the same types as the type + of the underlying object. Types in this context serve only to specify + memory size and alignment. Beyond that there are merely a hint to the + optimizer indicating how the value will likely be used.</p> + +</div> + +<!-- *********************************************************************** --> +<div class="doc_subsection"> + <a name="null"><b>Can I cast an object's address to integer and add it + to null?</b></a> +</div> +<div class="doc_text"> + <p>You can compute an address that way, but if you use GEP to do the add, + you can't use that pointer to actually access the object, unless the + object is managed outside of LLVM.</p> + + <p>The underlying integer computation is sufficiently defined; null has a + defined value -- zero -- and you can add whatever value you want to it.</p> + + <p>However, it's invalid to access (load from or store to) an LLVM-aware + object with such a pointer. This includes GlobalVariables, Allocas, and + objects pointed to by noalias pointers.</p> + + <p>If you really need this functionality, you can do the arithmetic with + explicit integer instructions, and use inttoptr to convert the result to + an address. Most of GEP's special aliasing rules do not apply to pointers + computed from ptrtoint, arithmetic, and inttoptr sequences.</p> + +</div> + +<!-- *********************************************************************** --> +<div class="doc_subsection"> + <a name="ptrdiff"><b>Can I compute the distance between two objects, and add + that value to one address to compute the other address?</b></a> +</div> +<div class="doc_text"> + <p>As with arithmetic on null, You can use GEP to compute an address that + way, but you can't use that pointer to actually access the object if you + do, unless the object is managed outside of LLVM.</p> + + <p>Also as above, ptrtoint and inttoptr provide an alternative way to do this + which do not have this restriction.</p> + +</div> + +<!-- *********************************************************************** --> +<div class="doc_subsection"> + <a name="tbaa"><b>Can I do type-based alias analysis on LLVM IR?</b></a> +</div> +<div class="doc_text"> + <p>You can't do type-based alias analysis using LLVM's built-in type system, + because LLVM has no restrictions on mixing types in addressing, loads or + stores.</p> + + <p>It would be possible to add special annotations to the IR, probably using + metadata, to describe a different type system (such as the C type system), + and do type-based aliasing on top of that. This is a much bigger + undertaking though.</p> + +</div> + +<!-- *********************************************************************** --> + +<div class="doc_subsection"> + <a name="overflow"><b>What happens if a GEP computation overflows?</b></a> +</div> +<div class="doc_text"> + <p>If the GEP has the <tt>inbounds</tt> keyword, the result value is + undefined.</p> + + <p>Otherwise, the result value is the result from evaluating the implied + two's complement integer computation. However, since there's no + guarantee of where an object will be allocated in the address space, + such values have limited meaning.</p> + +</div> + +<!-- *********************************************************************** --> + +<div class="doc_subsection"> + <a name="check"><b>How can I tell if my front-end is following the + rules?</b></a> +</div> +<div class="doc_text"> + <p>There is currently no checker for the getelementptr rules. Currently, + the only way to do this is to manually check each place in your front-end + where GetElementPtr operators are created.</p> + + <p>It's not possible to write a checker which could find all rule + violations statically. It would be possible to write a checker which + works by instrumenting the code with dynamic checks though. Alternatively, + it would be possible to write a static checker which catches a subset of + possible problems. However, no such checker exists today.</p> + +</div> + +<!-- *********************************************************************** --> +<div class="doc_section"><a name="rationale"><b>Rationale</b></a></div> +<!-- *********************************************************************** --> + +<!-- *********************************************************************** --> + +<div class="doc_subsection"> + <a name="goals"><b>Why is GEP designed this way?</b></a> +</div> +<div class="doc_text"> + <p>The design of GEP has the following goals, in rough unofficial + order of priority:</p> + <ul> + <li>Support C, C-like languages, and languages which can be + conceptually lowered into C (this covers a lot).</li> + <li>Support optimizations such as those that are common in + C compilers.</li> + <li>Provide a consistent method for computing addresses so that + address computations don't need to be a part of load and + store instructions in the IR.</li> + <li>Support non-C-like languages, to the extent that it doesn't + interfere with other goals.</li> + <li>Minimize target-specific information in the IR.</li> + </ul> +</div> + +<!-- *********************************************************************** --> +<div class="doc_subsection"> + <a name="i32"><b>Why do struct member indices always use i32?</b></a> +</div> +<div class="doc_text"> + <p>The specific type i32 is probably just a historical artifact, however it's + wide enough for all practical purposes, so there's been no need to change it. + It doesn't necessarily imply i32 address arithmetic; it's just an identifier + which identifies a field in a struct. Requiring that all struct indices be + the same reduces the range of possibilities for cases where two GEPs are + effectively the same but have distinct operand types.</p> + +</div> + +<!-- *********************************************************************** --> + +<div class="doc_subsection"> + <a name="uglygep"><b>What's an uglygep?</b></a> +</div> +<div class="doc_text"> + <p>Some LLVM optimizers operate on GEPs by internally lowering them into + more primitive integer expressions, which allows them to be combined + with other integer expressions and/or split into multiple separate + integer expressions. If they've made non-trivial changes, translating + back into LLVM IR can involve reverse-engineering the structure of + the addressing in order to fit it into the static type of the original + first operand. It isn't always possibly to fully reconstruct this + structure; sometimes the underlying addressing doesn't correspond with + the static type at all. In such cases the optimizer instead will emit + a GEP with the base pointer casted to a simple address-unit pointer, + using the name "uglygep". This isn't pretty, but it's just as + valid, and it's sufficient to preserve the pointer aliasing guarantees + that GEP provides.</p> + +</div> + +<!-- *********************************************************************** --> <div class="doc_section"><a name="summary"><b>Summary</b></a></div> <!-- *********************************************************************** --> @@ -365,7 +728,7 @@ idx3 = (char*) &MyVar + 8 <a href="http://validator.w3.org/check/referer"><img src="http://www.w3.org/Icons/valid-html401-blue" alt="Valid HTML 4.01"></a> <a href="http://llvm.org">The LLVM Compiler Infrastructure</a><br/> - Last modified: $Date: 2009-10-12 16:46:08 +0200 (Mon, 12 Oct 2009) $ + Last modified: $Date: 2010-02-25 19:16:03 +0100 (Thu, 25 Feb 2010) $ </address> </body> </html> diff --git a/docs/GettingStarted.html b/docs/GettingStarted.html index 44fbf21..d301e4c 100644 --- a/docs/GettingStarted.html +++ b/docs/GettingStarted.html @@ -1193,10 +1193,16 @@ $ ./hello.bc </div> <p> -This allows you to execute LLVM bitcode files directly. Thanks to Jack -Cummings for pointing this out! +This allows you to execute LLVM bitcode files directly. On Debian, you +can also use this command instead of the 'echo' command above:</p> </p> +<div class="doc_code"> +<pre> +$ sudo update-binfmts --install llvm /path/to/lli --magic 'BC' +</pre> +</div> + </div> <!-- *********************************************************************** --> @@ -1363,7 +1369,7 @@ end to compile.</p> <p>The <b>tools</b> directory contains the executables built out of the libraries above, which form the main part of the user interface. You can -always get help for a tool by typing <tt>tool_name --help</tt>. The +always get help for a tool by typing <tt>tool_name -help</tt>. The following is a brief introduction to the most important tools. More detailed information is in the <a href="CommandGuide/index.html">Command Guide</a>.</p> @@ -1434,7 +1440,7 @@ information is in the <a href="CommandGuide/index.html">Command Guide</a>.</p> <dt><tt><b>opt</b></tt></dt> <dd><tt>opt</tt> reads LLVM bitcode, applies a series of LLVM to LLVM transformations (which are specified on the command line), and then outputs - the resultant bitcode. The '<tt>opt --help</tt>' command is a good way to + the resultant bitcode. The '<tt>opt -help</tt>' command is a good way to get a list of the program transformations available in LLVM.<br> <dd><tt>opt</tt> can also be used to run a specific analysis on an input LLVM bitcode file and print out the results. It is primarily useful for @@ -1667,7 +1673,7 @@ out:</p> <a href="mailto:sabre@nondot.org">Chris Lattner</a><br> <a href="http://llvm.x10sys.com/rspencer/">Reid Spencer</a><br> <a href="http://llvm.org">The LLVM Compiler Infrastructure</a><br> - Last modified: $Date: 2010-02-11 22:51:51 +0100 (Thu, 11 Feb 2010) $ + Last modified: $Date: 2010-02-18 15:08:13 +0100 (Thu, 18 Feb 2010) $ </address> </body> </html> diff --git a/docs/LangRef.html b/docs/LangRef.html index b31d22f..f3f73fa 100644 --- a/docs/LangRef.html +++ b/docs/LangRef.html @@ -848,7 +848,7 @@ define i32 @main() { <i>; i32()* </i> <div class="doc_text"> -<p>LLVM function definitions consist of the "<tt>define</tt>" keyord, an +<p>LLVM function definitions consist of the "<tt>define</tt>" keyword, an optional <a href="#linkage">linkage type</a>, an optional <a href="#visibility">visibility style</a>, an optional <a href="#callingconv">calling convention</a>, a return type, an optional @@ -1277,7 +1277,7 @@ target datalayout = "<i>layout specification</i>" <ul> <li><tt>E</tt> - big endian</li> - <li><tt>p:32:64:64</tt> - 32-bit pointers with 64-bit alignment</li> + <li><tt>p:64:64:64</tt> - 64-bit pointers with 64-bit alignment</li> <li><tt>i1:8:8</tt> - i1 is 8-bit (byte) aligned</li> <li><tt>i8:8:8</tt> - i8 is 8-bit (byte) aligned</li> <li><tt>i16:16:16</tt> - i16 is 16-bit aligned</li> @@ -1664,7 +1664,7 @@ Classifications</a> </div> which indicates that the function takes a variable number of arguments. Variable argument functions can access their arguments with the <a href="#int_varargs">variable argument handling intrinsic</a> - functions. '<tt><returntype></tt>' is a any type except + functions. '<tt><returntype></tt>' is any type except <a href="#t_label">label</a>.</p> <h5>Examples:</h5> @@ -1674,12 +1674,11 @@ Classifications</a> </div> <td class="left">function taking an <tt>i32</tt>, returning an <tt>i32</tt> </td> </tr><tr class="layout"> - <td class="left"><tt>float (i16 signext, i32 *) * + <td class="left"><tt>float (i16, i32 *) * </tt></td> <td class="left"><a href="#t_pointer">Pointer</a> to a function that takes - an <tt>i16</tt> that should be sign extended and a - <a href="#t_pointer">pointer</a> to <tt>i32</tt>, returning - <tt>float</tt>. + an <tt>i16</tt> and a <a href="#t_pointer">pointer</a> to <tt>i32</tt>, + returning <tt>float</tt>. </td> </tr><tr class="layout"> <td class="left"><tt>i32 (i8*, ...)</tt></td> @@ -1792,7 +1791,7 @@ Classifications</a> </div> and the alignment requirements of the union as a whole will be the largest alignment requirement of any member.</p> -<p>Unions members are accessed using '<tt><a href="#i_load">load</a></tt> and +<p>Union members are accessed using '<tt><a href="#i_load">load</a></tt> and '<tt><a href="#i_store">store</a></tt>' by getting a pointer to a field with the '<tt><a href="#i_getelementptr">getelementptr</a></tt>' instruction. Since all members are at offset zero, the getelementptr instruction does @@ -1827,10 +1826,13 @@ Classifications</a> </div> <div class="doc_text"> <h5>Overview:</h5> -<p>As in many languages, the pointer type represents a pointer or reference to - another object, which must live in memory. Pointer types may have an optional - address space attribute defining the target-specific numbered address space - where the pointed-to object resides. The default address space is zero.</p> +<p>The pointer type is used to specify memory locations. + Pointers are commonly used to reference objects in memory.</p> + +<p>Pointer types may have an optional address space attribute defining the + numbered address space where the pointed-to object resides. The default + address space is number zero. The semantics of non-zero address + spaces are target-specific.</p> <p>Note that LLVM does not permit pointers to void (<tt>void*</tt>) nor does it permit pointers to labels (<tt>label*</tt>). Use <tt>i8*</tt> instead.</p> @@ -2885,9 +2887,10 @@ IfUnequal: function to be invoked. </li> <li>'<tt>function args</tt>': argument list whose types match the function - signature argument types. If the function signature indicates the - function accepts a variable number of arguments, the extra arguments can - be specified.</li> + signature argument types and parameter attributes. All arguments must be + of <a href="#t_firstclass">first class</a> type. If the function + signature indicates the function accepts a variable number of arguments, + the extra arguments can be specified.</li> <li>'<tt>normal label</tt>': the label reached when the called function executes a '<tt><a href="#i_ret">ret</a></tt>' instruction. </li> @@ -4074,8 +4077,9 @@ Instruction</a> </div> <h5>Syntax:</h5> <pre> - <result> = load <ty>* <pointer>[, align <alignment>] - <result> = volatile load <ty>* <pointer>[, align <alignment>] + <result> = load <ty>* <pointer>[, align <alignment>][, !nontemporal !<index>] + <result> = volatile load <ty>* <pointer>[, align <alignment>][, !nontemporal !<index>] + !<index> = !{ i32 1 } </pre> <h5>Overview:</h5> @@ -4088,16 +4092,24 @@ Instruction</a> </div> marked as <tt>volatile</tt>, then the optimizer is not allowed to modify the number or order of execution of this <tt>load</tt> with other volatile <tt>load</tt> and <tt><a href="#i_store">store</a></tt> - instructions. </p> + instructions.</p> -<p>The optional constant "align" argument specifies the alignment of the +<p>The optional constant <tt>align</tt> argument specifies the alignment of the operation (that is, the alignment of the memory address). A value of 0 or an - omitted "align" argument means that the operation has the preferential + omitted <tt>align</tt> argument means that the operation has the preferential alignment for the target. It is the responsibility of the code emitter to ensure that the alignment information is correct. Overestimating the - alignment results in an undefined behavior. Underestimating the alignment may + alignment results in undefined behavior. Underestimating the alignment may produce less efficient code. An alignment of 1 is always safe.</p> +<p>The optional <tt>!nontemporal</tt> metadata must reference a single + metatadata name <index> corresponding to a metadata node with + one <tt>i32</tt> entry of value 1. The existence of + the <tt>!nontemporal</tt> metatadata on the instruction tells the optimizer + and code generator that this load is not expected to be reused in the cache. + The code generator may select special instructions to save cache bandwidth, + such as the <tt>MOVNT</tt> instruction on x86.</p> + <h5>Semantics:</h5> <p>The location of memory pointed to is loaded. If the value being loaded is of scalar type then the number of bytes read does not exceed the minimum number @@ -4124,8 +4136,8 @@ Instruction</a> </div> <h5>Syntax:</h5> <pre> - store <ty> <value>, <ty>* <pointer>[, align <alignment>] <i>; yields {void}</i> - volatile store <ty> <value>, <ty>* <pointer>[, align <alignment>] <i>; yields {void}</i> + store <ty> <value>, <ty>* <pointer>[, align <alignment>][, !nontemporal !<index>] <i>; yields {void}</i> + volatile store <ty> <value>, <ty>* <pointer>[, align <alignment>][, !nontemporal !<index>] <i>; yields {void}</i> </pre> <h5>Overview:</h5> @@ -4150,6 +4162,15 @@ Instruction</a> </div> alignment results in an undefined behavior. Underestimating the alignment may produce less efficient code. An alignment of 1 is always safe.</p> +<p>The optional !nontemporal metadata must reference a single metatadata + name <index> corresponding to a metadata node with one i32 entry of + value 1. The existence of the !nontemporal metatadata on the + instruction tells the optimizer and code generator that this load is + not expected to be reused in the cache. The code generator may + select special instructions to save cache bandwidth, such as the + MOVNT instruction on x86.</p> + + <h5>Semantics:</h5> <p>The contents of memory are updated to contain '<tt><value></tt>' at the location specified by the '<tt><pointer></tt>' operand. If @@ -4943,7 +4964,7 @@ entry: <tt>op1</tt> is equal to <tt>op2</tt>.</li> <li><tt>ogt</tt>: yields <tt>true</tt> if both operands are not a QNAN and - <tt>op1</tt> is greather than <tt>op2</tt>.</li> + <tt>op1</tt> is greater than <tt>op2</tt>.</li> <li><tt>oge</tt>: yields <tt>true</tt> if both operands are not a QNAN and <tt>op1</tt> is greater than or equal to <tt>op2</tt>.</li> @@ -5119,7 +5140,7 @@ Loop: ; Infinite loop that counts from 0 on up... <li>The call is in tail position (ret immediately follows call and ret uses value of call or is void).</li> <li>Option <tt>-tailcallopt</tt> is enabled, - or <code>llvm::PerformTailCallOpt</code> is <code>true</code>.</li> + or <code>llvm::GuaranteedTailCallOpt</code> is <code>true</code>.</li> <li><a href="CodeGenerator.html#tailcallopt">Platform specific constraints are met.</a></li> </ul> @@ -5150,10 +5171,10 @@ Loop: ; Infinite loop that counts from 0 on up... to function value.</li> <li>'<tt>function args</tt>': argument list whose types match the function - signature argument types. All arguments must be of - <a href="#t_firstclass">first class</a> type. If the function signature - indicates the function accepts a variable number of arguments, the extra - arguments can be specified.</li> + signature argument types and parameter attributes. All arguments must be + of <a href="#t_firstclass">first class</a> type. If the function + signature indicates the function accepts a variable number of arguments, + the extra arguments can be specified.</li> <li>The optional <a href="#fnattrs">function attributes</a> list. Only '<tt>noreturn</tt>', '<tt>nounwind</tt>', '<tt>readonly</tt>' and @@ -5188,7 +5209,7 @@ Loop: ; Infinite loop that counts from 0 on up... standard C99 library as being the C99 library functions, and may perform optimizations or generate code for them under that assumption. This is something we'd like to change in the future to provide better support for -freestanding environments and non-C-based langauges.</p> +freestanding environments and non-C-based languages.</p> </div> @@ -5744,7 +5765,7 @@ LLVM</a>.</p> <h5>Semantics:</h5> <p>This intrinsic does not modify the behavior of the program. Backends that do - not support this intrinisic may ignore it.</p> + not support this intrinsic may ignore it.</p> </div> @@ -5824,7 +5845,7 @@ LLVM</a>.</p> number of bytes to copy, and the fourth argument is the alignment of the source and destination locations.</p> -<p>If the call to this intrinisic has an alignment value that is not 0 or 1, +<p>If the call to this intrinsic has an alignment value that is not 0 or 1, then the caller guarantees that both the source and destination pointers are aligned to that boundary.</p> @@ -5874,7 +5895,7 @@ LLVM</a>.</p> number of bytes to copy, and the fourth argument is the alignment of the source and destination locations.</p> -<p>If the call to this intrinisic has an alignment value that is not 0 or 1, +<p>If the call to this intrinsic has an alignment value that is not 0 or 1, then the caller guarantees that the source and destination pointers are aligned to that boundary.</p> @@ -5922,7 +5943,7 @@ LLVM</a>.</p> specifying the number of bytes to fill, and the fourth argument is the known alignment of destination location.</p> -<p>If the call to this intrinisic has an alignment value that is not 0 or 1, +<p>If the call to this intrinsic has an alignment value that is not 0 or 1, then the caller guarantees that the destination pointer is aligned to that boundary.</p> @@ -6693,7 +6714,7 @@ LLVM</a>.</p> <h5>Arguments:</h5> <p>The <tt>llvm.memory.barrier</tt> intrinsic requires five boolean arguments. The first four arguments enables a specific barrier as listed below. The - fith argument specifies that the barrier applies to io or device or uncached + fifth argument specifies that the barrier applies to io or device or uncached memory.</p> <ul> @@ -7432,7 +7453,7 @@ LLVM</a>.</p> <a href="mailto:sabre@nondot.org">Chris Lattner</a><br> <a href="http://llvm.org">The LLVM Compiler Infrastructure</a><br> - Last modified: $Date: 2010-02-12 21:49:41 +0100 (Fri, 12 Feb 2010) $ + Last modified: $Date: 2010-03-02 07:36:51 +0100 (Tue, 02 Mar 2010) $ </address> </body> diff --git a/docs/MakefileGuide.html b/docs/MakefileGuide.html index 36a4725..eb91a21 100644 --- a/docs/MakefileGuide.html +++ b/docs/MakefileGuide.html @@ -818,6 +818,10 @@ <tt>mklib</tt> by the <tt>configure</tt> script and always located in the <dt><a name="LLVMAS"><tt>LLVMAS</tt></a><small>(defaulted)</small></dt> <dd>Specifies the path to the <tt>llvm-as</tt> tool.</dd> + <dt><a name="LLVMCC"><tt>LLVMCC</tt></a></dt> + <dd>Specifies the path to the LLVM capable compiler.</dd> + <dt><a name="LLVMCXX"><tt>LLVMCXX</tt></a></dt> + <dd>Specifies the path to the LLVM C++ capable compiler.</dd> <dt><a name="LLVMGCC"><tt>LLVMGCC</tt></a><small>(defaulted)</small></dt> <dd>Specifies the path to the LLVM version of the GCC 'C' Compiler</dd> <dt><a name="LLVMGXX"><tt>LLVMGXX</tt></a><small>(defaulted)</small></dt> @@ -1021,7 +1025,7 @@ <a href="mailto:rspencer@x10sys.com">Reid Spencer</a><br> <a href="http://llvm.org">The LLVM Compiler Infrastructure</a><br> - Last modified: $Date: 2009-10-12 16:46:08 +0200 (Mon, 12 Oct 2009) $ + Last modified: $Date: 2010-02-23 11:00:53 +0100 (Tue, 23 Feb 2010) $ </address> </body> </html> diff --git a/docs/Packaging.html b/docs/Packaging.html new file mode 100644 index 0000000..678edb0 --- /dev/null +++ b/docs/Packaging.html @@ -0,0 +1,118 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" + "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> + <title>Advice on Packaging LLVM</title> + <link rel="stylesheet" href="llvm.css" type="text/css"> +</head> +<body> + +<div class="doc_title">Advice on Packaging LLVM</div> +<ol> + <li><a href="#overview">Overview</a></li> + <li><a href="#compilation">Compile Flags</a></li> + <li><a href="#cxx-features">C++ Features</a></li> + <li><a href="#shared-library">Shared Library</a></li> + <li><a href="#deps">Dependencies</a></li> +</ol> + +<!--=========================================================================--> +<div class="doc_section"><a name="overview">Overview</a></div> +<!--=========================================================================--> +<div class="doc_text"> + +<p>LLVM sets certain default configure options to make sure our developers don't +break things for constrained platforms. These settings are not optimal for most +desktop systems, and we hope that packagers (e.g., Redhat, Debian, MacPorts, +etc.) will tweak them. This document lists settings we suggest you tweak. +</p> + +<p>LLVM's API changes with each release, so users are likely to want, for +example, both LLVM-2.6 and LLVM-2.7 installed at the same time to support apps +developed against each. +</p> +</div> + +<!--=========================================================================--> +<div class="doc_section"><a name="compilation">Compile Flags</a></div> +<!--=========================================================================--> +<div class="doc_text"> + +<p>LLVM runs much more quickly when it's optimized and assertions are removed. +However, such a build is currently incompatible with users who build without +defining NDEBUG, and the lack of assertions makes it hard to debug problems in +user code. We recommend allowing users to install both optimized and debug +versions of LLVM in parallel. The following configure flags are relevant: +</p> + +<dl> + <dt><tt>--disable-assertions</tt></dt><dd>Builds LLVM with <tt>NDEBUG</tt> + defined. Changes the LLVM ABI. Also available by setting + <tt>DISABLE_ASSERTIONS=0|1</tt> in <tt>make</tt>'s environment. This defaults + to enabled regardless of the optimization setting, but it slows things + down.</dd> + + <dt><tt>--enable-debug-symbols</tt></dt><dd>Builds LLVM with <tt>-g</tt>. + Also available by setting <tt>DEBUG_SYMBOLS=0|1</tt> in <tt>make</tt>'s + environment. This defaults to disabled when optimizing, so you should turn it + back on to let users debug their programs.</dd> + + <dt><tt>--enable-optimized</tt></dt><dd>(For svn checkouts) Builds LLVM with + <tt>-O2</tt> and, by default, turns off debug symbols. Also available by + setting <tt>ENABLE_OPTIMIZED=0|1</tt> in <tt>make</tt>'s environment. This + defaults to enabled when not in a checkout.</dd> +</dl> +</div> + +<!--=========================================================================--> +<div class="doc_section"><a name="cxx-features">C++ Features</a></div> +<!--=========================================================================--> +<div class="doc_text"> + +<dl> + <dt>RTTI</dt><dd>LLVM disables RTTI by default. Add <tt>REQUIRES_RTTI=1</tt> + to your environment while running <tt>make</tt> to re-enable it. This will + allow users to build with RTTI enabled and still inherit from LLVM + classes.</dd> +</dl> +</div> + +<!--=========================================================================--> +<div class="doc_section"><a name="shared-library">Shared Library</a></div> +<!--=========================================================================--> +<div class="doc_text"> + +<p>Configure with <tt>--enable-shared</tt> to build +<tt>libLLVM-<var>major</var>.<var>minor</var>.(so|dylib)</tt> and link the tools +against it. This saves lots of binary size at the cost of some startup time. +</p> +</div> + +<!--=========================================================================--> +<div class="doc_section"><a name="deps">Dependencies</a></div> +<!--=========================================================================--> +<div class="doc_text"> + +<dl> +<dt><tt>--enable-libffi</tt></dt><dd>Depend on <a +href="http://sources.redhat.com/libffi/">libffi</a> to allow the LLVM +interpreter to call external functions.</dd> +<dt><tt>--with-oprofile</tt></dt><dd>Depend on <a +href="http://oprofile.sourceforge.net/doc/devel/index.html">libopagent</a> +(>=version 0.9.4) to let the LLVM JIT tell oprofile about function addresses and +line numbers.</dd> +</dl> +</div> + +<!-- *********************************************************************** --> +<hr> +<address> + <a href="http://jigsaw.w3.org/css-validator/check/referer"><img + src="http://jigsaw.w3.org/css-validator/images/vcss-blue" alt="Valid CSS"></a> + <a href="http://validator.w3.org/check/referer"><img + src="http://www.w3.org/Icons/valid-html401-blue" alt="Valid HTML 4.01"></a> + <a href="http://llvm.org">The LLVM Compiler Infrastructure</a><br> + Last modified: $Date: 2010-02-26 23:25:06 +0100 (Fri, 26 Feb 2010) $ +</address> +</body> +</html> diff --git a/docs/Passes.html b/docs/Passes.html index 2107e13..e3403b4 100644 --- a/docs/Passes.html +++ b/docs/Passes.html @@ -75,7 +75,6 @@ perl -e '$/ = undef; for (split(/\n/, <>)) { s:^ *///? ?::; print " <p>\n" if ! <tr><th colspan="2"><b>ANALYSIS PASSES</b></th></tr> <tr><th>Option</th><th>Name</th></tr> <tr><td><a href="#aa-eval">-aa-eval</a></td><td>Exhaustive Alias Analysis Precision Evaluator</td></tr> -<tr><td><a href="#anders-aa">-anders-aa</a></td><td>Andersen's Interprocedural Alias Analysis</td></tr> <tr><td><a href="#basicaa">-basicaa</a></td><td>Basic Alias Analysis (default AA impl)</td></tr> <tr><td><a href="#basiccg">-basiccg</a></td><td>Basic CallGraph Construction</td></tr> <tr><td><a href="#codegenprepare">-codegenprepare</a></td><td>Optimize for code generation</td></tr> @@ -204,80 +203,6 @@ perl -e '$/ = undef; for (split(/\n/, <>)) { s:^ *///? ?::; print " <p>\n" if ! <!-------------------------------------------------------------------------- --> <div class="doc_subsection"> - <a name="anders-aa">Andersen's Interprocedural Alias Analysis</a> -</div> -<div class="doc_text"> - <p> - This is an implementation of Andersen's interprocedural alias - analysis - </p> - - <p> - In pointer analysis terms, this is a subset-based, flow-insensitive, - field-sensitive, and context-insensitive algorithm pointer algorithm. - </p> - - <p> - This algorithm is implemented as three stages: - </p> - - <ol> - <li>Object identification.</li> - <li>Inclusion constraint identification.</li> - <li>Offline constraint graph optimization.</li> - <li>Inclusion constraint solving.</li> - </ol> - - <p> - The object identification stage identifies all of the memory objects in the - program, which includes globals, heap allocated objects, and stack allocated - objects. - </p> - - <p> - The inclusion constraint identification stage finds all inclusion constraints - in the program by scanning the program, looking for pointer assignments and - other statements that effect the points-to graph. For a statement like - <code><var>A</var> = <var>B</var></code>, this statement is processed to - indicate that <var>A</var> can point to anything that <var>B</var> can point - to. Constraints can handle copies, loads, and stores, and address taking. - </p> - - <p> - The offline constraint graph optimization portion includes offline variable - substitution algorithms intended to computer pointer and location - equivalences. Pointer equivalences are those pointers that will have the - same points-to sets, and location equivalences are those variables that - always appear together in points-to sets. - </p> - - <p> - The inclusion constraint solving phase iteratively propagates the inclusion - constraints until a fixed point is reached. This is an O(<var>n</var>³) - algorithm. - </p> - - <p> - Function constraints are handled as if they were structs with <var>X</var> - fields. Thus, an access to argument <var>X</var> of function <var>Y</var> is - an access to node index <code>getNode(<var>Y</var>) + <var>X</var></code>. - This representation allows handling of indirect calls without any issues. To - wit, an indirect call <code><var>Y</var>(<var>a</var>,<var>b</var>)</code> is - equivalent to <code>*(<var>Y</var> + 1) = <var>a</var>, *(<var>Y</var> + 2) = - <var>b</var></code>. The return node for a function <var>F</var> is always - located at <code>getNode(<var>F</var>) + CallReturnPos</code>. The arguments - start at <code>getNode(<var>F</var>) + CallArgPos</code>. - </p> - - <p> - Please keep in mind that the current andersen's pass has many known - problems and bugs. It should be considered "research quality". - </p> - -</div> - -<!-------------------------------------------------------------------------- --> -<div class="doc_subsection"> <a name="basicaa">Basic Alias Analysis (default AA impl)</a> </div> <div class="doc_text"> @@ -1848,7 +1773,7 @@ if (X < 3) {</pre> <a href="mailto:rspencer@x10sys.com">Reid Spencer</a><br> <a href="http://llvm.org">LLVM Compiler Infrastructure</a><br> - Last modified: $Date: 2009-10-28 05:47:06 +0100 (Wed, 28 Oct 2009) $ + Last modified: $Date: 2010-03-01 20:24:17 +0100 (Mon, 01 Mar 2010) $ </address> </body> diff --git a/docs/ProgrammersManual.html b/docs/ProgrammersManual.html index df4366a..ace44e7 100644 --- a/docs/ProgrammersManual.html +++ b/docs/ProgrammersManual.html @@ -525,7 +525,7 @@ lightweight <a href="http://en.wikipedia.org/wiki/Rope_(computer_science)">rope< which points to temporary (stack allocated) objects. Twines can be implicitly constructed as the result of the plus operator applied to strings (i.e., a C strings, an <tt>std::string</tt>, or a <tt>StringRef</tt>). The twine delays the -actual concatentation of strings until it is actually required, at which point +actual concatenation of strings until it is actually required, at which point it can be efficiently rendered directly into a character array. This avoids unnecessary heap allocation involved in constructing the temporary results of string concatenation. See @@ -1098,7 +1098,7 @@ in the default manner.</p> </div> <div class="doc_text"> -<p><tt>ilist</tt>s have another speciality that must be considered. To be a good +<p><tt>ilist</tt>s have another specialty that must be considered. To be a good citizen in the C++ ecosystem, it needs to support the standard container operations, such as <tt>begin</tt> and <tt>end</tt> iterators, etc. Also, the <tt>operator--</tt> must work correctly on the <tt>end</tt> iterator in the @@ -3921,7 +3921,7 @@ arguments. An argument has a pointer to the parent Function.</p> <a href="mailto:dhurjati@cs.uiuc.edu">Dinakar Dhurjati</a> and <a href="mailto:sabre@nondot.org">Chris Lattner</a><br> <a href="http://llvm.org">The LLVM Compiler Infrastructure</a><br> - Last modified: $Date: 2010-02-15 17:12:20 +0100 (Mon, 15 Feb 2010) $ + Last modified: $Date: 2010-02-26 00:51:27 +0100 (Fri, 26 Feb 2010) $ </address> </body> diff --git a/docs/ReleaseNotes.html b/docs/ReleaseNotes.html index 21f5082..5bdbceb 100644 --- a/docs/ReleaseNotes.html +++ b/docs/ReleaseNotes.html @@ -451,6 +451,8 @@ release includes a few major enhancements and additions to the optimizers:</p> </ul> +<p>Also, -anders-aa was removed</p> + </div> @@ -644,6 +646,10 @@ Clients must replace calls to <li>The <tt>llvm/Support/DataTypes.h</tt> header has moved to <tt>llvm/System/DataTypes.h</tt>.</li> +<li>The <tt>isInteger</tt>, <tt>isIntOrIntVector</tt>, <tt>isFloatingPoint</tt>, +<tt>isFPOrFPVector</tt> and <tt>isFPOrFPVector</tt> methods have been renamed +<tt>isIntegerTy</tt>, <tt>isIntOrIntVectorTy</tt>, <tt>isFloatingPointTy</tt>, +<tt>isFPOrFPVectorTy</tt> and <tt>isFPOrFPVectorTy</tt> respectively.</li> </ul> </div> @@ -729,7 +735,6 @@ href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev">LLVMdev list</a>.</p> experimental.</li> <li>The <tt>llc</tt> "<tt>-filetype=asm</tt>" (the default) is the only supported value for this option. The ELF writer is experimental.</li> -<li>The implementation of Andersen's Alias Analysis has many known bugs.</li> </ul> </div> @@ -992,7 +997,7 @@ lists</a>.</p> src="http://www.w3.org/Icons/valid-html401-blue" alt="Valid HTML 4.01"></a> <a href="http://llvm.org/">LLVM Compiler Infrastructure</a><br> - Last modified: $Date: 2010-02-14 02:47:19 +0100 (Sun, 14 Feb 2010) $ + Last modified: $Date: 2010-03-01 20:29:17 +0100 (Mon, 01 Mar 2010) $ </address> </body> diff --git a/docs/TableGenFundamentals.html b/docs/TableGenFundamentals.html index b96aeab..701d11f 100644 --- a/docs/TableGenFundamentals.html +++ b/docs/TableGenFundamentals.html @@ -155,7 +155,6 @@ file prints this (at the time of this writing):</p> <b>bit</b> hasCtrlDep = 0; <b>bit</b> isNotDuplicable = 0; <b>bit</b> hasSideEffects = 0; - <b>bit</b> mayHaveSideEffects = 0; <b>bit</b> neverHasSideEffects = 0; InstrItinClass Itinerary = NoItinerary; <b>string</b> Constraints = ""; @@ -189,7 +188,7 @@ backend, and is only shown as an example.</p> <p>As you can see, a lot of information is needed for every instruction supported by the code generator, and specifying it all manually would be -unmaintainble, prone to bugs, and tiring to do in the first place. Because we +unmaintainable, prone to bugs, and tiring to do in the first place. Because we are using TableGen, all of the information was derived from the following definition:</p> @@ -798,7 +797,7 @@ This should highlight the APIs in <tt>TableGen/Record.h</tt>.</p> <a href="mailto:sabre@nondot.org">Chris Lattner</a><br> <a href="http://llvm.org">LLVM Compiler Infrastructure</a><br> - Last modified: $Date: 2010-01-05 20:11:42 +0100 (Tue, 05 Jan 2010) $ + Last modified: $Date: 2010-02-28 00:47:46 +0100 (Sun, 28 Feb 2010) $ </address> </body> diff --git a/docs/TestingGuide.html b/docs/TestingGuide.html index 4f05d77..76d6de0 100644 --- a/docs/TestingGuide.html +++ b/docs/TestingGuide.html @@ -693,8 +693,6 @@ that FileCheck is not actually line-oriented when it matches, this allows you to define two separate CHECK lines that match on the same line. </p> - - </div> <!-- _______________________________________________________________________ --> @@ -761,12 +759,6 @@ substitutions</a></div> <dd>The full path to the <tt>llvm-gxx</tt> executable as specified in the configured LLVM environment</dd> - <dt><b>llvmgcc_version</b> (%llvmgcc_version)</dt> - <dd>The full version number of the <tt>llvm-gcc</tt> executable.</dd> - - <dt><b>llvmgccmajvers</b> (%llvmgccmajvers)</dt> - <dd>The major version number of the <tt>llvm-gcc</tt> executable.</dd> - <dt><b>gccpath</b></dt> <dd>The full path to the C compiler used to <i>build </i> LLVM. Note that this might not be gcc.</dd> @@ -824,22 +816,20 @@ substitutions</a></div> </dl> <p>Sometimes it is necessary to mark a test case as "expected fail" or XFAIL. - You can easily mark a test as XFAIL just by including <tt>XFAIL: </tt> on a + You can easily mark a test as XFAIL just by including <tt>XFAIL: </tt> on a line near the top of the file. This signals that the test case should succeed if the test fails. Such test cases are counted separately by DejaGnu. To specify an expected fail, use the XFAIL keyword in the comments of the test program followed by a colon and one or more regular expressions (separated by - a comma). The regular expressions allow you to XFAIL the test conditionally - by host platform. The regular expressions following the : are matched against - the target triplet or llvmgcc version number for the host machine. If there is - a match, the test is expected to fail. If not, the test is expected to - succeed. To XFAIL everywhere just specify <tt>XFAIL: *</tt>. When matching - the llvm-gcc version, you can specify the major (e.g. 3) or full version - (i.e. 3.4) number. Here is an example of an <tt>XFAIL</tt> line:</p> + a comma). The regular expressions allow you to XFAIL the test conditionally by + host platform. The regular expressions following the : are matched against the + target triplet for the host machine. If there is a match, the test is expected + to fail. If not, the test is expected to succeed. To XFAIL everywhere just + specify <tt>XFAIL: *</tt>. Here is an example of an <tt>XFAIL</tt> line:</p> <div class="doc_code"> <pre> -; XFAIL: darwin,sun,llvmgcc4 +; XFAIL: darwin,sun </pre> </div> @@ -1145,7 +1135,6 @@ example reports that can do fancy stuff.</p> </div> - <!--=========================================================================--> <div class="doc_section"><a name="nightly">Running the nightly tester</a></div> <!--=========================================================================--> @@ -1217,7 +1206,7 @@ know. Thanks!</p> John T. Criswell, Reid Spencer, and Tanya Lattner<br> <a href="http://llvm.org">The LLVM Compiler Infrastructure</a><br> - Last modified: $Date: 2009-09-27 10:01:44 +0200 (Sun, 27 Sep 2009) $ + Last modified: $Date: 2010-02-26 22:23:59 +0100 (Fri, 26 Feb 2010) $ </address> </body> </html> diff --git a/docs/WritingAnLLVMPass.html b/docs/WritingAnLLVMPass.html index 218f8ef..d18181e 100644 --- a/docs/WritingAnLLVMPass.html +++ b/docs/WritingAnLLVMPass.html @@ -377,10 +377,10 @@ interesting way, we just throw away the result of <tt>opt</tt> (sending it to <tt>/dev/null</tt>).</p> <p>To see what happened to the other string you registered, try running -<tt>opt</tt> with the <tt>--help</tt> option:</p> +<tt>opt</tt> with the <tt>-help</tt> option:</p> <div class="doc_code"><pre> -$ opt -load ../../../Debug/lib/Hello.so --help +$ opt -load ../../../Debug/lib/Hello.so -help OVERVIEW: llvm .bc -> .bc modular optimizer USAGE: opt [options] <input bitcode> @@ -970,7 +970,7 @@ template, which requires you to pass at least two parameters. The first parameter is the name of the pass that is to be used on the command line to specify that the pass should be added to a program (for example, with <tt>opt</tt> or <tt>bugpoint</tt>). The second argument is the -name of the pass, which is to be used for the <tt>--help</tt> output of +name of the pass, which is to be used for the <tt>-help</tt> output of programs, as well as for debug output generated by the <tt>--debug-pass</tt> option.</p> @@ -1410,7 +1410,7 @@ allowing any analysis results to live across the execution of your pass.</p> options that is useful for debugging pass execution, seeing how things work, and diagnosing when you should be preserving more analyses than you currently are (To get information about all of the variants of the <tt>--debug-pass</tt> -option, just type '<tt>opt --help-hidden</tt>').</p> +option, just type '<tt>opt -help-hidden</tt>').</p> <p>By using the <tt>--debug-pass=Structure</tt> option, for example, we can see how our <a href="#basiccode">Hello World</a> pass interacts with other passes. @@ -1625,12 +1625,12 @@ form; </p> </pre></div> <p>Note the two spaces prior to the help string produces a tidy result on the ---help query.</p> +-help query.</p> <div class="doc_code"><pre> -$ llc --help +$ llc -help ... - -regalloc - Register allocator to use: (default = linearscan) + -regalloc - Register allocator to use (default=linearscan) =linearscan - linear scan register allocator =local - local register allocator =simple - simple register allocator @@ -1829,7 +1829,7 @@ Despite that, we have kept the LLVM passes SMP ready, and you should too.</p> <a href="mailto:sabre@nondot.org">Chris Lattner</a><br> <a href="http://llvm.org">The LLVM Compiler Infrastructure</a><br> - Last modified: $Date: 2009-10-12 16:46:08 +0200 (Mon, 12 Oct 2009) $ + Last modified: $Date: 2010-02-18 15:37:52 +0100 (Thu, 18 Feb 2010) $ </address> </body> diff --git a/docs/index.html b/docs/index.html index 1ada7de..cd43f88 100644 --- a/docs/index.html +++ b/docs/index.html @@ -93,7 +93,6 @@ Current tools: <a href="/cmds/llvmc.html">llvmc</a> <a href="/cmds/llvmgcc.html">llvm-gcc</a>, <a href="/cmds/llvmgxx.html">llvm-g++</a>, - <a href="/cmds/stkrc.html">stkrc</a>, <a href="/cmds/bugpoint.html">bugpoint</a>, <a href="/cmds/llvm-bcanalyzer.html">llvm-bcanalyzer</a>, </li> @@ -117,6 +116,9 @@ manual for using the LLVM testing infrastructure.</li> <li><a href="GCCFEBuildInstrs.html">How to build the Ada/C/C++/Fortran front-ends</a> - Instructions for building gcc front-ends from source.</li> +<li><a href="Packaging.html">Packaging guide</a> - Advice on packaging +LLVM into a distribution.</li> + <li><a href="Lexicon.html">The LLVM Lexicon</a> - Definition of acronyms, terms and concepts used in LLVM.</li> @@ -285,7 +287,7 @@ times each day, making it a high volume list.</li> src="http://www.w3.org/Icons/valid-html401-blue" alt="Valid HTML 4.01"></a> <a href="http://llvm.org">LLVM Compiler Infrastructure</a><br> - Last modified: $Date: 2010-02-03 19:49:55 +0100 (Wed, 03 Feb 2010) $ + Last modified: $Date: 2010-02-26 01:54:42 +0100 (Fri, 26 Feb 2010) $ </address> </body></html> diff --git a/docs/tutorial/LangImpl3.html b/docs/tutorial/LangImpl3.html index a628145..80c9fc2 100644 --- a/docs/tutorial/LangImpl3.html +++ b/docs/tutorial/LangImpl3.html @@ -170,7 +170,7 @@ internally (<tt>APFloat</tt> has the capability of holding floating point constants of <em>A</em>rbitrary <em>P</em>recision). This code basically just creates and returns a <tt>ConstantFP</tt>. Note that in the LLVM IR that constants are all uniqued together and shared. For this reason, the API -uses "the Context.get..." idiom instead of "new foo(..)" or "foo::Create(..)".</p> +uses the "foo::get(...)" idiom instead of "new foo(..)" or "foo::Create(..)".</p> <div class="doc_code"> <pre> @@ -323,10 +323,10 @@ really talks about the external interface for a function (not the value computed by an expression), it makes sense for it to return the LLVM Function it corresponds to when codegen'd.</p> -<p>The call to <tt>Context.get</tt> creates +<p>The call to <tt>FunctionType::get</tt> creates the <tt>FunctionType</tt> that should be used for a given Prototype. Since all function arguments in Kaleidoscope are of type double, the first line creates -a vector of "N" LLVM double types. It then uses the <tt>Context.get</tt> +a vector of "N" LLVM double types. It then uses the <tt>Functiontype::get</tt> method to create a function type that takes "N" doubles as arguments, returns one double as a result, and that is not vararg (the false parameter indicates this). Note that Types in LLVM are uniqued just like Constants are, so you @@ -535,8 +535,7 @@ ready> <b>4+5</b>; Read top-level expression: define double @""() { entry: - %addtmp = add double 4.000000e+00, 5.000000e+00 - ret double %addtmp + ret double 9.000000e+00 } </pre> </div> @@ -544,7 +543,8 @@ entry: <p>Note how the parser turns the top-level expression into anonymous functions for us. This will be handy when we add <a href="LangImpl4.html#jit">JIT support</a> in the next chapter. Also note that the code is very literally -transcribed, no optimizations are being performed. We will +transcribed, no optimizations are being performed except simple constant +folding done by IRBuilder. We will <a href="LangImpl4.html#trivialconstfold">add optimizations</a> explicitly in the next chapter.</p> @@ -554,12 +554,12 @@ ready> <b>def foo(a b) a*a + 2*a*b + b*b;</b> Read function definition: define double @foo(double %a, double %b) { entry: - %multmp = mul double %a, %a - %multmp1 = mul double 2.000000e+00, %a - %multmp2 = mul double %multmp1, %b - %addtmp = add double %multmp, %multmp2 - %multmp3 = mul double %b, %b - %addtmp4 = add double %addtmp, %multmp3 + %multmp = fmul double %a, %a + %multmp1 = fmul double 2.000000e+00, %a + %multmp2 = fmul double %multmp1, %b + %addtmp = fadd double %multmp, %multmp2 + %multmp3 = fmul double %b, %b + %addtmp4 = fadd double %addtmp, %multmp3 ret double %addtmp4 } </pre> @@ -576,7 +576,7 @@ define double @bar(double %a) { entry: %calltmp = call double @foo( double %a, double 4.000000e+00 ) %calltmp1 = call double @bar( double 3.133700e+04 ) - %addtmp = add double %calltmp, %calltmp1 + %addtmp = fadd double %calltmp, %calltmp1 ret double %addtmp } </pre> @@ -612,18 +612,18 @@ ready> <b>^D</b> define double @""() { entry: - %addtmp = add double 4.000000e+00, 5.000000e+00 + %addtmp = fadd double 4.000000e+00, 5.000000e+00 ret double %addtmp } define double @foo(double %a, double %b) { entry: - %multmp = mul double %a, %a - %multmp1 = mul double 2.000000e+00, %a - %multmp2 = mul double %multmp1, %b - %addtmp = add double %multmp, %multmp2 - %multmp3 = mul double %b, %b - %addtmp4 = add double %addtmp, %multmp3 + %multmp = fmul double %a, %a + %multmp1 = fmul double 2.000000e+00, %a + %multmp2 = fmul double %multmp1, %b + %addtmp = fadd double %multmp, %multmp2 + %multmp3 = fmul double %b, %b + %addtmp4 = fadd double %addtmp, %multmp3 ret double %addtmp4 } @@ -631,7 +631,7 @@ define double @bar(double %a) { entry: %calltmp = call double @foo( double %a, double 4.000000e+00 ) %calltmp1 = call double @bar( double 3.133700e+04 ) - %addtmp = add double %calltmp, %calltmp1 + %addtmp = fadd double %calltmp, %calltmp1 ret double %addtmp } @@ -1263,7 +1263,7 @@ int main() { <a href="mailto:sabre@nondot.org">Chris Lattner</a><br> <a href="http://llvm.org">The LLVM Compiler Infrastructure</a><br> - Last modified: $Date: 2010-02-03 18:27:31 +0100 (Wed, 03 Feb 2010) $ + Last modified: $Date: 2010-03-02 02:11:08 +0100 (Tue, 02 Mar 2010) $ </address> </body> </html> diff --git a/docs/tutorial/LangImpl4.html b/docs/tutorial/LangImpl4.html index 85e48c5..4520c46 100644 --- a/docs/tutorial/LangImpl4.html +++ b/docs/tutorial/LangImpl4.html @@ -65,7 +65,7 @@ ready> <b>def test(x) 1+2+x;</b> Read function definition: define double @test(double %x) { entry: - %addtmp = add double 3.000000e+00, %x + %addtmp = fadd double 3.000000e+00, %x ret double %addtmp } </pre> @@ -80,8 +80,8 @@ ready> <b>def test(x) 1+2+x;</b> Read function definition: define double @test(double %x) { entry: - %addtmp = add double 2.000000e+00, 1.000000e+00 - %addtmp1 = add double %addtmp, %x + %addtmp = fadd double 2.000000e+00, 1.000000e+00 + %addtmp1 = fadd double %addtmp, %x ret double %addtmp1 } </pre> @@ -113,9 +113,9 @@ ready> <b>def test(x) (1+2+x)*(x+(1+2));</b> ready> Read function definition: define double @test(double %x) { entry: - %addtmp = add double 3.000000e+00, %x - %addtmp1 = add double %x, 3.000000e+00 - %multmp = mul double %addtmp, %addtmp1 + %addtmp = fadd double 3.000000e+00, %x + %addtmp1 = fadd double %x, 3.000000e+00 + %multmp = fmul double %addtmp, %addtmp1 ret double %multmp } </pre> @@ -240,8 +240,8 @@ ready> <b>def test(x) (1+2+x)*(x+(1+2));</b> ready> Read function definition: define double @test(double %x) { entry: - %addtmp = add double %x, 3.000000e+00 - %multmp = mul double %addtmp, %addtmp + %addtmp = fadd double %x, 3.000000e+00 + %multmp = fmul double %addtmp, %addtmp ret double %multmp } </pre> @@ -363,8 +363,8 @@ ready> <b>def testfunc(x y) x + y*2; </b> Read function definition: define double @testfunc(double %x, double %y) { entry: - %multmp = mul double %y, 2.000000e+00 - %addtmp = add double %multmp, %x + %multmp = fmul double %y, 2.000000e+00 + %addtmp = fadd double %multmp, %x ret double %addtmp } @@ -411,10 +411,10 @@ Read function definition: define double @foo(double %x) { entry: %calltmp = call double @sin( double %x ) - %multmp = mul double %calltmp, %calltmp + %multmp = fmul double %calltmp, %calltmp %calltmp2 = call double @cos( double %x ) - %multmp4 = mul double %calltmp2, %calltmp2 - %addtmp = add double %multmp, %multmp4 + %multmp4 = fmul double %calltmp2, %calltmp2 + %addtmp = fadd double %multmp, %multmp4 ret double %addtmp } @@ -1126,7 +1126,7 @@ int main() { <a href="mailto:sabre@nondot.org">Chris Lattner</a><br> <a href="http://llvm.org">The LLVM Compiler Infrastructure</a><br> - Last modified: $Date: 2010-02-11 20:15:20 +0100 (Thu, 11 Feb 2010) $ + Last modified: $Date: 2010-03-02 02:11:08 +0100 (Tue, 02 Mar 2010) $ </address> </body> </html> diff --git a/docs/tutorial/LangImpl5.html b/docs/tutorial/LangImpl5.html index f80f3f3..3256c40 100644 --- a/docs/tutorial/LangImpl5.html +++ b/docs/tutorial/LangImpl5.html @@ -678,7 +678,7 @@ loop: ; preds = %loop, %entry ; body %calltmp = call double @putchard( double 4.200000e+01 ) ; increment - %nextvar = add double %i, 1.000000e+00 + %nextvar = fadd double %i, 1.000000e+00 ; termination test %cmptmp = fcmp ult double %i, %n @@ -1771,7 +1771,7 @@ int main() { <a href="mailto:sabre@nondot.org">Chris Lattner</a><br> <a href="http://llvm.org">The LLVM Compiler Infrastructure</a><br> - Last modified: $Date: 2010-02-11 20:15:20 +0100 (Thu, 11 Feb 2010) $ + Last modified: $Date: 2010-03-02 02:11:08 +0100 (Tue, 02 Mar 2010) $ </address> </body> </html> diff --git a/docs/tutorial/LangImpl7.html b/docs/tutorial/LangImpl7.html index 1a779ba..3d24739 100644 --- a/docs/tutorial/LangImpl7.html +++ b/docs/tutorial/LangImpl7.html @@ -557,12 +557,12 @@ then: ; preds = %entry else: ; preds = %entry <b>%x3 = load double* %x1</b> - %subtmp = sub double %x3, 1.000000e+00 + %subtmp = fsub double %x3, 1.000000e+00 %calltmp = call double @fib( double %subtmp ) <b>%x4 = load double* %x1</b> - %subtmp5 = sub double %x4, 2.000000e+00 + %subtmp5 = fsub double %x4, 2.000000e+00 %calltmp6 = call double @fib( double %subtmp5 ) - %addtmp = add double %calltmp, %calltmp6 + %addtmp = fadd double %calltmp, %calltmp6 br label %ifcont ifcont: ; preds = %else, %then @@ -595,11 +595,11 @@ then: br label %ifcont else: - %subtmp = sub double <b>%x</b>, 1.000000e+00 + %subtmp = fsub double <b>%x</b>, 1.000000e+00 %calltmp = call double @fib( double %subtmp ) - %subtmp5 = sub double <b>%x</b>, 2.000000e+00 + %subtmp5 = fsub double <b>%x</b>, 2.000000e+00 %calltmp6 = call double @fib( double %subtmp5 ) - %addtmp = add double %calltmp, %calltmp6 + %addtmp = fadd double %calltmp, %calltmp6 br label %ifcont ifcont: ; preds = %else, %then @@ -625,11 +625,11 @@ entry: br i1 %ifcond, label %else, label %ifcont else: - %subtmp = sub double %x, 1.000000e+00 + %subtmp = fsub double %x, 1.000000e+00 %calltmp = call double @fib( double %subtmp ) - %subtmp5 = sub double %x, 2.000000e+00 + %subtmp5 = fsub double %x, 2.000000e+00 %calltmp6 = call double @fib( double %subtmp5 ) - %addtmp = add double %calltmp, %calltmp6 + %addtmp = fadd double %calltmp, %calltmp6 ret double %addtmp ifcont: @@ -2158,7 +2158,7 @@ int main() { <a href="mailto:sabre@nondot.org">Chris Lattner</a><br> <a href="http://llvm.org">The LLVM Compiler Infrastructure</a><br> - Last modified: $Date: 2010-02-11 20:15:20 +0100 (Thu, 11 Feb 2010) $ + Last modified: $Date: 2010-03-02 02:11:08 +0100 (Tue, 02 Mar 2010) $ </address> </body> </html> diff --git a/docs/tutorial/OCamlLangImpl3.html b/docs/tutorial/OCamlLangImpl3.html index b335147..c69f644 100644 --- a/docs/tutorial/OCamlLangImpl3.html +++ b/docs/tutorial/OCamlLangImpl3.html @@ -484,7 +484,7 @@ ready> <b>4+5</b>; Read top-level expression: define double @""() { entry: - %addtmp = add double 4.000000e+00, 5.000000e+00 + %addtmp = fadd double 4.000000e+00, 5.000000e+00 ret double %addtmp } </pre> @@ -503,12 +503,12 @@ ready> <b>def foo(a b) a*a + 2*a*b + b*b;</b> Read function definition: define double @foo(double %a, double %b) { entry: - %multmp = mul double %a, %a - %multmp1 = mul double 2.000000e+00, %a - %multmp2 = mul double %multmp1, %b - %addtmp = add double %multmp, %multmp2 - %multmp3 = mul double %b, %b - %addtmp4 = add double %addtmp, %multmp3 + %multmp = fmul double %a, %a + %multmp1 = fmul double 2.000000e+00, %a + %multmp2 = fmul double %multmp1, %b + %addtmp = fadd double %multmp, %multmp2 + %multmp3 = fmul double %b, %b + %addtmp4 = fadd double %addtmp, %multmp3 ret double %addtmp4 } </pre> @@ -525,7 +525,7 @@ define double @bar(double %a) { entry: %calltmp = call double @foo( double %a, double 4.000000e+00 ) %calltmp1 = call double @bar( double 3.133700e+04 ) - %addtmp = add double %calltmp, %calltmp1 + %addtmp = fadd double %calltmp, %calltmp1 ret double %addtmp } </pre> @@ -561,18 +561,18 @@ ready> <b>^D</b> define double @""() { entry: - %addtmp = add double 4.000000e+00, 5.000000e+00 + %addtmp = fadd double 4.000000e+00, 5.000000e+00 ret double %addtmp } define double @foo(double %a, double %b) { entry: - %multmp = mul double %a, %a - %multmp1 = mul double 2.000000e+00, %a - %multmp2 = mul double %multmp1, %b - %addtmp = add double %multmp, %multmp2 - %multmp3 = mul double %b, %b - %addtmp4 = add double %addtmp, %multmp3 + %multmp = fmul double %a, %a + %multmp1 = fmul double 2.000000e+00, %a + %multmp2 = fmul double %multmp1, %b + %addtmp = fadd double %multmp, %multmp2 + %multmp3 = fmul double %b, %b + %addtmp4 = fadd double %addtmp, %multmp3 ret double %addtmp4 } @@ -580,7 +580,7 @@ define double @bar(double %a) { entry: %calltmp = call double @foo( double %a, double 4.000000e+00 ) %calltmp1 = call double @bar( double 3.133700e+04 ) - %addtmp = add double %calltmp, %calltmp1 + %addtmp = fadd double %calltmp, %calltmp1 ret double %addtmp } @@ -1085,7 +1085,7 @@ main () <a href="mailto:sabre@nondot.org">Chris Lattner</a><br> <a href="mailto:idadesub@users.sourceforge.net">Erick Tryzelaar</a><br> <a href="http://llvm.org">The LLVM Compiler Infrastructure</a><br> - Last modified: $Date: 2010-02-03 18:27:31 +0100 (Wed, 03 Feb 2010) $ + Last modified: $Date: 2010-03-02 02:11:08 +0100 (Tue, 02 Mar 2010) $ </address> </body> </html> diff --git a/docs/tutorial/OCamlLangImpl4.html b/docs/tutorial/OCamlLangImpl4.html index 451ab11..4a72f65 100644 --- a/docs/tutorial/OCamlLangImpl4.html +++ b/docs/tutorial/OCamlLangImpl4.html @@ -72,8 +72,8 @@ ready> <b>def test(x) 1+2+x;</b> Read function definition: define double @test(double %x) { entry: - %addtmp = add double 1.000000e+00, 2.000000e+00 - %addtmp1 = add double %addtmp, %x + %addtmp = fadd double 1.000000e+00, 2.000000e+00 + %addtmp1 = fadd double %addtmp, %x ret double %addtmp1 } </pre> @@ -104,7 +104,7 @@ ready> <b>def test(x) 1+2+x;</b> Read function definition: define double @test(double %x) { entry: - %addtmp = add double 3.000000e+00, %x + %addtmp = fadd double 3.000000e+00, %x ret double %addtmp } </pre> @@ -127,9 +127,9 @@ ready> <b>def test(x) (1+2+x)*(x+(1+2));</b> ready> Read function definition: define double @test(double %x) { entry: - %addtmp = add double 3.000000e+00, %x - %addtmp1 = add double %x, 3.000000e+00 - %multmp = mul double %addtmp, %addtmp1 + %addtmp = fadd double 3.000000e+00, %x + %addtmp1 = fadd double %x, 3.000000e+00 + %multmp = fmul double %addtmp, %addtmp1 ret double %multmp } </pre> @@ -267,8 +267,8 @@ ready> <b>def test(x) (1+2+x)*(x+(1+2));</b> ready> Read function definition: define double @test(double %x) { entry: - %addtmp = add double %x, 3.000000e+00 - %multmp = mul double %addtmp, %addtmp + %addtmp = fadd double %x, 3.000000e+00 + %multmp = fmul double %addtmp, %addtmp ret double %multmp } </pre> @@ -388,8 +388,8 @@ ready> <b>def testfunc(x y) x + y*2; </b> Read function definition: define double @testfunc(double %x, double %y) { entry: - %multmp = mul double %y, 2.000000e+00 - %addtmp = add double %multmp, %x + %multmp = fmul double %y, 2.000000e+00 + %addtmp = fadd double %multmp, %x ret double %addtmp } @@ -436,10 +436,10 @@ Read function definition: define double @foo(double %x) { entry: %calltmp = call double @sin( double %x ) - %multmp = mul double %calltmp, %calltmp + %multmp = fmul double %calltmp, %calltmp %calltmp2 = call double @cos( double %x ) - %multmp4 = mul double %calltmp2, %calltmp2 - %addtmp = add double %multmp, %multmp4 + %multmp4 = fmul double %calltmp2, %calltmp2 + %addtmp = fadd double %multmp, %multmp4 ret double %addtmp } @@ -1032,7 +1032,7 @@ extern double putchard(double X) { <a href="mailto:sabre@nondot.org">Chris Lattner</a><br> <a href="mailto:idadesub@users.sourceforge.net">Erick Tryzelaar</a><br> <a href="http://llvm.org">The LLVM Compiler Infrastructure</a><br> - Last modified: $Date: 2010-02-03 18:27:31 +0100 (Wed, 03 Feb 2010) $ + Last modified: $Date: 2010-03-02 02:11:08 +0100 (Tue, 02 Mar 2010) $ </address> </body> </html> diff --git a/docs/tutorial/OCamlLangImpl5.html b/docs/tutorial/OCamlLangImpl5.html index ae075ec..14f0efd 100644 --- a/docs/tutorial/OCamlLangImpl5.html +++ b/docs/tutorial/OCamlLangImpl5.html @@ -653,7 +653,7 @@ loop: ; preds = %loop, %entry ; body %calltmp = call double @putchard( double 4.200000e+01 ) ; increment - %nextvar = add double %i, 1.000000e+00 + %nextvar = fadd double %i, 1.000000e+00 ; termination test %cmptmp = fcmp ult double %i, %n @@ -1563,7 +1563,7 @@ operators</a> <a href="mailto:sabre@nondot.org">Chris Lattner</a><br> <a href="mailto:idadesub@users.sourceforge.net">Erick Tryzelaar</a><br> <a href="http://llvm.org">The LLVM Compiler Infrastructure</a><br> - Last modified: $Date: 2010-02-03 18:27:31 +0100 (Wed, 03 Feb 2010) $ + Last modified: $Date: 2010-03-02 02:11:08 +0100 (Tue, 02 Mar 2010) $ </address> </body> </html> diff --git a/docs/tutorial/OCamlLangImpl7.html b/docs/tutorial/OCamlLangImpl7.html index ed1a558..823b4c0 100644 --- a/docs/tutorial/OCamlLangImpl7.html +++ b/docs/tutorial/OCamlLangImpl7.html @@ -581,12 +581,12 @@ then: ; preds = %entry else: ; preds = %entry <b>%x3 = load double* %x1</b> - %subtmp = sub double %x3, 1.000000e+00 + %subtmp = fsub double %x3, 1.000000e+00 %calltmp = call double @fib( double %subtmp ) <b>%x4 = load double* %x1</b> - %subtmp5 = sub double %x4, 2.000000e+00 + %subtmp5 = fsub double %x4, 2.000000e+00 %calltmp6 = call double @fib( double %subtmp5 ) - %addtmp = add double %calltmp, %calltmp6 + %addtmp = fadd double %calltmp, %calltmp6 br label %ifcont ifcont: ; preds = %else, %then @@ -619,11 +619,11 @@ then: br label %ifcont else: - %subtmp = sub double <b>%x</b>, 1.000000e+00 + %subtmp = fsub double <b>%x</b>, 1.000000e+00 %calltmp = call double @fib( double %subtmp ) - %subtmp5 = sub double <b>%x</b>, 2.000000e+00 + %subtmp5 = fsub double <b>%x</b>, 2.000000e+00 %calltmp6 = call double @fib( double %subtmp5 ) - %addtmp = add double %calltmp, %calltmp6 + %addtmp = fadd double %calltmp, %calltmp6 br label %ifcont ifcont: ; preds = %else, %then @@ -649,11 +649,11 @@ entry: br i1 %ifcond, label %else, label %ifcont else: - %subtmp = sub double %x, 1.000000e+00 + %subtmp = fsub double %x, 1.000000e+00 %calltmp = call double @fib( double %subtmp ) - %subtmp5 = sub double %x, 2.000000e+00 + %subtmp5 = fsub double %x, 2.000000e+00 %calltmp6 = call double @fib( double %subtmp5 ) - %addtmp = add double %calltmp, %calltmp6 + %addtmp = fadd double %calltmp, %calltmp6 ret double %addtmp ifcont: @@ -1901,7 +1901,7 @@ extern double printd(double X) { <a href="mailto:sabre@nondot.org">Chris Lattner</a><br> <a href="http://llvm.org">The LLVM Compiler Infrastructure</a><br> <a href="mailto:idadesub@users.sourceforge.net">Erick Tryzelaar</a><br> - Last modified: $Date: 2010-02-03 18:27:31 +0100 (Wed, 03 Feb 2010) $ + Last modified: $Date: 2010-03-02 02:11:08 +0100 (Tue, 02 Mar 2010) $ </address> </body> </html> |