LEFT | RIGHT |
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" | 1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" |
2 "http://www.w3.org/TR/html4/strict.dtd"> | 2 "http://www.w3.org/TR/html4/strict.dtd"> |
3 <html> | 3 <html> |
4 <head> | 4 <head> |
5 <title>LLVM Assembly Language Reference Manual</title> | 5 <title>LLVM Assembly Language Reference Manual</title> |
6 <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> | 6 <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
7 <meta name="author" content="Chris Lattner"> | 7 <meta name="author" content="Chris Lattner"> |
8 <meta name="description" | 8 <meta name="description" |
9 content="LLVM Assembly Language Reference Manual."> | 9 content="LLVM Assembly Language Reference Manual."> |
10 <link rel="stylesheet" href="llvm.css" type="text/css"> | 10 <link rel="stylesheet" href="llvm.css" type="text/css"> |
(...skipping 2305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2316 <p>Any non-void instruction or constant expression other than a non-intrinsic | 2316 <p>Any non-void instruction or constant expression other than a non-intrinsic |
2317 call, invoke, or phi with a trap operand has trap as its result value. Any | 2317 call, invoke, or phi with a trap operand has trap as its result value. Any |
2318 instruction with a trap operand which may have side effects emits those side | 2318 instruction with a trap operand which may have side effects emits those side |
2319 effects as if it had an undef operand instead. Notwithstanding that, a store | 2319 effects as if it had an undef operand instead. Notwithstanding that, a store |
2320 of a trap value causes subsequent loads of the same memory to return a trap | 2320 of a trap value causes subsequent loads of the same memory to return a trap |
2321 value. For example:</p> | 2321 value. For example:</p> |
2322 | 2322 |
2323 <div class="doc_code"> | 2323 <div class="doc_code"> |
2324 <pre> | 2324 <pre> |
2325 %trap = sub nuw i32 0, 1 ; Results in a trap value. | 2325 %trap = sub nuw i32 0, 1 ; Results in a trap value. |
2326 volatile store i32 %trap, i32* @g ; External observations of @g see undef. | |
2327 %trap2 = load i32* @g ; Returns a trap value, not just undef. | |
2328 %still_trap = and i32 %trap, 0 ; Whereas (and i32 undef, 0) would return 0. | 2326 %still_trap = and i32 %trap, 0 ; Whereas (and i32 undef, 0) would return 0. |
2329 %trap_yet_again = getelementptr i32* @h, i32 %still_trap | 2327 %trap_yet_again = getelementptr i32* @h, i32 %still_trap |
2330 store i32 0, i32* %trap_yet_again ; undefined behavior | 2328 store i32 0, i32* %trap_yet_again ; undefined behavior |
| 2329 |
| 2330 volatile store i32 %trap, i32* @g ; External observations of @g see undef. |
| 2331 %trap2 = load i32* @g ; Returns a trap value, not just undef. |
2331 </pre> | 2332 </pre> |
2332 </div> | 2333 </div> |
2333 | 2334 |
2334 <p>A <a href="#i_br">br</a> or <a href="#i_switch">switch</a> instruction whose | 2335 <p>A <a href="#i_br">br</a> or <a href="#i_switch">switch</a> instruction whose |
2335 control operand is a trap value causes undefined behavior.</p> | 2336 control operand is a trap value results in undefined behavior.</p> |
2336 | 2337 |
2337 <p>There is currently no way of representing a trap constant in the IR; they | 2338 <p>There is currently no way of representing a trap constant in the IR; they |
2338 only exist when produced by certain instructions, such as an | 2339 only exist when produced by certain instructions, such as an |
2339 <a href="#i_add"><tt>add</tt></a> with the <tt>nsw</tt> flag | 2340 <a href="#i_add"><tt>add</tt></a> with the <tt>nsw</tt> flag |
2340 set, when overflow occurs.</p> | 2341 set, when overflow occurs.</p> |
2341 | 2342 |
2342 </div> | 2343 </div> |
2343 | 2344 |
2344 <!-- ======================================================================= --> | 2345 <!-- ======================================================================= --> |
2345 <div class="doc_subsection"><a name="blockaddress">Addresses of Basic | 2346 <div class="doc_subsection"><a name="blockaddress">Addresses of Basic |
(...skipping 5319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7665 <a href="http://validator.w3.org/check/referer"><img | 7666 <a href="http://validator.w3.org/check/referer"><img |
7666 src="http://www.w3.org/Icons/valid-html401-blue" alt="Valid HTML 4.01"></a> | 7667 src="http://www.w3.org/Icons/valid-html401-blue" alt="Valid HTML 4.01"></a> |
7667 | 7668 |
7668 <a href="mailto:sabre@nondot.org">Chris Lattner</a><br> | 7669 <a href="mailto:sabre@nondot.org">Chris Lattner</a><br> |
7669 <a href="http://llvm.org">The LLVM Compiler Infrastructure</a><br> | 7670 <a href="http://llvm.org">The LLVM Compiler Infrastructure</a><br> |
7670 Last modified: $Date$ | 7671 Last modified: $Date$ |
7671 </address> | 7672 </address> |
7672 | 7673 |
7673 </body> | 7674 </body> |
7674 </html> | 7675 </html> |
LEFT | RIGHT |