diff options
| author | Sanjoy Das <sanjoy@playingwithpointers.com> | 2015-06-29 22:00:30 +0000 |
|---|---|---|
| committer | Sanjoy Das <sanjoy@playingwithpointers.com> | 2015-06-29 22:00:30 +0000 |
| commit | 3c7828e36ebc615904627561eec6761cca2cbab2 (patch) | |
| tree | 920c1d04694db1f28f2e1685352fdde5ca49a477 /llvm/docs | |
| parent | 579c21537a0525cc2bf9c2c3111addeffce4bfdc (diff) | |
| download | bcm5719-llvm-3c7828e36ebc615904627561eec6761cca2cbab2.tar.gz bcm5719-llvm-3c7828e36ebc615904627561eec6761cca2cbab2.zip | |
[FaultMaps][Docs] Document the ImplicitNullChecks pass.
llvm-svn: 241009
Diffstat (limited to 'llvm/docs')
| -rw-r--r-- | llvm/docs/FaultMaps.rst | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/llvm/docs/FaultMaps.rst b/llvm/docs/FaultMaps.rst index 0bacebf058e..c69c7bd0110 100644 --- a/llvm/docs/FaultMaps.rst +++ b/llvm/docs/FaultMaps.rst @@ -52,3 +52,45 @@ The format of this section is uint32 : HandlerPCOffset } } + + +The ``ImplicitNullChecks`` pass +=============================== + +The ``ImplicitNullChecks`` pass transforms explicit control flow for +checking if a pointer is ``null``, like: + +.. code-block:: llvm + + %ptr = call i32* @get_ptr() + %ptr_is_null = icmp i32* %ptr, null + br i1 %ptr_is_null, label %is_null, label %not_null + + not_null: + %t = load i32, i32* %ptr + br label %do_something_with_t + + is_null: + call void @HFC() + unreachable + +to control flow implicit in the instruction loading or storing through +the pointer being null checked: + +.. code-block:: llvm + + %ptr = call i32* @get_ptr() + %t = load i32, i32* %ptr ;; handler-pc = label %is_null + br label %do_something_with_t + + is_null: + call void @HFC() + unreachable + +This transform happens at the ``MachineInstr`` level, not the LLVM IR +level (so the above example is only representative, not literal). The +``ImplicitNullChecks`` pass runs during codegen, if +``-enable-implicit-null-checks`` is passed to ``llc``. + +The ``ImplicitNullChecks`` pass adds entries to the +``__llvm_faultmaps`` section described above as needed. |

