[llvm] fb8152d - [CallSite removal] Remove the text describing CallSite from the manual.

James Y Knight via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 23 19:18:13 PDT 2020


Author: James Y Knight
Date: 2020-04-23T22:17:19-04:00
New Revision: fb8152dcfe6c13992df7535293077400de984591

URL: https://github.com/llvm/llvm-project/commit/fb8152dcfe6c13992df7535293077400de984591
DIFF: https://github.com/llvm/llvm-project/commit/fb8152dcfe6c13992df7535293077400de984591.diff

LOG: [CallSite removal] Remove the text describing CallSite from the manual.

Added: 
    

Modified: 
    llvm/docs/ProgrammersManual.rst

Removed: 
    


################################################################################
diff  --git a/llvm/docs/ProgrammersManual.rst b/llvm/docs/ProgrammersManual.rst
index 5236ad34af53..8d028a64b65f 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<CallInst>(&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<CallBase>(&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 <https://llvm.org/doxygen/classllvm_1_1CallSite.html>`__) 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


        


More information about the llvm-commits mailing list