Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(818)

Side by Side Diff: docs/PNaClLangRef.rst

Issue 22240002: Rework PNaCl memory ordering (Closed) Base URL: http://git.chromium.org/native_client/pnacl-llvm.git@master
Patch Set: Clarify address-free as discussed with sehr. Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « docs/PNaClDeveloperGuide.rst ('k') | include/llvm/IR/Intrinsics.td » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 ============================== 1 ==============================
2 PNaCl Bitcode Reference Manual 2 PNaCl Bitcode Reference Manual
3 ============================== 3 ==============================
4 4
5 .. contents:: 5 .. contents::
6 :local: 6 :local:
7 :depth: 3 7 :depth: 3
8 8
9 Introduction 9 Introduction
10 ============ 10 ============
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 136
137 `LLVM LangRef: Module-Level Inline Assembly <LangRef.html#moduleasm>`_ 137 `LLVM LangRef: Module-Level Inline Assembly <LangRef.html#moduleasm>`_
138 138
139 PNaCl bitcode does not support inline assembly. 139 PNaCl bitcode does not support inline assembly.
140 140
141 Volatile Memory Accesses 141 Volatile Memory Accesses
142 ------------------------ 142 ------------------------
143 143
144 `LLVM LangRef: Volatile Memory Accesses <LangRef.html#volatile>`_ 144 `LLVM LangRef: Volatile Memory Accesses <LangRef.html#volatile>`_
145 145
146 PNaCl bitcode does not support volatile memory accesses. The ``volatile`` 146 PNaCl bitcode does not support volatile memory accesses. The
147 attribute on loads and stores is not supported. See the 147 ``volatile`` attribute on loads and stores is not supported. See the
148 `PNaCl Developer's Guide <PNaClDeveloperGuide.html>`_ for more details. 148 `PNaCl Developer's Guide <PNaClDeveloperGuide.html>`_ for more details.
149 149
150 Memory Model for Concurrent Operations 150 Memory Model for Concurrent Operations
151 -------------------------------------- 151 --------------------------------------
152 152
153 `LLVM LangRef: Memory Model for Concurrent Operations <LangRef.html#memmodel>`_ 153 `LLVM LangRef: Memory Model for Concurrent Operations
154 <LangRef.html#memmodel>`_
154 155
155 See the `PNaCl Developer's Guide <PNaClDeveloperGuide.html>`_ for more details. 156 See the `PNaCl Developer's Guide <PNaClDeveloperGuide.html>`_ for more
157 details.
156 158
157 Atomic Memory Ordering Constraints 159 Atomic Memory Ordering Constraints
158 ---------------------------------- 160 ----------------------------------
159 161
160 `LLVM LangRef: Atomic Memory Ordering Constraints <LangRef.html#ordering>`_ 162 `LLVM LangRef: Atomic Memory Ordering Constraints <LangRef.html#ordering>`_
161 163
162 PNaCl bitcode currently supports sequential consistency only, through its 164 PNaCl bitcode currently supports sequential consistency only, through
163 `atomic intrinsics`_. See the 165 its `atomic intrinsics`_. See the `PNaCl Developer's Guide
164 `PNaCl Developer's Guide <PNaClDeveloperGuide.html>`_ for more details. 166 <PNaClDeveloperGuide.html>`_ for more details.
167
168 The integer values for memory ordering constraints are in
169 ``"llvm/IR/NaClAtomicIntrinsics.h"``.
165 170
166 Fast-Math Flags 171 Fast-Math Flags
167 --------------- 172 ---------------
168 173
169 `LLVM LangRef: Fast-Math Flags <LangRef.html#fastmath>`_ 174 `LLVM LangRef: Fast-Math Flags <LangRef.html#fastmath>`_
170 175
171 Fast-math mode is not currently supported by the PNaCl bitcode. 176 Fast-math mode is not currently supported by the PNaCl bitcode.
172 177
173 Type System 178 Type System
174 =========== 179 ===========
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
403 408
404 See :ref:`Setjmp and Longjmp <setjmplongjmp>`. 409 See :ref:`Setjmp and Longjmp <setjmplongjmp>`.
405 410
406 .. _atomic intrinsics: 411 .. _atomic intrinsics:
407 412
408 * ``llvm.nacl.atomic.store`` 413 * ``llvm.nacl.atomic.store``
409 * ``llvm.nacl.atomic.load`` 414 * ``llvm.nacl.atomic.load``
410 * ``llvm.nacl.atomic.rmw`` 415 * ``llvm.nacl.atomic.rmw``
411 * ``llvm.nacl.atomic.cmpxchg`` 416 * ``llvm.nacl.atomic.cmpxchg``
412 * ``llvm.nacl.atomic.fence`` 417 * ``llvm.nacl.atomic.fence``
418 * ``llvm.nacl.atomic.fence.all``
419 * ``llvm.nacl.atomic.is.lock.free``
413 420
414 See :ref:`atomic intrinsics <atomicintrinsics>`. 421 See :ref:`atomic intrinsics <atomicintrinsics>`.
415 422
416 .. _threadpointerintrinsics: 423 .. _threadpointerintrinsics:
417 424
418 Thread pointer related intrinsics 425 Thread pointer related intrinsics
419 --------------------------------- 426 ---------------------------------
420 427
421 .. code-block:: llvm 428 .. code-block:: llvm
422 429
423 declare i8* @llvm.nacl.read.tp() 430 declare i8* @llvm.nacl.read.tp()
424 431
425 Returns the thread pointer, which can be set by the embedding sandbox's runtime. 432 Returns the thread pointer, which can be set by the embedding sandbox's runtime.
426 433
427 .. _setjmplongjmp: 434 .. _setjmplongjmp:
428 435
429 Setjmp and Longjmp 436 Setjmp and Longjmp
430 ------------------ 437 ------------------
431 438
432 .. code-block:: llvm 439 .. code-block:: llvm
433 440
434 declare void @llvm.nacl.longjmp(i8* %jmpbuf, i32) 441 declare void @llvm.nacl.longjmp(i8* %jmpbuf, i32)
435 declare i32 @llvm.nacl.setjmp(i8* %jmpbuf) 442 declare i32 @llvm.nacl.setjmp(i8* %jmpbuf)
436 443
437 These intrinsics implement the semantics of C11 ``setjmp`` and ``longjmp``. The 444 These intrinsics implement the semantics of C11 ``setjmp`` and
438 ``jmpbuf`` pointer must be 64-bit aligned and point to at least 1024 bytes of 445 ``longjmp``. The ``jmpbuf`` pointer must be 64-bit aligned and point to
439 allocated memory. 446 at least 1024 bytes of allocated memory.
440 447
441 .. _atomicintrinsics: 448 .. _atomicintrinsics:
442 449
443 Atomic intrinsics 450 Atomic intrinsics
444 ----------------- 451 -----------------
445 452
446 .. code-block:: llvm 453 .. code-block:: llvm
447 454
448 declare iN @llvm.nacl.atomic.load.<size>( 455 declare iN @llvm.nacl.atomic.load.<size>(
449 iN* <source>, i32 <memory_order>) 456 iN* <source>, i32 <memory_order>)
450 declare void @llvm.nacl.atomic.store.<size>( 457 declare void @llvm.nacl.atomic.store.<size>(
451 iN <operand>, iN* <destination>, i32 <memory_order>) 458 iN <operand>, iN* <destination>, i32 <memory_order>)
452 declare iN @llvm.nacl.atomic.rmw.<size>( 459 declare iN @llvm.nacl.atomic.rmw.<size>(
453 i32 <computation>, iN* <object>, iN <operand>, i32 <memory_order>) 460 i32 <computation>, iN* <object>, iN <operand>, i32 <memory_order>)
454 declare iN @llvm.nacl.atomic.cmpxchg.<size>( 461 declare iN @llvm.nacl.atomic.cmpxchg.<size>(
455 iN* <object>, iN <expected>, iN <desired>, 462 iN* <object>, iN <expected>, iN <desired>,
456 i32 <memory_order_success>, i32 <memory_order_failure>) 463 i32 <memory_order_success>, i32 <memory_order_failure>)
457 declare void @llvm.nacl.atomic.fence(i32 <memory_order>) 464 declare void @llvm.nacl.atomic.fence(i32 <memory_order>)
465 declare void @llvm.nacl.atomic.fence.all()
458 466
459 Each of these intrinsics is overloaded on the ``iN`` argument, which 467 Each of these intrinsics is overloaded on the ``iN`` argument, which is
460 is reflected through ``<size>`` in the overload's name. Integral types 468 reflected through ``<size>`` in the overload's name. Integral types of
461 of 8, 16, 32 and 64-bit width are supported for these arguments. 469 8, 16, 32 and 64-bit width are supported for these arguments.
462 470
463 The ``@llvm.nacl.atomic.rmw`` intrinsic implements the following 471 The ``@llvm.nacl.atomic.rmw`` intrinsic implements the following
464 read-modify-write operations, from the general and arithmetic sections 472 read-modify-write operations, from the general and arithmetic sections
465 of the C11/C++11 standards: 473 of the C11/C++11 standards:
466 474
467 - ``add`` 475 - ``add``
468 - ``sub`` 476 - ``sub``
469 - ``or`` 477 - ``or``
470 - ``and`` 478 - ``and``
471 - ``xor`` 479 - ``xor``
472 - ``exchange`` 480 - ``exchange``
473 481
474 For all of these read-modify-write operations, the returned value is 482 For all of these read-modify-write operations, the returned value is
475 that at ``object`` before the computation. The ``computation`` 483 that at ``object`` before the computation. The ``computation`` argument
476 argument must be a compile-time constant. 484 must be a compile-time constant.
477 485
478 All atomic intrinsics also support C11/C++11 memory orderings, which 486 All atomic intrinsics also support C11/C++11 memory orderings, which
479 must be compile-time constants. Those are detailed in `Atomic Memory 487 must be compile-time constants. Those are detailed in `Atomic Memory
480 Ordering Constraints`_. 488 Ordering Constraints`_.
481 489
482 Integer values for these computations and memory orderings are defined 490 Integer values for these computations and memory orderings are defined
483 in ``"llvm/IR/NaClAtomicIntrinsics.h"``. 491 in ``"llvm/IR/NaClAtomicIntrinsics.h"``.
484 492
493 The ``@llvm.nacl.atomic.fence.all`` intrinsic is equivalent to the
494 ``@llvm.nacl.atomic.fence`` intrinsic with sequentially consistent
495 ordering and compiler barriers preventing most non-atomic memory
496 accesses from reordering around it.
497
485 .. note:: 498 .. note::
486 499
487 These intrinsics allow PNaCl to support C11/C++11 style atomic 500 These intrinsics allow PNaCl to support C11/C++11 style atomic
488 operations as well as some legacy GCC-style ``__sync_*`` builtins 501 operations as well as some legacy GCC-style ``__sync_*`` builtins
489 while remaining stable as the LLVM codebase changes. The user 502 while remaining stable as the LLVM codebase changes. The user isn't
490 isn't expected to use these intrinsics directly. 503 expected to use these intrinsics directly.
491 504
492 .. code-block:: llvm 505 .. code-block:: llvm
493 506
494 declare i1 @llvm.nacl.atomic.is.lock.free(i32 <byte_size>, i8* <address>) 507 declare i1 @llvm.nacl.atomic.is.lock.free(i32 <byte_size>, i8* <address>)
495 508
496 The ``llvm.nacl.atomic.is.lock.free`` intrinsic is designed to 509 The ``llvm.nacl.atomic.is.lock.free`` intrinsic is designed to
497 determine at translation time whether atomic operations of a certain 510 determine at translation time whether atomic operations of a certain
498 ``byte_size`` (a compile-time constant), at a particular ``address``, 511 ``byte_size`` (a compile-time constant), at a particular ``address``,
499 are lock-free or not. This reflects the C11 ``atomic_is_lock_free`` 512 are lock-free or not. This reflects the C11 ``atomic_is_lock_free``
500 function from header ``<stdatomic.h>`` and the C++11 ``is_lock_free`` 513 function from header ``<stdatomic.h>`` and the C++11 ``is_lock_free``
501 member function in header ``<atomic>``. It can be used through the 514 member function in header ``<atomic>``. It can be used through the
502 ``__nacl_atomic_is_lock_free`` builtin. 515 ``__nacl_atomic_is_lock_free`` builtin.
OLDNEW
« no previous file with comments | « docs/PNaClDeveloperGuide.rst ('k') | include/llvm/IR/Intrinsics.td » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698