From fb8152dcfe6c13992df7535293077400de984591 Mon Sep 17 00:00:00 2001 From: James Y Knight Date: Thu, 23 Apr 2020 22:01:09 -0400 Subject: [PATCH] [CallSite removal] Remove the text describing CallSite from the manual. --- llvm/docs/ProgrammersManual.rst | 33 ++++++--------------------------- 1 file changed, 6 insertions(+), 27 deletions(-) diff --git a/llvm/docs/ProgrammersManual.rst b/llvm/docs/ProgrammersManual.rst index 5236ad34af535..8d028a64b65fb 100644 --- a/llvm/docs/ProgrammersManual.rst +++ b/llvm/docs/ProgrammersManual.rst @@ -2620,7 +2620,7 @@ want to do: for each Function f in the Module for each BasicBlock b in f for each Instruction i in b - if (i is a CallInst and calls the given function) + if (i a Call and calls the given function) increment callCounter And the actual code is (remember, because we're writing a ``FunctionPass``, our @@ -2638,11 +2638,11 @@ method): virtual runOnFunction(Function& F) { for (BasicBlock &B : F) { for (Instruction &I: B) { - if (auto *CallInst = dyn_cast(&I)) { - // We know we've encountered a call instruction, so we - // need to determine if it's a call to the - // function pointed to by m_func or not. - if (CallInst->getCalledFunction() == targetFunc) + if (auto *CB = dyn_cast(&I)) { + // We know we've encountered some kind of call instruction (call, + // invoke, or callbr), so we need to determine if it's a call to + // the function pointed to by m_func or not. + if (CB->getCalledFunction() == targetFunc) ++callCounter; } } @@ -2653,27 +2653,6 @@ method): unsigned callCounter; }; -.. _calls_and_invokes: - -Treating calls and invokes the same way -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -You may have noticed that the previous example was a bit oversimplified in that -it did not deal with call sites generated by 'invoke' instructions. In this, -and in other situations, you may find that you want to treat ``CallInst``\ s and -``InvokeInst``\ s the same way, even though their most-specific common base -class is ``Instruction``, which includes lots of less closely-related things. -For these cases, LLVM provides a handy wrapper class called ``CallSite`` -(`doxygen `__) It is -essentially a wrapper around an ``Instruction`` pointer, with some methods that -provide functionality common to ``CallInst``\ s and ``InvokeInst``\ s. - -This class has "value semantics": it should be passed by value, not by reference -and it should not be dynamically allocated or deallocated using ``operator new`` -or ``operator delete``. It is efficiently copyable, assignable and -constructable, with costs equivalents to that of a bare pointer. If you look at -its definition, it has only a single pointer member. - .. _iterate_chains: Iterating over def-use & use-def chains