Coverage Report

Created: 2019-07-24 05:18

/Users/buildslave/jenkins/workspace/clang-stage2-coverage-R/llvm/include/llvm/IR/CallSite.h
Line
Count
Source (jump to first uncovered line)
1
//===- CallSite.h - Abstract Call & Invoke instrs ---------------*- C++ -*-===//
2
//
3
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4
// See https://llvm.org/LICENSE.txt for license information.
5
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6
//
7
//===----------------------------------------------------------------------===//
8
//
9
// This file defines the CallSite class, which is a handy wrapper for code that
10
// wants to treat Call, Invoke and CallBr instructions in a generic way. When
11
// in non-mutation context (e.g. an analysis) ImmutableCallSite should be used.
12
// Finally, when some degree of customization is necessary between these two
13
// extremes, CallSiteBase<> can be supplied with fine-tuned parameters.
14
//
15
// NOTE: These classes are supposed to have "value semantics". So they should be
16
// passed by value, not by reference; they should not be "new"ed or "delete"d.
17
// They are efficiently copyable, assignable and constructable, with cost
18
// equivalent to copying a pointer (notice that they have only a single data
19
// member). The internal representation carries a flag which indicates which of
20
// the three variants is enclosed. This allows for cheaper checks when various
21
// accessors of CallSite are employed.
22
//
23
//===----------------------------------------------------------------------===//
24
25
#ifndef LLVM_IR_CALLSITE_H
26
#define LLVM_IR_CALLSITE_H
27
28
#include "llvm/ADT/Optional.h"
29
#include "llvm/ADT/PointerIntPair.h"
30
#include "llvm/ADT/iterator_range.h"
31
#include "llvm/IR/Attributes.h"
32
#include "llvm/IR/CallingConv.h"
33
#include "llvm/IR/Function.h"
34
#include "llvm/IR/InstrTypes.h"
35
#include "llvm/IR/Instruction.h"
36
#include "llvm/IR/Instructions.h"
37
#include "llvm/IR/Use.h"
38
#include "llvm/IR/User.h"
39
#include "llvm/IR/Value.h"
40
#include "llvm/Support/Casting.h"
41
#include <cassert>
42
#include <cstdint>
43
#include <iterator>
44
45
namespace llvm {
46
47
namespace Intrinsic {
48
enum ID : unsigned;
49
}
50
51
template <typename FunTy = const Function, typename BBTy = const BasicBlock,
52
          typename ValTy = const Value, typename UserTy = const User,
53
          typename UseTy = const Use, typename InstrTy = const Instruction,
54
          typename CallTy = const CallInst,
55
          typename InvokeTy = const InvokeInst,
56
          typename CallBrTy = const CallBrInst,
57
          typename IterTy = User::const_op_iterator>
58
class CallSiteBase {
59
protected:
60
  PointerIntPair<InstrTy *, 2, int> I;
61
62
304M
  CallSiteBase() = default;
llvm::CallSiteBase<llvm::Function const, llvm::BasicBlock const, llvm::Value const, llvm::User const, llvm::Use const, llvm::Instruction const, llvm::CallInst const, llvm::InvokeInst const, llvm::CallBrInst const, llvm::Use const*>::CallSiteBase()
Line
Count
Source
62
246M
  CallSiteBase() = default;
llvm::CallSiteBase<llvm::Function, llvm::BasicBlock, llvm::Value, llvm::User, llvm::Use, llvm::Instruction, llvm::CallInst, llvm::InvokeInst, llvm::CallBrInst, llvm::Use*>::CallSiteBase()
Line
Count
Source
62
57.9M
  CallSiteBase() = default;
63
227M
  CallSiteBase(CallTy *CI) : I(CI, 1) { assert(CI); }
llvm::CallSiteBase<llvm::Function const, llvm::BasicBlock const, llvm::Value const, llvm::User const, llvm::Use const, llvm::Instruction const, llvm::CallInst const, llvm::InvokeInst const, llvm::CallBrInst const, llvm::Use const*>::CallSiteBase(llvm::CallInst const*)
Line
Count
Source
63
189M
  CallSiteBase(CallTy *CI) : I(CI, 1) { assert(CI); }
llvm::CallSiteBase<llvm::Function, llvm::BasicBlock, llvm::Value, llvm::User, llvm::Use, llvm::Instruction, llvm::CallInst, llvm::InvokeInst, llvm::CallBrInst, llvm::Use*>::CallSiteBase(llvm::CallInst*)
Line
Count
Source
63
37.6M
  CallSiteBase(CallTy *CI) : I(CI, 1) { assert(CI); }
64
3.43M
  CallSiteBase(InvokeTy *II) : I(II, 0) { assert(II); }
llvm::CallSiteBase<llvm::Function const, llvm::BasicBlock const, llvm::Value const, llvm::User const, llvm::Use const, llvm::Instruction const, llvm::CallInst const, llvm::InvokeInst const, llvm::CallBrInst const, llvm::Use const*>::CallSiteBase(llvm::InvokeInst const*)
Line
Count
Source
64
2.44M
  CallSiteBase(InvokeTy *II) : I(II, 0) { assert(II); }
llvm::CallSiteBase<llvm::Function, llvm::BasicBlock, llvm::Value, llvm::User, llvm::Use, llvm::Instruction, llvm::CallInst, llvm::InvokeInst, llvm::CallBrInst, llvm::Use*>::CallSiteBase(llvm::InvokeInst*)
Line
Count
Source
64
985k
  CallSiteBase(InvokeTy *II) : I(II, 0) { assert(II); }
65
48
  CallSiteBase(CallBrTy *CBI) : I(CBI, 2) { assert(CBI); }
llvm::CallSiteBase<llvm::Function const, llvm::BasicBlock const, llvm::Value const, llvm::User const, llvm::Use const, llvm::Instruction const, llvm::CallInst const, llvm::InvokeInst const, llvm::CallBrInst const, llvm::Use const*>::CallSiteBase(llvm::CallBrInst const*)
Line
Count
Source
65
17
  CallSiteBase(CallBrTy *CBI) : I(CBI, 2) { assert(CBI); }
llvm::CallSiteBase<llvm::Function, llvm::BasicBlock, llvm::Value, llvm::User, llvm::Use, llvm::Instruction, llvm::CallInst, llvm::InvokeInst, llvm::CallBrInst, llvm::Use*>::CallSiteBase(llvm::CallBrInst*)
Line
Count
Source
65
31
  CallSiteBase(CallBrTy *CBI) : I(CBI, 2) { assert(CBI); }
66
508M
  explicit CallSiteBase(ValTy *II) { *this = get(II); }
llvm::CallSiteBase<llvm::Function const, llvm::BasicBlock const, llvm::Value const, llvm::User const, llvm::Use const, llvm::Instruction const, llvm::CallInst const, llvm::InvokeInst const, llvm::CallBrInst const, llvm::Use const*>::CallSiteBase(llvm::Value const*)
Line
Count
Source
66
434M
  explicit CallSiteBase(ValTy *II) { *this = get(II); }
llvm::CallSiteBase<llvm::Function, llvm::BasicBlock, llvm::Value, llvm::User, llvm::Use, llvm::Instruction, llvm::CallInst, llvm::InvokeInst, llvm::CallBrInst, llvm::Use*>::CallSiteBase(llvm::Value*)
Line
Count
Source
66
73.7M
  explicit CallSiteBase(ValTy *II) { *this = get(II); }
67
68
private:
69
  /// This static method is like a constructor. It will create an appropriate
70
  /// call site for a Call, Invoke or CallBr instruction, but it can also create
71
  /// a null initialized CallSiteBase object for something which is NOT a call
72
  /// site.
73
508M
  static CallSiteBase get(ValTy *V) {
74
508M
    if (InstrTy *II = dyn_cast<InstrTy>(V)) {
75
502M
      if (II->getOpcode() == Instruction::Call)
76
201M
        return CallSiteBase(static_cast<CallTy*>(II));
77
300M
      if (II->getOpcode() == Instruction::Invoke)
78
2.69M
        return CallSiteBase(static_cast<InvokeTy*>(II));
79
297M
      if (II->getOpcode() == Instruction::CallBr)
80
33
        return CallSiteBase(static_cast<CallBrTy *>(II));
81
303M
    }
82
303M
    return CallSiteBase();
83
303M
  }
llvm::CallSiteBase<llvm::Function, llvm::BasicBlock, llvm::Value, llvm::User, llvm::Use, llvm::Instruction, llvm::CallInst, llvm::InvokeInst, llvm::CallBrInst, llvm::Use*>::get(llvm::Value*)
Line
Count
Source
73
73.7M
  static CallSiteBase get(ValTy *V) {
74
73.7M
    if (InstrTy *II = dyn_cast<InstrTy>(V)) {
75
73.7M
      if (II->getOpcode() == Instruction::Call)
76
15.5M
        return CallSiteBase(static_cast<CallTy*>(II));
77
58.2M
      if (II->getOpcode() == Instruction::Invoke)
78
275k
        return CallSiteBase(static_cast<InvokeTy*>(II));
79
57.9M
      if (II->getOpcode() == Instruction::CallBr)
80
21
        return CallSiteBase(static_cast<CallBrTy *>(II));
81
57.9M
    }
82
57.9M
    return CallSiteBase();
83
57.9M
  }
llvm::CallSiteBase<llvm::Function const, llvm::BasicBlock const, llvm::Value const, llvm::User const, llvm::Use const, llvm::Instruction const, llvm::CallInst const, llvm::InvokeInst const, llvm::CallBrInst const, llvm::Use const*>::get(llvm::Value const*)
Line
Count
Source
73
434M
  static CallSiteBase get(ValTy *V) {
74
434M
    if (InstrTy *II = dyn_cast<InstrTy>(V)) {
75
428M
      if (II->getOpcode() == Instruction::Call)
76
186M
        return CallSiteBase(static_cast<CallTy*>(II));
77
242M
      if (II->getOpcode() == Instruction::Invoke)
78
2.41M
        return CallSiteBase(static_cast<InvokeTy*>(II));
79
239M
      if (II->getOpcode() == Instruction::CallBr)
80
12
        return CallSiteBase(static_cast<CallBrTy *>(II));
81
245M
    }
82
245M
    return CallSiteBase();
83
245M
  }
84
85
public:
86
  /// Return true if a CallInst is enclosed.
87
325M
  bool isCall() const { return I.getInt() == 1; }
llvm::CallSiteBase<llvm::Function, llvm::BasicBlock, llvm::Value, llvm::User, llvm::Use, llvm::Instruction, llvm::CallInst, llvm::InvokeInst, llvm::CallBrInst, llvm::Use*>::isCall() const
Line
Count
Source
87
41.1M
  bool isCall() const { return I.getInt() == 1; }
llvm::CallSiteBase<llvm::Function const, llvm::BasicBlock const, llvm::Value const, llvm::User const, llvm::Use const, llvm::Instruction const, llvm::CallInst const, llvm::InvokeInst const, llvm::CallBrInst const, llvm::Use const*>::isCall() const
Line
Count
Source
87
284M
  bool isCall() const { return I.getInt() == 1; }
88
89
  /// Return true if a InvokeInst is enclosed. !I.getInt() may also signify a
90
  /// NULL instruction pointer, so check that.
91
436k
  bool isInvoke() const 
{ return 436k
getInstruction()436k
&& I.getInt() == 0; }
llvm::CallSiteBase<llvm::Function const, llvm::BasicBlock const, llvm::Value const, llvm::User const, llvm::Use const, llvm::Instruction const, llvm::CallInst const, llvm::InvokeInst const, llvm::CallBrInst const, llvm::Use const*>::isInvoke() const
Line
Count
Source
91
436k
  bool isInvoke() const 
{ return 436k
getInstruction()436k
&& I.getInt() == 0; }
llvm::CallSiteBase<llvm::Function, llvm::BasicBlock, llvm::Value, llvm::User, llvm::Use, llvm::Instruction, llvm::CallInst, llvm::InvokeInst, llvm::CallBrInst, llvm::Use*>::isInvoke() const
Line
Count
Source
91
6
  bool isInvoke() const { return getInstruction() && I.getInt() == 0; }
92
93
  /// Return true if a CallBrInst is enclosed.
94
3.99M
  bool isCallBr() const { return I.getInt() == 2; }
llvm::CallSiteBase<llvm::Function, llvm::BasicBlock, llvm::Value, llvm::User, llvm::Use, llvm::Instruction, llvm::CallInst, llvm::InvokeInst, llvm::CallBrInst, llvm::Use*>::isCallBr() const
Line
Count
Source
94
953k
  bool isCallBr() const { return I.getInt() == 2; }
llvm::CallSiteBase<llvm::Function const, llvm::BasicBlock const, llvm::Value const, llvm::User const, llvm::Use const, llvm::Instruction const, llvm::CallInst const, llvm::InvokeInst const, llvm::CallBrInst const, llvm::Use const*>::isCallBr() const
Line
Count
Source
94
3.04M
  bool isCallBr() const { return I.getInt() == 2; }
95
96
783M
  InstrTy *getInstruction() const { return I.getPointer(); }
llvm::CallSiteBase<llvm::Function, llvm::BasicBlock, llvm::Value, llvm::User, llvm::Use, llvm::Instruction, llvm::CallInst, llvm::InvokeInst, llvm::CallBrInst, llvm::Use*>::getInstruction() const
Line
Count
Source
96
118M
  InstrTy *getInstruction() const { return I.getPointer(); }
llvm::CallSiteBase<llvm::Function const, llvm::BasicBlock const, llvm::Value const, llvm::User const, llvm::Use const, llvm::Instruction const, llvm::CallInst const, llvm::InvokeInst const, llvm::CallBrInst const, llvm::Use const*>::getInstruction() const
Line
Count
Source
96
664M
  InstrTy *getInstruction() const { return I.getPointer(); }
97
11.3M
  InstrTy *operator->() const { return I.getPointer(); }
llvm::CallSiteBase<llvm::Function, llvm::BasicBlock, llvm::Value, llvm::User, llvm::Use, llvm::Instruction, llvm::CallInst, llvm::InvokeInst, llvm::CallBrInst, llvm::Use*>::operator->() const
Line
Count
Source
97
9.62M
  InstrTy *operator->() const { return I.getPointer(); }
llvm::CallSiteBase<llvm::Function const, llvm::BasicBlock const, llvm::Value const, llvm::User const, llvm::Use const, llvm::Instruction const, llvm::CallInst const, llvm::InvokeInst const, llvm::CallBrInst const, llvm::Use const*>::operator->() const
Line
Count
Source
97
1.71M
  InstrTy *operator->() const { return I.getPointer(); }
98
245M
  explicit operator bool() const { return I.getPointer(); }
llvm::CallSiteBase<llvm::Function, llvm::BasicBlock, llvm::Value, llvm::User, llvm::Use, llvm::Instruction, llvm::CallInst, llvm::InvokeInst, llvm::CallBrInst, llvm::Use*>::operator bool() const
Line
Count
Source
98
67.1M
  explicit operator bool() const { return I.getPointer(); }
llvm::CallSiteBase<llvm::Function const, llvm::BasicBlock const, llvm::Value const, llvm::User const, llvm::Use const, llvm::Instruction const, llvm::CallInst const, llvm::InvokeInst const, llvm::CallBrInst const, llvm::Use const*>::operator bool() const
Line
Count
Source
98
178M
  explicit operator bool() const { return I.getPointer(); }
99
100
  /// Get the basic block containing the call site.
101
1.81M
  BBTy* getParent() const { return getInstruction()->getParent(); }
llvm::CallSiteBase<llvm::Function const, llvm::BasicBlock const, llvm::Value const, llvm::User const, llvm::Use const, llvm::Instruction const, llvm::CallInst const, llvm::InvokeInst const, llvm::CallBrInst const, llvm::Use const*>::getParent() const
Line
Count
Source
101
1.27M
  BBTy* getParent() const { return getInstruction()->getParent(); }
llvm::CallSiteBase<llvm::Function, llvm::BasicBlock, llvm::Value, llvm::User, llvm::Use, llvm::Instruction, llvm::CallInst, llvm::InvokeInst, llvm::CallBrInst, llvm::Use*>::getParent() const
Line
Count
Source
101
543k
  BBTy* getParent() const { return getInstruction()->getParent(); }
102
103
  /// Return the pointer to function that is being called.
104
178M
  ValTy *getCalledValue() const {
105
178M
    assert(getInstruction() && "Not a call, invoke or callbr instruction!");
106
178M
    return *getCallee();
107
178M
  }
llvm::CallSiteBase<llvm::Function, llvm::BasicBlock, llvm::Value, llvm::User, llvm::Use, llvm::Instruction, llvm::CallInst, llvm::InvokeInst, llvm::CallBrInst, llvm::Use*>::getCalledValue() const
Line
Count
Source
104
31.3M
  ValTy *getCalledValue() const {
105
31.3M
    assert(getInstruction() && "Not a call, invoke or callbr instruction!");
106
31.3M
    return *getCallee();
107
31.3M
  }
llvm::CallSiteBase<llvm::Function const, llvm::BasicBlock const, llvm::Value const, llvm::User const, llvm::Use const, llvm::Instruction const, llvm::CallInst const, llvm::InvokeInst const, llvm::CallBrInst const, llvm::Use const*>::getCalledValue() const
Line
Count
Source
104
147M
  ValTy *getCalledValue() const {
105
147M
    assert(getInstruction() && "Not a call, invoke or callbr instruction!");
106
147M
    return *getCallee();
107
147M
  }
108
109
  /// Return the function being called if this is a direct call, otherwise
110
  /// return null (if it's an indirect call).
111
174M
  FunTy *getCalledFunction() const {
112
174M
    return dyn_cast<FunTy>(getCalledValue());
113
174M
  }
llvm::CallSiteBase<llvm::Function const, llvm::BasicBlock const, llvm::Value const, llvm::User const, llvm::Use const, llvm::Instruction const, llvm::CallInst const, llvm::InvokeInst const, llvm::CallBrInst const, llvm::Use const*>::getCalledFunction() const
Line
Count
Source
111
142M
  FunTy *getCalledFunction() const {
112
142M
    return dyn_cast<FunTy>(getCalledValue());
113
142M
  }
llvm::CallSiteBase<llvm::Function, llvm::BasicBlock, llvm::Value, llvm::User, llvm::Use, llvm::Instruction, llvm::CallInst, llvm::InvokeInst, llvm::CallBrInst, llvm::Use*>::getCalledFunction() const
Line
Count
Source
111
31.1M
  FunTy *getCalledFunction() const {
112
31.1M
    return dyn_cast<FunTy>(getCalledValue());
113
31.1M
  }
114
115
  /// Return true if the callsite is an indirect call.
116
250
  bool isIndirectCall() const {
117
250
    const Value *V = getCalledValue();
118
250
    if (!V)
119
0
      return false;
120
250
    if (isa<FunTy>(V) || 
isa<Constant>(V)77
)
121
184
      return false;
122
66
    if (const CallBase *CB = dyn_cast<CallBase>(getInstruction()))
123
66
      if (CB->isInlineAsm())
124
0
        return false;
125
66
    return true;
126
66
  }
llvm::CallSiteBase<llvm::Function, llvm::BasicBlock, llvm::Value, llvm::User, llvm::Use, llvm::Instruction, llvm::CallInst, llvm::InvokeInst, llvm::CallBrInst, llvm::Use*>::isIndirectCall() const
Line
Count
Source
116
124
  bool isIndirectCall() const {
117
124
    const Value *V = getCalledValue();
118
124
    if (!V)
119
0
      return false;
120
124
    if (isa<FunTy>(V) || 
isa<Constant>(V)40
)
121
93
      return false;
122
31
    if (const CallBase *CB = dyn_cast<CallBase>(getInstruction()))
123
31
      if (CB->isInlineAsm())
124
0
        return false;
125
31
    return true;
126
31
  }
llvm::CallSiteBase<llvm::Function const, llvm::BasicBlock const, llvm::Value const, llvm::User const, llvm::Use const, llvm::Instruction const, llvm::CallInst const, llvm::InvokeInst const, llvm::CallBrInst const, llvm::Use const*>::isIndirectCall() const
Line
Count
Source
116
126
  bool isIndirectCall() const {
117
126
    const Value *V = getCalledValue();
118
126
    if (!V)
119
0
      return false;
120
126
    if (isa<FunTy>(V) || 
isa<Constant>(V)37
)
121
91
      return false;
122
35
    if (const CallBase *CB = dyn_cast<CallBase>(getInstruction()))
123
35
      if (CB->isInlineAsm())
124
0
        return false;
125
35
    return true;
126
35
  }
127
128
  /// Set the callee to the specified value.  Unlike the function of the same
129
  /// name on CallBase, does not modify the type!
130
65
  void setCalledFunction(Value *V) {
131
65
    assert(getInstruction() && "Not a call, callbr, or invoke instruction!");
132
65
    assert(cast<PointerType>(V->getType())->getElementType() ==
133
65
               cast<CallBase>(getInstruction())->getFunctionType() &&
134
65
           "New callee type does not match FunctionType on call");
135
65
    *getCallee() = V;
136
65
  }
137
138
  /// Return the intrinsic ID of the intrinsic called by this CallSite,
139
  /// or Intrinsic::not_intrinsic if the called function is not an
140
  /// intrinsic, or if this CallSite is an indirect call.
141
169
  Intrinsic::ID getIntrinsicID() const {
142
169
    if (auto *F = getCalledFunction())
143
169
      return F->getIntrinsicID();
144
0
    // Don't use Intrinsic::not_intrinsic, as it will require pulling
145
0
    // Intrinsics.h into every header that uses CallSite.
146
0
    return static_cast<Intrinsic::ID>(0);
147
0
  }
148
149
  /// Determine whether the passed iterator points to the callee operand's Use.
150
  bool isCallee(Value::const_user_iterator UI) const {
151
    return isCallee(&UI.getUse());
152
  }
153
154
  /// Determine whether this Use is the callee operand's Use.
155
7.70M
  bool isCallee(const Use *U) const { return getCallee() == U; }
llvm::CallSiteBase<llvm::Function, llvm::BasicBlock, llvm::Value, llvm::User, llvm::Use, llvm::Instruction, llvm::CallInst, llvm::InvokeInst, llvm::CallBrInst, llvm::Use*>::isCallee(llvm::Use const*) const
Line
Count
Source
155
60.1k
  bool isCallee(const Use *U) const { return getCallee() == U; }
llvm::CallSiteBase<llvm::Function const, llvm::BasicBlock const, llvm::Value const, llvm::User const, llvm::Use const, llvm::Instruction const, llvm::CallInst const, llvm::InvokeInst const, llvm::CallBrInst const, llvm::Use const*>::isCallee(llvm::Use const*) const
Line
Count
Source
155
7.64M
  bool isCallee(const Use *U) const { return getCallee() == U; }
156
157
  /// Determine whether the passed iterator points to an argument operand.
158
  bool isArgOperand(Value::const_user_iterator UI) const {
159
    return isArgOperand(&UI.getUse());
160
  }
161
162
  /// Determine whether the passed use points to an argument operand.
163
471k
  bool isArgOperand(const Use *U) const {
164
471k
    assert(getInstruction() == U->getUser());
165
471k
    return arg_begin() <= U && U < arg_end();
166
471k
  }
167
168
  /// Determine whether the passed iterator points to a bundle operand.
169
  bool isBundleOperand(Value::const_user_iterator UI) const {
170
    return isBundleOperand(&UI.getUse());
171
  }
172
173
  /// Determine whether the passed use points to a bundle operand.
174
35.0k
  bool isBundleOperand(const Use *U) const {
175
35.0k
    assert(getInstruction() == U->getUser());
176
35.0k
    if (!hasOperandBundles())
177
35.0k
      return false;
178
1
    unsigned OperandNo = U - (*this)->op_begin();
179
1
    return getBundleOperandsStartIndex() <= OperandNo &&
180
1
           OperandNo < getBundleOperandsEndIndex();
181
1
  }
182
183
  /// Determine whether the passed iterator points to a data operand.
184
  bool isDataOperand(Value::const_user_iterator UI) const {
185
    return isDataOperand(&UI.getUse());
186
  }
187
188
  /// Determine whether the passed use points to a data operand.
189
470k
  bool isDataOperand(const Use *U) const {
190
470k
    return data_operands_begin() <= U && U < data_operands_end();
191
470k
  }
192
193
2.09M
  ValTy *getArgument(unsigned ArgNo) const {
194
2.09M
    assert(arg_begin() + ArgNo < arg_end() && "Argument # out of range!");
195
2.09M
    return *(arg_begin() + ArgNo);
196
2.09M
  }
llvm::CallSiteBase<llvm::Function, llvm::BasicBlock, llvm::Value, llvm::User, llvm::Use, llvm::Instruction, llvm::CallInst, llvm::InvokeInst, llvm::CallBrInst, llvm::Use*>::getArgument(unsigned int) const
Line
Count
Source
193
2.07M
  ValTy *getArgument(unsigned ArgNo) const {
194
2.07M
    assert(arg_begin() + ArgNo < arg_end() && "Argument # out of range!");
195
2.07M
    return *(arg_begin() + ArgNo);
196
2.07M
  }
llvm::CallSiteBase<llvm::Function const, llvm::BasicBlock const, llvm::Value const, llvm::User const, llvm::Use const, llvm::Instruction const, llvm::CallInst const, llvm::InvokeInst const, llvm::CallBrInst const, llvm::Use const*>::getArgument(unsigned int) const
Line
Count
Source
193
25.0k
  ValTy *getArgument(unsigned ArgNo) const {
194
25.0k
    assert(arg_begin() + ArgNo < arg_end() && "Argument # out of range!");
195
25.0k
    return *(arg_begin() + ArgNo);
196
25.0k
  }
197
198
5.21k
  void setArgument(unsigned ArgNo, Value* newVal) {
199
5.21k
    assert(getInstruction() && "Not a call, invoke or callbr instruction!");
200
5.21k
    assert(arg_begin() + ArgNo < arg_end() && "Argument # out of range!");
201
5.21k
    getInstruction()->setOperand(ArgNo, newVal);
202
5.21k
  }
203
204
  /// Given a value use iterator, returns the argument that corresponds to it.
205
  /// Iterator must actually correspond to an argument.
206
  unsigned getArgumentNo(Value::const_user_iterator I) const {
207
    return getArgumentNo(&I.getUse());
208
  }
209
210
  /// Given a use for an argument, get the argument number that corresponds to
211
  /// it.
212
507k
  unsigned getArgumentNo(const Use *U) const {
213
507k
    assert(getInstruction() && "Not a call, invoke or callbr instruction!");
214
507k
    assert(isArgOperand(U) && "Argument # out of range!");
215
507k
    return U - arg_begin();
216
507k
  }
llvm::CallSiteBase<llvm::Function, llvm::BasicBlock, llvm::Value, llvm::User, llvm::Use, llvm::Instruction, llvm::CallInst, llvm::InvokeInst, llvm::CallBrInst, llvm::Use*>::getArgumentNo(llvm::Use const*) const
Line
Count
Source
212
472k
  unsigned getArgumentNo(const Use *U) const {
213
472k
    assert(getInstruction() && "Not a call, invoke or callbr instruction!");
214
472k
    assert(isArgOperand(U) && "Argument # out of range!");
215
472k
    return U - arg_begin();
216
472k
  }
llvm::CallSiteBase<llvm::Function const, llvm::BasicBlock const, llvm::Value const, llvm::User const, llvm::Use const, llvm::Instruction const, llvm::CallInst const, llvm::InvokeInst const, llvm::CallBrInst const, llvm::Use const*>::getArgumentNo(llvm::Use const*) const
Line
Count
Source
212
35.0k
  unsigned getArgumentNo(const Use *U) const {
213
35.0k
    assert(getInstruction() && "Not a call, invoke or callbr instruction!");
214
35.0k
    assert(isArgOperand(U) && "Argument # out of range!");
215
35.0k
    return U - arg_begin();
216
35.0k
  }
217
218
  /// The type of iterator to use when looping over actual arguments at this
219
  /// call site.
220
  using arg_iterator = IterTy;
221
222
5.05M
  iterator_range<IterTy> args() const {
223
5.05M
    return make_range(arg_begin(), arg_end());
224
5.05M
  }
llvm::CallSiteBase<llvm::Function, llvm::BasicBlock, llvm::Value, llvm::User, llvm::Use, llvm::Instruction, llvm::CallInst, llvm::InvokeInst, llvm::CallBrInst, llvm::Use*>::args() const
Line
Count
Source
222
3.83M
  iterator_range<IterTy> args() const {
223
3.83M
    return make_range(arg_begin(), arg_end());
224
3.83M
  }
llvm::CallSiteBase<llvm::Function const, llvm::BasicBlock const, llvm::Value const, llvm::User const, llvm::Use const, llvm::Instruction const, llvm::CallInst const, llvm::InvokeInst const, llvm::CallBrInst const, llvm::Use const*>::args() const
Line
Count
Source
222
1.22M
  iterator_range<IterTy> args() const {
223
1.22M
    return make_range(arg_begin(), arg_end());
224
1.22M
  }
225
1.25k
  bool arg_empty() const { return arg_end() == arg_begin(); }
llvm::CallSiteBase<llvm::Function const, llvm::BasicBlock const, llvm::Value const, llvm::User const, llvm::Use const, llvm::Instruction const, llvm::CallInst const, llvm::InvokeInst const, llvm::CallBrInst const, llvm::Use const*>::arg_empty() const
Line
Count
Source
225
1.14k
  bool arg_empty() const { return arg_end() == arg_begin(); }
llvm::CallSiteBase<llvm::Function, llvm::BasicBlock, llvm::Value, llvm::User, llvm::Use, llvm::Instruction, llvm::CallInst, llvm::InvokeInst, llvm::CallBrInst, llvm::Use*>::arg_empty() const
Line
Count
Source
225
110
  bool arg_empty() const { return arg_end() == arg_begin(); }
226
3.46M
  unsigned arg_size() const { return unsigned(arg_end() - arg_begin()); }
llvm::CallSiteBase<llvm::Function const, llvm::BasicBlock const, llvm::Value const, llvm::User const, llvm::Use const, llvm::Instruction const, llvm::CallInst const, llvm::InvokeInst const, llvm::CallBrInst const, llvm::Use const*>::arg_size() const
Line
Count
Source
226
689k
  unsigned arg_size() const { return unsigned(arg_end() - arg_begin()); }
llvm::CallSiteBase<llvm::Function, llvm::BasicBlock, llvm::Value, llvm::User, llvm::Use, llvm::Instruction, llvm::CallInst, llvm::InvokeInst, llvm::CallBrInst, llvm::Use*>::arg_size() const
Line
Count
Source
226
2.77M
  unsigned arg_size() const { return unsigned(arg_end() - arg_begin()); }
227
228
  /// Given a value use iterator, return the data operand corresponding to it.
229
  /// Iterator must actually correspond to a data operand.
230
  unsigned getDataOperandNo(Value::const_user_iterator UI) const {
231
    return getDataOperandNo(&UI.getUse());
232
  }
233
234
  /// Given a use for a data operand, get the data operand number that
235
  /// corresponds to it.
236
470k
  unsigned getDataOperandNo(const Use *U) const {
237
470k
    assert(getInstruction() && "Not a call, invoke or callbr instruction!");
238
470k
    assert(isDataOperand(U) && "Data operand # out of range!");
239
470k
    return U - data_operands_begin();
240
470k
  }
241
242
  /// Type of iterator to use when looping over data operands at this call site
243
  /// (see below).
244
  using data_operand_iterator = IterTy;
245
246
  /// data_operands_begin/data_operands_end - Return iterators iterating over
247
  /// the call / invoke / callbr argument list and bundle operands. For invokes,
248
  /// this is the set of instruction operands except the invoke target and the
249
  /// two successor blocks; for calls this is the set of instruction operands
250
  /// except the call target; for callbrs the number of labels to skip must be
251
  /// determined first.
252
253
941k
  IterTy data_operands_begin() const {
254
941k
    assert(getInstruction() && "Not a call or invoke instruction!");
255
941k
    return cast<CallBase>(getInstruction())->data_operands_begin();
256
941k
  }
257
470k
  IterTy data_operands_end() const {
258
470k
    assert(getInstruction() && "Not a call or invoke instruction!");
259
470k
    return cast<CallBase>(getInstruction())->data_operands_end();
260
470k
  }
261
  iterator_range<IterTy> data_ops() const {
262
    return make_range(data_operands_begin(), data_operands_end());
263
  }
264
  bool data_operands_empty() const {
265
    return data_operands_end() == data_operands_begin();
266
  }
267
  unsigned data_operands_size() const {
268
    return std::distance(data_operands_begin(), data_operands_end());
269
  }
270
271
  /// Return the type of the instruction that generated this call site.
272
1.71M
  Type *getType() const { return (*this)->getType(); }
llvm::CallSiteBase<llvm::Function, llvm::BasicBlock, llvm::Value, llvm::User, llvm::Use, llvm::Instruction, llvm::CallInst, llvm::InvokeInst, llvm::CallBrInst, llvm::Use*>::getType() const
Line
Count
Source
272
187
  Type *getType() const { return (*this)->getType(); }
llvm::CallSiteBase<llvm::Function const, llvm::BasicBlock const, llvm::Value const, llvm::User const, llvm::Use const, llvm::Instruction const, llvm::CallInst const, llvm::InvokeInst const, llvm::CallBrInst const, llvm::Use const*>::getType() const
Line
Count
Source
272
1.71M
  Type *getType() const { return (*this)->getType(); }
273
274
  /// Return the caller function for this call site.
275
9.03M
  FunTy *getCaller() const { return (*this)->getParent()->getParent(); }
276
277
  /// Tests if this call site must be tail call optimized. Only a CallInst can
278
  /// be tail call optimized.
279
1.56M
  bool isMustTailCall() const {
280
1.56M
    return isCall() && 
cast<CallInst>(getInstruction())->isMustTailCall()1.55M
;
281
1.56M
  }
llvm::CallSiteBase<llvm::Function const, llvm::BasicBlock const, llvm::Value const, llvm::User const, llvm::Use const, llvm::Instruction const, llvm::CallInst const, llvm::InvokeInst const, llvm::CallBrInst const, llvm::Use const*>::isMustTailCall() const
Line
Count
Source
279
251k
  bool isMustTailCall() const {
280
251k
    return isCall() && 
cast<CallInst>(getInstruction())->isMustTailCall()250k
;
281
251k
  }
llvm::CallSiteBase<llvm::Function, llvm::BasicBlock, llvm::Value, llvm::User, llvm::Use, llvm::Instruction, llvm::CallInst, llvm::InvokeInst, llvm::CallBrInst, llvm::Use*>::isMustTailCall() const
Line
Count
Source
279
1.30M
  bool isMustTailCall() const {
280
1.30M
    return isCall() && 
cast<CallInst>(getInstruction())->isMustTailCall()1.30M
;
281
1.30M
  }
282
283
  /// Tests if this call site is marked as a tail call.
284
3
  bool isTailCall() const {
285
3
    return isCall() && cast<CallInst>(getInstruction())->isTailCall();
286
3
  }
287
288
#define CALLSITE_DELEGATE_GETTER(METHOD)                                       \
289
323M
  InstrTy *II = getInstruction();                                              \
290
323M
  return isCall() ? 
cast<CallInst>(II)->METHOD319M
\
291
323M
                  : 
isCallBr() ? 3.99M
cast<CallBrInst>(II)->METHOD46
\
292
3.99M
                                : 
cast<InvokeInst>(II)->METHOD3.99M
293
294
#define CALLSITE_DELEGATE_SETTER(METHOD)                                       \
295
208k
  InstrTy *II = getInstruction();                                              \
296
208k
  if (isCall())                                                                \
297
208k
    
cast<CallInst>(II)->METHOD202k
; \
298
208k
  else 
if (6.17k
isCallBr()6.17k
) \
299
6.17k
    
cast<CallBrInst>(II)->METHOD0
; \
300
6.17k
  else                                                                         \
301
6.17k
    cast<InvokeInst>(II)->METHOD
302
303
621k
  unsigned getNumArgOperands() const {
304
621k
    CALLSITE_DELEGATE_GETTER(getNumArgOperands());
305
621k
  }
306
307
127M
  ValTy *getArgOperand(unsigned i) const {
308
127M
    CALLSITE_DELEGATE_GETTER(getArgOperand(i));
309
127M
  }
llvm::CallSiteBase<llvm::Function, llvm::BasicBlock, llvm::Value, llvm::User, llvm::Use, llvm::Instruction, llvm::CallInst, llvm::InvokeInst, llvm::CallBrInst, llvm::Use*>::getArgOperand(unsigned int) const
Line
Count
Source
307
1.39k
  ValTy *getArgOperand(unsigned i) const {
308
1.39k
    CALLSITE_DELEGATE_GETTER(getArgOperand(i));
309
1.39k
  }
llvm::CallSiteBase<llvm::Function const, llvm::BasicBlock const, llvm::Value const, llvm::User const, llvm::Use const, llvm::Instruction const, llvm::CallInst const, llvm::InvokeInst const, llvm::CallBrInst const, llvm::Use const*>::getArgOperand(unsigned int) const
Line
Count
Source
307
127M
  ValTy *getArgOperand(unsigned i) const {
308
127M
    CALLSITE_DELEGATE_GETTER(getArgOperand(i));
309
127M
  }
310
311
31.2M
  ValTy *getReturnedArgOperand() const {
312
31.2M
    CALLSITE_DELEGATE_GETTER(getReturnedArgOperand());
313
31.2M
  }
llvm::CallSiteBase<llvm::Function, llvm::BasicBlock, llvm::Value, llvm::User, llvm::Use, llvm::Instruction, llvm::CallInst, llvm::InvokeInst, llvm::CallBrInst, llvm::Use*>::getReturnedArgOperand() const
Line
Count
Source
311
235k
  ValTy *getReturnedArgOperand() const {
312
235k
    CALLSITE_DELEGATE_GETTER(getReturnedArgOperand());
313
235k
  }
llvm::CallSiteBase<llvm::Function const, llvm::BasicBlock const, llvm::Value const, llvm::User const, llvm::Use const, llvm::Instruction const, llvm::CallInst const, llvm::InvokeInst const, llvm::CallBrInst const, llvm::Use const*>::getReturnedArgOperand() const
Line
Count
Source
311
31.0M
  ValTy *getReturnedArgOperand() const {
312
31.0M
    CALLSITE_DELEGATE_GETTER(getReturnedArgOperand());
313
31.0M
  }
314
315
1.51k
  bool isInlineAsm() const {
316
1.51k
    return cast<CallBase>(getInstruction())->isInlineAsm();
317
1.51k
  }
318
319
  /// Get the calling convention of the call.
320
1.69M
  CallingConv::ID getCallingConv() const {
321
1.69M
    CALLSITE_DELEGATE_GETTER(getCallingConv());
322
1.69M
  }
llvm::CallSiteBase<llvm::Function const, llvm::BasicBlock const, llvm::Value const, llvm::User const, llvm::Use const, llvm::Instruction const, llvm::CallInst const, llvm::InvokeInst const, llvm::CallBrInst const, llvm::Use const*>::getCallingConv() const
Line
Count
Source
320
1.66M
  CallingConv::ID getCallingConv() const {
321
1.66M
    CALLSITE_DELEGATE_GETTER(getCallingConv());
322
1.66M
  }
llvm::CallSiteBase<llvm::Function, llvm::BasicBlock, llvm::Value, llvm::User, llvm::Use, llvm::Instruction, llvm::CallInst, llvm::InvokeInst, llvm::CallBrInst, llvm::Use*>::getCallingConv() const
Line
Count
Source
320
22.3k
  CallingConv::ID getCallingConv() const {
321
22.3k
    CALLSITE_DELEGATE_GETTER(getCallingConv());
322
22.3k
  }
323
  /// Set the calling convention of the call.
324
115k
  void setCallingConv(CallingConv::ID CC) {
325
115k
    CALLSITE_DELEGATE_SETTER(setCallingConv(CC));
326
115k
  }
327
328
1.66M
  FunctionType *getFunctionType() const {
329
1.66M
    CALLSITE_DELEGATE_GETTER(getFunctionType());
330
1.66M
  }
llvm::CallSiteBase<llvm::Function const, llvm::BasicBlock const, llvm::Value const, llvm::User const, llvm::Use const, llvm::Instruction const, llvm::CallInst const, llvm::InvokeInst const, llvm::CallBrInst const, llvm::Use const*>::getFunctionType() const
Line
Count
Source
328
1.66M
  FunctionType *getFunctionType() const {
329
1.66M
    CALLSITE_DELEGATE_GETTER(getFunctionType());
330
1.66M
  }
llvm::CallSiteBase<llvm::Function, llvm::BasicBlock, llvm::Value, llvm::User, llvm::Use, llvm::Instruction, llvm::CallInst, llvm::InvokeInst, llvm::CallBrInst, llvm::Use*>::getFunctionType() const
Line
Count
Source
328
2.13k
  FunctionType *getFunctionType() const {
329
2.13k
    CALLSITE_DELEGATE_GETTER(getFunctionType());
330
2.13k
  }
331
332
636
  void mutateFunctionType(FunctionType *Ty) const {
333
636
    CALLSITE_DELEGATE_SETTER(mutateFunctionType(Ty));
334
636
  }
335
336
  /// Get the parameter attributes of the call.
337
3.66M
  AttributeList getAttributes() const {
338
3.66M
    CALLSITE_DELEGATE_GETTER(getAttributes());
339
3.66M
  }
llvm::CallSiteBase<llvm::Function, llvm::BasicBlock, llvm::Value, llvm::User, llvm::Use, llvm::Instruction, llvm::CallInst, llvm::InvokeInst, llvm::CallBrInst, llvm::Use*>::getAttributes() const
Line
Count
Source
337
92.0k
  AttributeList getAttributes() const {
338
92.0k
    CALLSITE_DELEGATE_GETTER(getAttributes());
339
92.0k
  }
llvm::CallSiteBase<llvm::Function const, llvm::BasicBlock const, llvm::Value const, llvm::User const, llvm::Use const, llvm::Instruction const, llvm::CallInst const, llvm::InvokeInst const, llvm::CallBrInst const, llvm::Use const*>::getAttributes() const
Line
Count
Source
337
3.57M
  AttributeList getAttributes() const {
338
3.57M
    CALLSITE_DELEGATE_GETTER(getAttributes());
339
3.57M
  }
340
  /// Set the parameter attributes of the call.
341
91.4k
  void setAttributes(AttributeList PAL) {
342
91.4k
    CALLSITE_DELEGATE_SETTER(setAttributes(PAL));
343
91.4k
  }
344
345
  void addAttribute(unsigned i, Attribute::AttrKind Kind) {
346
    CALLSITE_DELEGATE_SETTER(addAttribute(i, Kind));
347
  }
348
349
9
  void addAttribute(unsigned i, Attribute Attr) {
350
9
    CALLSITE_DELEGATE_SETTER(addAttribute(i, Attr));
351
9
  }
352
353
352
  void addParamAttr(unsigned ArgNo, Attribute::AttrKind Kind) {
354
352
    CALLSITE_DELEGATE_SETTER(addParamAttr(ArgNo, Kind));
355
352
  }
356
357
  void removeAttribute(unsigned i, Attribute::AttrKind Kind) {
358
    CALLSITE_DELEGATE_SETTER(removeAttribute(i, Kind));
359
  }
360
361
  void removeAttribute(unsigned i, StringRef Kind) {
362
    CALLSITE_DELEGATE_SETTER(removeAttribute(i, Kind));
363
  }
364
365
496
  void removeParamAttr(unsigned ArgNo, Attribute::AttrKind Kind) {
366
496
    CALLSITE_DELEGATE_SETTER(removeParamAttr(ArgNo, Kind));
367
496
  }
368
369
  /// Return true if this function has the given attribute.
370
1.12M
  bool hasFnAttr(Attribute::AttrKind Kind) const {
371
1.12M
    CALLSITE_DELEGATE_GETTER(hasFnAttr(Kind));
372
1.12M
  }
llvm::CallSiteBase<llvm::Function, llvm::BasicBlock, llvm::Value, llvm::User, llvm::Use, llvm::Instruction, llvm::CallInst, llvm::InvokeInst, llvm::CallBrInst, llvm::Use*>::hasFnAttr(llvm::Attribute::AttrKind) const
Line
Count
Source
370
516k
  bool hasFnAttr(Attribute::AttrKind Kind) const {
371
516k
    CALLSITE_DELEGATE_GETTER(hasFnAttr(Kind));
372
516k
  }
llvm::CallSiteBase<llvm::Function const, llvm::BasicBlock const, llvm::Value const, llvm::User const, llvm::Use const, llvm::Instruction const, llvm::CallInst const, llvm::InvokeInst const, llvm::CallBrInst const, llvm::Use const*>::hasFnAttr(llvm::Attribute::AttrKind) const
Line
Count
Source
370
610k
  bool hasFnAttr(Attribute::AttrKind Kind) const {
371
610k
    CALLSITE_DELEGATE_GETTER(hasFnAttr(Kind));
372
610k
  }
373
374
  /// Return true if this function has the given attribute.
375
  bool hasFnAttr(StringRef Kind) const {
376
    CALLSITE_DELEGATE_GETTER(hasFnAttr(Kind));
377
  }
378
379
  /// Return true if this return value has the given attribute.
380
3.65M
  bool hasRetAttr(Attribute::AttrKind Kind) const {
381
3.65M
    CALLSITE_DELEGATE_GETTER(hasRetAttr(Kind));
382
3.65M
  }
llvm::CallSiteBase<llvm::Function const, llvm::BasicBlock const, llvm::Value const, llvm::User const, llvm::Use const, llvm::Instruction const, llvm::CallInst const, llvm::InvokeInst const, llvm::CallBrInst const, llvm::Use const*>::hasRetAttr(llvm::Attribute::AttrKind) const
Line
Count
Source
380
3.64M
  bool hasRetAttr(Attribute::AttrKind Kind) const {
381
3.64M
    CALLSITE_DELEGATE_GETTER(hasRetAttr(Kind));
382
3.64M
  }
llvm::CallSiteBase<llvm::Function, llvm::BasicBlock, llvm::Value, llvm::User, llvm::Use, llvm::Instruction, llvm::CallInst, llvm::InvokeInst, llvm::CallBrInst, llvm::Use*>::hasRetAttr(llvm::Attribute::AttrKind) const
Line
Count
Source
380
5.87k
  bool hasRetAttr(Attribute::AttrKind Kind) const {
381
5.87k
    CALLSITE_DELEGATE_GETTER(hasRetAttr(Kind));
382
5.87k
  }
383
384
  /// Return true if the call or the callee has the given attribute.
385
10.5M
  bool paramHasAttr(unsigned ArgNo, Attribute::AttrKind Kind) const {
386
10.5M
    CALLSITE_DELEGATE_GETTER(paramHasAttr(ArgNo, Kind));
387
10.5M
  }
llvm::CallSiteBase<llvm::Function const, llvm::BasicBlock const, llvm::Value const, llvm::User const, llvm::Use const, llvm::Instruction const, llvm::CallInst const, llvm::InvokeInst const, llvm::CallBrInst const, llvm::Use const*>::paramHasAttr(unsigned int, llvm::Attribute::AttrKind) const
Line
Count
Source
385
11.1k
  bool paramHasAttr(unsigned ArgNo, Attribute::AttrKind Kind) const {
386
11.1k
    CALLSITE_DELEGATE_GETTER(paramHasAttr(ArgNo, Kind));
387
11.1k
  }
llvm::CallSiteBase<llvm::Function, llvm::BasicBlock, llvm::Value, llvm::User, llvm::Use, llvm::Instruction, llvm::CallInst, llvm::InvokeInst, llvm::CallBrInst, llvm::Use*>::paramHasAttr(unsigned int, llvm::Attribute::AttrKind) const
Line
Count
Source
385
10.5M
  bool paramHasAttr(unsigned ArgNo, Attribute::AttrKind Kind) const {
386
10.5M
    CALLSITE_DELEGATE_GETTER(paramHasAttr(ArgNo, Kind));
387
10.5M
  }
388
389
  Attribute getAttribute(unsigned i, Attribute::AttrKind Kind) const {
390
    CALLSITE_DELEGATE_GETTER(getAttribute(i, Kind));
391
  }
392
393
  Attribute getAttribute(unsigned i, StringRef Kind) const {
394
    CALLSITE_DELEGATE_GETTER(getAttribute(i, Kind));
395
  }
396
397
  /// Return true if the data operand at index \p i directly or indirectly has
398
  /// the attribute \p A.
399
  ///
400
  /// Normal call, invoke or callbr arguments have per operand attributes, as
401
  /// specified in the attribute set attached to this instruction, while operand
402
  /// bundle operands may have some attributes implied by the type of its
403
  /// containing operand bundle.
404
703k
  bool dataOperandHasImpliedAttr(unsigned i, Attribute::AttrKind Kind) const {
405
703k
    CALLSITE_DELEGATE_GETTER(dataOperandHasImpliedAttr(i, Kind));
406
703k
  }
llvm::CallSiteBase<llvm::Function, llvm::BasicBlock, llvm::Value, llvm::User, llvm::Use, llvm::Instruction, llvm::CallInst, llvm::InvokeInst, llvm::CallBrInst, llvm::Use*>::dataOperandHasImpliedAttr(unsigned int, llvm::Attribute::AttrKind) const
Line
Count
Source
404
702k
  bool dataOperandHasImpliedAttr(unsigned i, Attribute::AttrKind Kind) const {
405
702k
    CALLSITE_DELEGATE_GETTER(dataOperandHasImpliedAttr(i, Kind));
406
702k
  }
llvm::CallSiteBase<llvm::Function const, llvm::BasicBlock const, llvm::Value const, llvm::User const, llvm::Use const, llvm::Instruction const, llvm::CallInst const, llvm::InvokeInst const, llvm::CallBrInst const, llvm::Use const*>::dataOperandHasImpliedAttr(unsigned int, llvm::Attribute::AttrKind) const
Line
Count
Source
404
219
  bool dataOperandHasImpliedAttr(unsigned i, Attribute::AttrKind Kind) const {
405
219
    CALLSITE_DELEGATE_GETTER(dataOperandHasImpliedAttr(i, Kind));
406
219
  }
407
408
  /// Extract the alignment of the return value.
409
  unsigned getRetAlignment() const {
410
    CALLSITE_DELEGATE_GETTER(getRetAlignment());
411
  }
412
413
  /// Extract the alignment for a call or parameter (0=unknown).
414
37
  unsigned getParamAlignment(unsigned ArgNo) const {
415
37
    CALLSITE_DELEGATE_GETTER(getParamAlignment(ArgNo));
416
37
  }
llvm::CallSiteBase<llvm::Function, llvm::BasicBlock, llvm::Value, llvm::User, llvm::Use, llvm::Instruction, llvm::CallInst, llvm::InvokeInst, llvm::CallBrInst, llvm::Use*>::getParamAlignment(unsigned int) const
Line
Count
Source
414
31
  unsigned getParamAlignment(unsigned ArgNo) const {
415
31
    CALLSITE_DELEGATE_GETTER(getParamAlignment(ArgNo));
416
31
  }
llvm::CallSiteBase<llvm::Function const, llvm::BasicBlock const, llvm::Value const, llvm::User const, llvm::Use const, llvm::Instruction const, llvm::CallInst const, llvm::InvokeInst const, llvm::CallBrInst const, llvm::Use const*>::getParamAlignment(unsigned int) const
Line
Count
Source
414
6
  unsigned getParamAlignment(unsigned ArgNo) const {
415
6
    CALLSITE_DELEGATE_GETTER(getParamAlignment(ArgNo));
416
6
  }
417
418
  /// Extract the byval type for a call or parameter (nullptr=unknown).
419
  Type *getParamByValType(unsigned ArgNo) const {
420
    CALLSITE_DELEGATE_GETTER(getParamByValType(ArgNo));
421
  }
422
423
  /// Extract the number of dereferenceable bytes for a call or parameter
424
  /// (0=unknown).
425
16
  uint64_t getDereferenceableBytes(unsigned i) const {
426
16
    CALLSITE_DELEGATE_GETTER(getDereferenceableBytes(i));
427
16
  }
428
429
  /// Extract the number of dereferenceable_or_null bytes for a call or
430
  /// parameter (0=unknown).
431
0
  uint64_t getDereferenceableOrNullBytes(unsigned i) const {
432
0
    CALLSITE_DELEGATE_GETTER(getDereferenceableOrNullBytes(i));
433
0
  }
434
435
  /// Determine if the return value is marked with NoAlias attribute.
436
18
  bool returnDoesNotAlias() const {
437
18
    CALLSITE_DELEGATE_GETTER(returnDoesNotAlias());
438
18
  }
439
440
  /// Return true if the call should not be treated as a call to a builtin.
441
92.7M
  bool isNoBuiltin() const {
442
92.7M
    CALLSITE_DELEGATE_GETTER(isNoBuiltin());
443
92.7M
  }
444
445
  /// Return true if the call requires strict floating point semantics.
446
  bool isStrictFP() const {
447
    CALLSITE_DELEGATE_GETTER(isStrictFP());
448
  }
449
450
  /// Return true if the call should not be inlined.
451
232
  bool isNoInline() const {
452
232
    CALLSITE_DELEGATE_GETTER(isNoInline());
453
232
  }
454
  void setIsNoInline(bool Value = true) {
455
    CALLSITE_DELEGATE_SETTER(setIsNoInline(Value));
456
  }
457
458
  /// Determine if the call does not access memory.
459
77.8k
  bool doesNotAccessMemory() const {
460
77.8k
    CALLSITE_DELEGATE_GETTER(doesNotAccessMemory());
461
77.8k
  }
llvm::CallSiteBase<llvm::Function, llvm::BasicBlock, llvm::Value, llvm::User, llvm::Use, llvm::Instruction, llvm::CallInst, llvm::InvokeInst, llvm::CallBrInst, llvm::Use*>::doesNotAccessMemory() const
Line
Count
Source
459
77.8k
  bool doesNotAccessMemory() const {
460
77.8k
    CALLSITE_DELEGATE_GETTER(doesNotAccessMemory());
461
77.8k
  }
llvm::CallSiteBase<llvm::Function const, llvm::BasicBlock const, llvm::Value const, llvm::User const, llvm::Use const, llvm::Instruction const, llvm::CallInst const, llvm::InvokeInst const, llvm::CallBrInst const, llvm::Use const*>::doesNotAccessMemory() const
Line
Count
Source
459
10
  bool doesNotAccessMemory() const {
460
10
    CALLSITE_DELEGATE_GETTER(doesNotAccessMemory());
461
10
  }
462
  void setDoesNotAccessMemory() {
463
    CALLSITE_DELEGATE_SETTER(setDoesNotAccessMemory());
464
  }
465
466
  /// Determine if the call does not access or only reads memory.
467
950k
  bool onlyReadsMemory() const {
468
950k
    CALLSITE_DELEGATE_GETTER(onlyReadsMemory());
469
950k
  }
llvm::CallSiteBase<llvm::Function const, llvm::BasicBlock const, llvm::Value const, llvm::User const, llvm::Use const, llvm::Instruction const, llvm::CallInst const, llvm::InvokeInst const, llvm::CallBrInst const, llvm::Use const*>::onlyReadsMemory() const
Line
Count
Source
467
618k
  bool onlyReadsMemory() const {
468
618k
    CALLSITE_DELEGATE_GETTER(onlyReadsMemory());
469
618k
  }
llvm::CallSiteBase<llvm::Function, llvm::BasicBlock, llvm::Value, llvm::User, llvm::Use, llvm::Instruction, llvm::CallInst, llvm::InvokeInst, llvm::CallBrInst, llvm::Use*>::onlyReadsMemory() const
Line
Count
Source
467
331k
  bool onlyReadsMemory() const {
468
331k
    CALLSITE_DELEGATE_GETTER(onlyReadsMemory());
469
331k
  }
470
  void setOnlyReadsMemory() {
471
    CALLSITE_DELEGATE_SETTER(setOnlyReadsMemory());
472
  }
473
474
  /// Determine if the call does not access or only writes memory.
475
  bool doesNotReadMemory() const {
476
    CALLSITE_DELEGATE_GETTER(doesNotReadMemory());
477
  }
478
  void setDoesNotReadMemory() {
479
    CALLSITE_DELEGATE_SETTER(setDoesNotReadMemory());
480
  }
481
482
  /// Determine if the call can access memmory only using pointers based
483
  /// on its arguments.
484
533k
  bool onlyAccessesArgMemory() const {
485
533k
    CALLSITE_DELEGATE_GETTER(onlyAccessesArgMemory());
486
533k
  }
487
  void setOnlyAccessesArgMemory() {
488
    CALLSITE_DELEGATE_SETTER(setOnlyAccessesArgMemory());
489
  }
490
491
  /// Determine if the function may only access memory that is
492
  /// inaccessible from the IR.
493
  bool onlyAccessesInaccessibleMemory() const {
494
    CALLSITE_DELEGATE_GETTER(onlyAccessesInaccessibleMemory());
495
  }
496
  void setOnlyAccessesInaccessibleMemory() {
497
    CALLSITE_DELEGATE_SETTER(setOnlyAccessesInaccessibleMemory());
498
  }
499
500
  /// Determine if the function may only access memory that is
501
  /// either inaccessible from the IR or pointed to by its arguments.
502
  bool onlyAccessesInaccessibleMemOrArgMem() const {
503
    CALLSITE_DELEGATE_GETTER(onlyAccessesInaccessibleMemOrArgMem());
504
  }
505
  void setOnlyAccessesInaccessibleMemOrArgMem() {
506
    CALLSITE_DELEGATE_SETTER(setOnlyAccessesInaccessibleMemOrArgMem());
507
  }
508
509
  /// Determine if the call cannot return.
510
443k
  bool doesNotReturn() const {
511
443k
    CALLSITE_DELEGATE_GETTER(doesNotReturn());
512
443k
  }
llvm::CallSiteBase<llvm::Function const, llvm::BasicBlock const, llvm::Value const, llvm::User const, llvm::Use const, llvm::Instruction const, llvm::CallInst const, llvm::InvokeInst const, llvm::CallBrInst const, llvm::Use const*>::doesNotReturn() const
Line
Count
Source
510
442k
  bool doesNotReturn() const {
511
442k
    CALLSITE_DELEGATE_GETTER(doesNotReturn());
512
442k
  }
llvm::CallSiteBase<llvm::Function, llvm::BasicBlock, llvm::Value, llvm::User, llvm::Use, llvm::Instruction, llvm::CallInst, llvm::InvokeInst, llvm::CallBrInst, llvm::Use*>::doesNotReturn() const
Line
Count
Source
510
772
  bool doesNotReturn() const {
511
772
    CALLSITE_DELEGATE_GETTER(doesNotReturn());
512
772
  }
513
  void setDoesNotReturn() {
514
    CALLSITE_DELEGATE_SETTER(setDoesNotReturn());
515
  }
516
517
  /// Determine if the call cannot unwind.
518
1.18M
  bool doesNotThrow() const {
519
1.18M
    CALLSITE_DELEGATE_GETTER(doesNotThrow());
520
1.18M
  }
llvm::CallSiteBase<llvm::Function, llvm::BasicBlock, llvm::Value, llvm::User, llvm::Use, llvm::Instruction, llvm::CallInst, llvm::InvokeInst, llvm::CallBrInst, llvm::Use*>::doesNotThrow() const
Line
Count
Source
518
541k
  bool doesNotThrow() const {
519
541k
    CALLSITE_DELEGATE_GETTER(doesNotThrow());
520
541k
  }
llvm::CallSiteBase<llvm::Function const, llvm::BasicBlock const, llvm::Value const, llvm::User const, llvm::Use const, llvm::Instruction const, llvm::CallInst const, llvm::InvokeInst const, llvm::CallBrInst const, llvm::Use const*>::doesNotThrow() const
Line
Count
Source
518
639k
  bool doesNotThrow() const {
519
639k
    CALLSITE_DELEGATE_GETTER(doesNotThrow());
520
639k
  }
521
  void setDoesNotThrow() {
522
    CALLSITE_DELEGATE_SETTER(setDoesNotThrow());
523
  }
524
525
  /// Determine if the call can be duplicated.
526
1.64M
  bool cannotDuplicate() const {
527
1.64M
    CALLSITE_DELEGATE_GETTER(cannotDuplicate());
528
1.64M
  }
llvm::CallSiteBase<llvm::Function, llvm::BasicBlock, llvm::Value, llvm::User, llvm::Use, llvm::Instruction, llvm::CallInst, llvm::InvokeInst, llvm::CallBrInst, llvm::Use*>::cannotDuplicate() const
Line
Count
Source
526
1.64M
  bool cannotDuplicate() const {
527
1.64M
    CALLSITE_DELEGATE_GETTER(cannotDuplicate());
528
1.64M
  }
llvm::CallSiteBase<llvm::Function const, llvm::BasicBlock const, llvm::Value const, llvm::User const, llvm::Use const, llvm::Instruction const, llvm::CallInst const, llvm::InvokeInst const, llvm::CallBrInst const, llvm::Use const*>::cannotDuplicate() const
Line
Count
Source
526
2
  bool cannotDuplicate() const {
527
2
    CALLSITE_DELEGATE_GETTER(cannotDuplicate());
528
2
  }
529
12
  void setCannotDuplicate() {
530
12
    CALLSITE_DELEGATE_SETTER(setCannotDuplicate());
531
12
  }
532
533
  /// Determine if the call is convergent.
534
1.65M
  bool isConvergent() const {
535
1.65M
    CALLSITE_DELEGATE_GETTER(isConvergent());
536
1.65M
  }
llvm::CallSiteBase<llvm::Function const, llvm::BasicBlock const, llvm::Value const, llvm::User const, llvm::Use const, llvm::Instruction const, llvm::CallInst const, llvm::InvokeInst const, llvm::CallBrInst const, llvm::Use const*>::isConvergent() const
Line
Count
Source
534
461k
  bool isConvergent() const {
535
461k
    CALLSITE_DELEGATE_GETTER(isConvergent());
536
461k
  }
llvm::CallSiteBase<llvm::Function, llvm::BasicBlock, llvm::Value, llvm::User, llvm::Use, llvm::Instruction, llvm::CallInst, llvm::InvokeInst, llvm::CallBrInst, llvm::Use*>::isConvergent() const
Line
Count
Source
534
1.19M
  bool isConvergent() const {
535
1.19M
    CALLSITE_DELEGATE_GETTER(isConvergent());
536
1.19M
  }
537
  void setConvergent() {
538
    CALLSITE_DELEGATE_SETTER(setConvergent());
539
  }
540
  void setNotConvergent() {
541
    CALLSITE_DELEGATE_SETTER(setNotConvergent());
542
  }
543
544
6.71k
  unsigned getNumOperandBundles() const {
545
6.71k
    CALLSITE_DELEGATE_GETTER(getNumOperandBundles());
546
6.71k
  }
llvm::CallSiteBase<llvm::Function const, llvm::BasicBlock const, llvm::Value const, llvm::User const, llvm::Use const, llvm::Instruction const, llvm::CallInst const, llvm::InvokeInst const, llvm::CallBrInst const, llvm::Use const*>::getNumOperandBundles() const
Line
Count
Source
544
6.66k
  unsigned getNumOperandBundles() const {
545
6.66k
    CALLSITE_DELEGATE_GETTER(getNumOperandBundles());
546
6.66k
  }
llvm::CallSiteBase<llvm::Function, llvm::BasicBlock, llvm::Value, llvm::User, llvm::Use, llvm::Instruction, llvm::CallInst, llvm::InvokeInst, llvm::CallBrInst, llvm::Use*>::getNumOperandBundles() const
Line
Count
Source
544
52
  unsigned getNumOperandBundles() const {
545
52
    CALLSITE_DELEGATE_GETTER(getNumOperandBundles());
546
52
  }
547
548
1.00M
  bool hasOperandBundles() const {
549
1.00M
    CALLSITE_DELEGATE_GETTER(hasOperandBundles());
550
1.00M
  }
llvm::CallSiteBase<llvm::Function const, llvm::BasicBlock const, llvm::Value const, llvm::User const, llvm::Use const, llvm::Instruction const, llvm::CallInst const, llvm::InvokeInst const, llvm::CallBrInst const, llvm::Use const*>::hasOperandBundles() const
Line
Count
Source
548
466k
  bool hasOperandBundles() const {
549
466k
    CALLSITE_DELEGATE_GETTER(hasOperandBundles());
550
466k
  }
llvm::CallSiteBase<llvm::Function, llvm::BasicBlock, llvm::Value, llvm::User, llvm::Use, llvm::Instruction, llvm::CallInst, llvm::InvokeInst, llvm::CallBrInst, llvm::Use*>::hasOperandBundles() const
Line
Count
Source
548
541k
  bool hasOperandBundles() const {
549
541k
    CALLSITE_DELEGATE_GETTER(hasOperandBundles());
550
541k
  }
551
552
1
  unsigned getBundleOperandsStartIndex() const {
553
1
    CALLSITE_DELEGATE_GETTER(getBundleOperandsStartIndex());
554
1
  }
555
556
1
  unsigned getBundleOperandsEndIndex() const {
557
1
    CALLSITE_DELEGATE_GETTER(getBundleOperandsEndIndex());
558
1
  }
559
560
  unsigned getNumTotalBundleOperands() const {
561
    CALLSITE_DELEGATE_GETTER(getNumTotalBundleOperands());
562
  }
563
564
133
  OperandBundleUse getOperandBundleAt(unsigned Index) const {
565
133
    CALLSITE_DELEGATE_GETTER(getOperandBundleAt(Index));
566
133
  }
llvm::CallSiteBase<llvm::Function const, llvm::BasicBlock const, llvm::Value const, llvm::User const, llvm::Use const, llvm::Instruction const, llvm::CallInst const, llvm::InvokeInst const, llvm::CallBrInst const, llvm::Use const*>::getOperandBundleAt(unsigned int) const
Line
Count
Source
564
91
  OperandBundleUse getOperandBundleAt(unsigned Index) const {
565
91
    CALLSITE_DELEGATE_GETTER(getOperandBundleAt(Index));
566
91
  }
llvm::CallSiteBase<llvm::Function, llvm::BasicBlock, llvm::Value, llvm::User, llvm::Use, llvm::Instruction, llvm::CallInst, llvm::InvokeInst, llvm::CallBrInst, llvm::Use*>::getOperandBundleAt(unsigned int) const
Line
Count
Source
564
42
  OperandBundleUse getOperandBundleAt(unsigned Index) const {
565
42
    CALLSITE_DELEGATE_GETTER(getOperandBundleAt(Index));
566
42
  }
567
568
  Optional<OperandBundleUse> getOperandBundle(StringRef Name) const {
569
    CALLSITE_DELEGATE_GETTER(getOperandBundle(Name));
570
  }
571
572
4.33M
  Optional<OperandBundleUse> getOperandBundle(uint32_t ID) const {
573
4.33M
    CALLSITE_DELEGATE_GETTER(getOperandBundle(ID));
574
4.33M
  }
575
576
  unsigned countOperandBundlesOfType(uint32_t ID) const {
577
    CALLSITE_DELEGATE_GETTER(countOperandBundlesOfType(ID));
578
  }
579
580
2.51M
  bool isBundleOperand(unsigned Idx) const {
581
2.51M
    CALLSITE_DELEGATE_GETTER(isBundleOperand(Idx));
582
2.51M
  }
583
584
19.2M
  IterTy arg_begin() const {
585
19.2M
    CALLSITE_DELEGATE_GETTER(arg_begin());
586
19.2M
  }
llvm::CallSiteBase<llvm::Function, llvm::BasicBlock, llvm::Value, llvm::User, llvm::Use, llvm::Instruction, llvm::CallInst, llvm::InvokeInst, llvm::CallBrInst, llvm::Use*>::arg_begin() const
Line
Count
Source
584
10.7M
  IterTy arg_begin() const {
585
10.7M
    CALLSITE_DELEGATE_GETTER(arg_begin());
586
10.7M
  }
llvm::CallSiteBase<llvm::Function const, llvm::BasicBlock const, llvm::Value const, llvm::User const, llvm::Use const, llvm::Instruction const, llvm::CallInst const, llvm::InvokeInst const, llvm::CallBrInst const, llvm::Use const*>::arg_begin() const
Line
Count
Source
584
8.51M
  IterTy arg_begin() const {
585
8.51M
    CALLSITE_DELEGATE_GETTER(arg_begin());
586
8.51M
  }
587
588
14.8M
  IterTy arg_end() const {
589
14.8M
    CALLSITE_DELEGATE_GETTER(arg_end());
590
14.8M
  }
llvm::CallSiteBase<llvm::Function const, llvm::BasicBlock const, llvm::Value const, llvm::User const, llvm::Use const, llvm::Instruction const, llvm::CallInst const, llvm::InvokeInst const, llvm::CallBrInst const, llvm::Use const*>::arg_end() const
Line
Count
Source
588
7.44M
  IterTy arg_end() const {
589
7.44M
    CALLSITE_DELEGATE_GETTER(arg_end());
590
7.44M
  }
llvm::CallSiteBase<llvm::Function, llvm::BasicBlock, llvm::Value, llvm::User, llvm::Use, llvm::Instruction, llvm::CallInst, llvm::InvokeInst, llvm::CallBrInst, llvm::Use*>::arg_end() const
Line
Count
Source
588
7.35M
  IterTy arg_end() const {
589
7.35M
    CALLSITE_DELEGATE_GETTER(arg_end());
590
7.35M
  }
591
592
#undef CALLSITE_DELEGATE_GETTER
593
#undef CALLSITE_DELEGATE_SETTER
594
595
21.7k
  void getOperandBundlesAsDefs(SmallVectorImpl<OperandBundleDef> &Defs) const {
596
21.7k
    // Since this is actually a getter that "looks like" a setter, don't use the
597
21.7k
    // above macros to avoid confusion.
598
21.7k
    cast<CallBase>(getInstruction())->getOperandBundlesAsDefs(Defs);
599
21.7k
  }
600
601
  /// Determine whether this data operand is not captured.
602
542k
  bool doesNotCapture(unsigned OpNo) const {
603
542k
    return dataOperandHasImpliedAttr(OpNo + 1, Attribute::NoCapture);
604
542k
  }
llvm::CallSiteBase<llvm::Function const, llvm::BasicBlock const, llvm::Value const, llvm::User const, llvm::Use const, llvm::Instruction const, llvm::CallInst const, llvm::InvokeInst const, llvm::CallBrInst const, llvm::Use const*>::doesNotCapture(unsigned int) const
Line
Count
Source
602
207
  bool doesNotCapture(unsigned OpNo) const {
603
207
    return dataOperandHasImpliedAttr(OpNo + 1, Attribute::NoCapture);
604
207
  }
llvm::CallSiteBase<llvm::Function, llvm::BasicBlock, llvm::Value, llvm::User, llvm::Use, llvm::Instruction, llvm::CallInst, llvm::InvokeInst, llvm::CallBrInst, llvm::Use*>::doesNotCapture(unsigned int) const
Line
Count
Source
602
542k
  bool doesNotCapture(unsigned OpNo) const {
603
542k
    return dataOperandHasImpliedAttr(OpNo + 1, Attribute::NoCapture);
604
542k
  }
605
606
  /// Determine whether this argument is passed by value.
607
4.70M
  bool isByValArgument(unsigned ArgNo) const {
608
4.70M
    return paramHasAttr(ArgNo, Attribute::ByVal);
609
4.70M
  }
610
611
  /// Determine whether this argument is passed in an alloca.
612
  bool isInAllocaArgument(unsigned ArgNo) const {
613
    return paramHasAttr(ArgNo, Attribute::InAlloca);
614
  }
615
616
  /// Determine whether this argument is passed by value or in an alloca.
617
  bool isByValOrInAllocaArgument(unsigned ArgNo) const {
618
    return paramHasAttr(ArgNo, Attribute::ByVal) ||
619
           paramHasAttr(ArgNo, Attribute::InAlloca);
620
  }
621
622
  /// Determine if there are is an inalloca argument. Only the last argument can
623
  /// have the inalloca attribute.
624
1.04k
  bool hasInAllocaArgument() const {
625
1.04k
    return !arg_empty() && 
paramHasAttr(arg_size() - 1, Attribute::InAlloca)665
;
626
1.04k
  }
627
628
34.7k
  bool doesNotAccessMemory(unsigned OpNo) const {
629
34.7k
    return dataOperandHasImpliedAttr(OpNo + 1, Attribute::ReadNone);
630
34.7k
  }
llvm::CallSiteBase<llvm::Function const, llvm::BasicBlock const, llvm::Value const, llvm::User const, llvm::Use const, llvm::Instruction const, llvm::CallInst const, llvm::InvokeInst const, llvm::CallBrInst const, llvm::Use const*>::doesNotAccessMemory(unsigned int) const
Line
Count
Source
628
12
  bool doesNotAccessMemory(unsigned OpNo) const {
629
12
    return dataOperandHasImpliedAttr(OpNo + 1, Attribute::ReadNone);
630
12
  }
llvm::CallSiteBase<llvm::Function, llvm::BasicBlock, llvm::Value, llvm::User, llvm::Use, llvm::Instruction, llvm::CallInst, llvm::InvokeInst, llvm::CallBrInst, llvm::Use*>::doesNotAccessMemory(unsigned int) const
Line
Count
Source
628
34.7k
  bool doesNotAccessMemory(unsigned OpNo) const {
629
34.7k
    return dataOperandHasImpliedAttr(OpNo + 1, Attribute::ReadNone);
630
34.7k
  }
631
632
64.6k
  bool onlyReadsMemory(unsigned OpNo) const {
633
64.6k
    return dataOperandHasImpliedAttr(OpNo + 1, Attribute::ReadOnly) ||
634
64.6k
           
dataOperandHasImpliedAttr(OpNo + 1, Attribute::ReadNone)61.0k
;
635
64.6k
  }
636
637
  bool doesNotReadMemory(unsigned OpNo) const {
638
    return dataOperandHasImpliedAttr(OpNo + 1, Attribute::WriteOnly) ||
639
           dataOperandHasImpliedAttr(OpNo + 1, Attribute::ReadNone);
640
  }
641
642
  /// Return true if the return value is known to be not null.
643
  /// This may be because it has the nonnull attribute, or because at least
644
  /// one byte is dereferenceable and the pointer is in addrspace(0).
645
  bool isReturnNonNull() const {
646
    if (hasRetAttr(Attribute::NonNull))
647
      return true;
648
    else if (getDereferenceableBytes(AttributeList::ReturnIndex) > 0 &&
649
             !NullPointerIsDefined(getCaller(),
650
                                   getType()->getPointerAddressSpace()))
651
      return true;
652
653
    return false;
654
  }
655
656
  /// Returns true if this CallSite passes the given Value* as an argument to
657
  /// the called function.
658
  bool hasArgument(const Value *Arg) const {
659
    for (arg_iterator AI = this->arg_begin(), E = this->arg_end(); AI != E;
660
         ++AI)
661
      if (AI->get() == Arg)
662
        return true;
663
    return false;
664
  }
665
666
private:
667
186M
  IterTy getCallee() const {
668
186M
    return cast<CallBase>(getInstruction())->op_end() - 1;
669
186M
  }
llvm::CallSiteBase<llvm::Function, llvm::BasicBlock, llvm::Value, llvm::User, llvm::Use, llvm::Instruction, llvm::CallInst, llvm::InvokeInst, llvm::CallBrInst, llvm::Use*>::getCallee() const
Line
Count
Source
667
31.3M
  IterTy getCallee() const {
668
31.3M
    return cast<CallBase>(getInstruction())->op_end() - 1;
669
31.3M
  }
llvm::CallSiteBase<llvm::Function const, llvm::BasicBlock const, llvm::Value const, llvm::User const, llvm::Use const, llvm::Instruction const, llvm::CallInst const, llvm::InvokeInst const, llvm::CallBrInst const, llvm::Use const*>::getCallee() const
Line
Count
Source
667
154M
  IterTy getCallee() const {
668
154M
    return cast<CallBase>(getInstruction())->op_end() - 1;
669
154M
  }
670
};
671
672
class CallSite : public CallSiteBase<Function, BasicBlock, Value, User, Use,
673
                                     Instruction, CallInst, InvokeInst,
674
                                     CallBrInst, User::op_iterator> {
675
public:
676
23.7k
  CallSite() = default;
677
0
  CallSite(CallSiteBase B) : CallSiteBase(B) {}
678
22.1M
  CallSite(CallInst *CI) : CallSiteBase(CI) {}
679
710k
  CallSite(InvokeInst *II) : CallSiteBase(II) {}
680
10
  CallSite(CallBrInst *CBI) : CallSiteBase(CBI) {}
681
48.1M
  explicit CallSite(Instruction *II) : CallSiteBase(II) {}
682
25.6M
  explicit CallSite(Value *V) : CallSiteBase(V) {}
683
684
4.51k
  bool operator==(const CallSite &CS) const { return I == CS.I; }
685
0
  bool operator!=(const CallSite &CS) const { return I != CS.I; }
686
0
  bool operator<(const CallSite &CS) const {
687
0
    return getInstruction() < CS.getInstruction();
688
0
  }
689
690
private:
691
  friend struct DenseMapInfo<CallSite>;
692
693
  User::op_iterator getCallee() const;
694
};
695
696
/// AbstractCallSite
697
///
698
/// An abstract call site is a wrapper that allows to treat direct,
699
/// indirect, and callback calls the same. If an abstract call site
700
/// represents a direct or indirect call site it behaves like a stripped
701
/// down version of a normal call site object. The abstract call site can
702
/// also represent a callback call, thus the fact that the initially
703
/// called function (=broker) may invoke a third one (=callback callee).
704
/// In this case, the abstract call site hides the middle man, hence the
705
/// broker function. The result is a representation of the callback call,
706
/// inside the broker, but in the context of the original call to the broker.
707
///
708
/// There are up to three functions involved when we talk about callback call
709
/// sites. The caller (1), which invokes the broker function. The broker
710
/// function (2), that will invoke the callee zero or more times. And finally
711
/// the callee (3), which is the target of the callback call.
712
///
713
/// The abstract call site will handle the mapping from parameters to arguments
714
/// depending on the semantic of the broker function. However, it is important
715
/// to note that the mapping is often partial. Thus, some arguments of the
716
/// call/invoke instruction are mapped to parameters of the callee while others
717
/// are not.
718
class AbstractCallSite {
719
public:
720
721
  /// The encoding of a callback with regards to the underlying instruction.
722
  struct CallbackInfo {
723
724
    /// For direct/indirect calls the parameter encoding is empty. If it is not,
725
    /// the abstract call site represents a callback. In that case, the first
726
    /// element of the encoding vector represents which argument of the call
727
    /// site CS is the callback callee. The remaining elements map parameters
728
    /// (identified by their position) to the arguments that will be passed
729
    /// through (also identified by position but in the call site instruction).
730
    ///
731
    /// NOTE that we use LLVM argument numbers (starting at 0) and not
732
    /// clang/source argument numbers (starting at 1). The -1 entries represent
733
    /// unknown values that are passed to the callee.
734
    using ParameterEncodingTy = SmallVector<int, 0>;
735
    ParameterEncodingTy ParameterEncoding;
736
737
  };
738
739
private:
740
741
  /// The underlying call site:
742
  ///   caller -> callee,             if this is a direct or indirect call site
743
  ///   caller -> broker function,    if this is a callback call site
744
  CallSite CS;
745
746
  /// The encoding of a callback with regards to the underlying instruction.
747
  CallbackInfo CI;
748
749
public:
750
  /// Sole constructor for abstract call sites (ACS).
751
  ///
752
  /// An abstract call site can only be constructed through a llvm::Use because
753
  /// each operand (=use) of an instruction could potentially be a different
754
  /// abstract call site. Furthermore, even if the value of the llvm::Use is the
755
  /// same, and the user is as well, the abstract call sites might not be.
756
  ///
757
  /// If a use is not associated with an abstract call site the constructed ACS
758
  /// will evaluate to false if converted to a boolean.
759
  ///
760
  /// If the use is the callee use of a call or invoke instruction, the
761
  /// constructed abstract call site will behave as a llvm::CallSite would.
762
  ///
763
  /// If the use is not a callee use of a call or invoke instruction, the
764
  /// callback metadata is used to determine the argument <-> parameter mapping
765
  /// as well as the callee of the abstract call site.
766
  AbstractCallSite(const Use *U);
767
768
  /// Conversion operator to conveniently check for a valid/initialized ACS.
769
73
  explicit operator bool() const { return (bool)CS; }
770
771
  /// Return the underlying instruction.
772
0
  Instruction *getInstruction() const { return CS.getInstruction(); }
773
774
  /// Return the call site abstraction for the underlying instruction.
775
0
  CallSite getCallSite() const { return CS; }
776
777
  /// Return true if this ACS represents a direct call.
778
180
  bool isDirectCall() const {
779
180
    return !isCallbackCall() && 
!CS.isIndirectCall()50
;
780
180
  }
781
782
  /// Return true if this ACS represents an indirect call.
783
0
  bool isIndirectCall() const {
784
0
    return !isCallbackCall() && CS.isIndirectCall();
785
0
  }
786
787
  /// Return true if this ACS represents a callback call.
788
250
  bool isCallbackCall() const {
789
250
    // For a callback call site the callee is ALWAYS stored first in the
790
250
    // transitive values vector. Thus, a non-empty vector indicates a callback.
791
250
    return !CI.ParameterEncoding.empty();
792
250
  }
793
794
  /// Return true if @p UI is the use that defines the callee of this ACS.
795
0
  bool isCallee(Value::const_user_iterator UI) const {
796
0
    return isCallee(&UI.getUse());
797
0
  }
798
799
  /// Return true if @p U is the use that defines the callee of this ACS.
800
0
  bool isCallee(const Use *U) const {
801
0
    if (isDirectCall())
802
0
      return CS.isCallee(U);
803
0
804
0
    assert(!CI.ParameterEncoding.empty() &&
805
0
           "Callback without parameter encoding!");
806
0
807
0
    return (int)CS.getArgumentNo(U) == CI.ParameterEncoding[0];
808
0
  }
809
810
  /// Return the number of parameters of the callee.
811
73
  unsigned getNumArgOperands() const {
812
73
    if (isDirectCall())
813
25
      return CS.getNumArgOperands();
814
48
    // Subtract 1 for the callee encoding.
815
48
    return CI.ParameterEncoding.size() - 1;
816
48
  }
817
818
  /// Return the operand index of the underlying instruction associated with @p
819
  /// Arg.
820
0
  int getCallArgOperandNo(Argument &Arg) const {
821
0
    return getCallArgOperandNo(Arg.getArgNo());
822
0
  }
823
824
  /// Return the operand index of the underlying instruction associated with
825
  /// the function parameter number @p ArgNo or -1 if there is none.
826
0
  int getCallArgOperandNo(unsigned ArgNo) const {
827
0
    if (isDirectCall())
828
0
      return ArgNo;
829
0
    // Add 1 for the callee encoding.
830
0
    return CI.ParameterEncoding[ArgNo + 1];
831
0
  }
832
833
  /// Return the operand of the underlying instruction associated with @p Arg.
834
0
  Value *getCallArgOperand(Argument &Arg) const {
835
0
    return getCallArgOperand(Arg.getArgNo());
836
0
  }
837
838
  /// Return the operand of the underlying instruction associated with the
839
  /// function parameter number @p ArgNo or nullptr if there is none.
840
107
  Value *getCallArgOperand(unsigned ArgNo) const {
841
107
    if (isDirectCall())
842
25
      return CS.getArgOperand(ArgNo);
843
82
    // Add 1 for the callee encoding.
844
82
    return CI.ParameterEncoding[ArgNo + 1] >= 0
845
82
               ? 
CS.getArgOperand(CI.ParameterEncoding[ArgNo + 1])62
846
82
               : 
nullptr20
;
847
82
  }
848
849
  /// Return the operand index of the underlying instruction associated with the
850
  /// callee of this ACS. Only valid for callback calls!
851
0
  int getCallArgOperandNoForCallee() const {
852
0
    assert(isCallbackCall());
853
0
    assert(CI.ParameterEncoding.size() && CI.ParameterEncoding[0] > 0);
854
0
    return CI.ParameterEncoding[0];
855
0
  }
856
857
  /// Return the pointer to function that is being called.
858
0
  Value *getCalledValue() const {
859
0
    if (isDirectCall())
860
0
      return CS.getCalledValue();
861
0
    return CS.getArgOperand(getCallArgOperandNoForCallee());
862
0
  }
863
864
  /// Return the function being called if this is a direct call, otherwise
865
  /// return null (if it's an indirect call).
866
0
  Function *getCalledFunction() const {
867
0
    Value *V = getCalledValue();
868
0
    return V ? dyn_cast<Function>(V->stripPointerCasts()) : nullptr;
869
0
  }
870
};
871
872
template <> struct DenseMapInfo<CallSite> {
873
  using BaseInfo = DenseMapInfo<decltype(CallSite::I)>;
874
875
455
  static CallSite getEmptyKey() {
876
455
    CallSite CS;
877
455
    CS.I = BaseInfo::getEmptyKey();
878
455
    return CS;
879
455
  }
880
881
237
  static CallSite getTombstoneKey() {
882
237
    CallSite CS;
883
237
    CS.I = BaseInfo::getTombstoneKey();
884
237
    return CS;
885
237
  }
886
887
132
  static unsigned getHashValue(const CallSite &CS) {
888
132
    return BaseInfo::getHashValue(CS.I);
889
132
  }
890
891
4.51k
  static bool isEqual(const CallSite &LHS, const CallSite &RHS) {
892
4.51k
    return LHS == RHS;
893
4.51k
  }
894
};
895
896
/// Establish a view to a call site for examination.
897
class ImmutableCallSite : public CallSiteBase<> {
898
public:
899
459k
  ImmutableCallSite() = default;
900
3.60M
  ImmutableCallSite(const CallInst *CI) : CallSiteBase(CI) {}
901
31.1k
  ImmutableCallSite(const InvokeInst *II) : CallSiteBase(II) {}
902
5
  ImmutableCallSite(const CallBrInst *CBI) : CallSiteBase(CBI) {}
903
45.6M
  explicit ImmutableCallSite(const Instruction *II) : CallSiteBase(II) {}
904
388M
  explicit ImmutableCallSite(const Value *V) : CallSiteBase(V) {}
905
0
  ImmutableCallSite(CallSite CS) : CallSiteBase(CS.getInstruction()) {}
906
};
907
908
} // end namespace llvm
909
910
#endif // LLVM_IR_CALLSITE_H