X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=docs%2FProgrammersManual.rst;h=85a4ad8e554a31c6c19a6f95bb86638bda8b49a8;hb=3d371bd84bf7af139c961c7d8363776e0b322987;hp=e828e6bf501f4def5d55c0b9f96f4d3b91b9eacf;hpb=d9ebc5991be6fcbaf8231039d7403ff663005fe9;p=oota-llvm.git diff --git a/docs/ProgrammersManual.rst b/docs/ProgrammersManual.rst index e828e6bf501..85a4ad8e554 100644 --- a/docs/ProgrammersManual.rst +++ b/docs/ProgrammersManual.rst @@ -298,7 +298,9 @@ The ``function_ref`` (`doxygen `__) class template represents a reference to a callable object, templated over the type of the callable. This is a good choice for passing a callback to a function, -if you don't need to hold onto the callback after the function returns. +if you don't need to hold onto the callback after the function returns. In this +way, ``function_ref`` is to ``std::function`` as ``StringRef`` is to +``std::string``. ``function_ref`` can be implicitly constructed from any callable object that can be called with arguments of type ``Param1``, @@ -323,17 +325,11 @@ can be called using: return false; }); -Note that a ``function_ref`` object contains pointers to external memory, so -it is not generally safe to store an instance of the class (unless you know -that the external storage will not be freed). -``function_ref`` is small enough that it should always be passed by value. - -``std::function`` -^^^^^^^^^^^^^^^^^ - -You cannot use ``std::function`` within LLVM code, because it is not supported -by all our target toolchains. - +Note that a ``function_ref`` object contains pointers to external memory, so it +is not generally safe to store an instance of the class (unless you know that +the external storage will not be freed). If you need this ability, consider +using ``std::function``. ``function_ref`` is small enough that it should always +be passed by value. .. _DEBUG: @@ -426,9 +422,12 @@ to specify the debug type for the entire module (if you do this before you because there is no system in place to ensure that names do not conflict. If two different modules use the same string, they will all be turned on when the name is specified. This allows, for example, all debug information for -instruction scheduling to be enabled with ``-debug-type=InstrSched``, even if +instruction scheduling to be enabled with ``-debug-only=InstrSched``, even if the source lives in multiple files. +For performance reasons, -debug-only is not available in optimized build +(``--enable-optimized``) of LLVM. + The ``DEBUG_WITH_TYPE`` macro is also available for situations where you would like to set ``DEBUG_TYPE``, but only for one specific ``DEBUG`` statement. It takes an additional first parameter, which is the type to use. For example, the @@ -877,7 +876,7 @@ variety of customizations. llvm/ADT/ilist_node.h ^^^^^^^^^^^^^^^^^^^^^ -``ilist_node`` implements a the forward and backward links that are expected +``ilist_node`` implements the forward and backward links that are expected by the ``ilist`` (and analogous containers) in the default manner. ``ilist_node``\ s are meant to be embedded in the node type ``T``, usually @@ -1441,8 +1440,10 @@ order, making it an easy (but somewhat expensive) solution for non-deterministic iteration over maps of pointers. It is implemented by mapping from key to an index in a vector of key,value -pairs. This provides fast lookup and iteration, but has two main drawbacks: The -key is stored twice and removing elements takes linear time. +pairs. This provides fast lookup and iteration, but has two main drawbacks: +the key is stored twice and removing elements takes linear time. If it is +necessary to remove elements, it's best to remove them in bulk using +``remove_if()``. .. _dss_inteqclasses: