LLVM: include/llvm/IR/AbstractCallSite.h Source File (original) (raw)

1

2

3

4

5

6

7

8

9

10

11

12

13

14#ifndef LLVM_IR_ABSTRACTCALLSITE_H

15#define LLVM_IR_ABSTRACTCALLSITE_H

16

22#include

23

24namespace llvm {

25

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

52public:

53

54

56

57

58

59

60

61

62

63

64

65

66

69

70 };

71

72private:

73

74

75

76

78

79

81

82public:

83

84

85

86

87

88

89

90

91

92

93

94

95

96

97

98

100

101

102

103

104

105

109

110

111 explicit operator bool() const { return CB != nullptr; }

112

113

115

116

120

121

125

126

128

129

130 return !CI.ParameterEncoding.empty();

131 }

132

133

135 return isCallee(&UI.getUse());

136 }

137

138

141 return CB->isCallee(U);

142

143 assert(!CI.ParameterEncoding.empty() &&

144 "Callback without parameter encoding!");

145

146

147

149 if (CE->hasOneUse() && CE->isCast())

150 U = &*CE->use_begin();

151

152 return (int)CB->getArgOperandNo(U) == CI.ParameterEncoding[0];

153 }

154

155

158 return CB->arg_size();

159

160 return CI.ParameterEncoding.size() - 1;

161 }

162

163

164

168

169

170

173 return ArgNo;

174

175 return CI.ParameterEncoding[ArgNo + 1];

176 }

177

178

182

183

184

187 return CB->getArgOperand(ArgNo);

188

189 return CI.ParameterEncoding[ArgNo + 1] >= 0

190 ? CB->getArgOperand(CI.ParameterEncoding[ArgNo + 1])

191 : nullptr;

192 }

193

194

195

198 assert(CI.ParameterEncoding.size() && CI.ParameterEncoding[0] >= 0);

199 return CI.ParameterEncoding[0];

200 }

201

202

203

206 assert(CalleeArgIdx >= 0 &&

207 unsigned(CalleeArgIdx) < getInstruction()->getNumOperands());

209 }

210

211

214 return CB->getCalledOperand();

216 }

217

218

219

224};

225

226

227template

231 for (const Use *U : CallbackUses) {

234 Func(ACS);

235 }

236}

237

238

239template

243 Func(Callback);

244 });

245}

246

247}

248

249#endif

assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")

This file contains the declarations for the subclasses of Constant, which represent the different fla...

AbstractCallSite.

Definition AbstractCallSite.h:51

int getCallArgOperandNoForCallee() const

Return the operand index of the underlying instruction associated with the callee of this ACS.

Definition AbstractCallSite.h:196

bool isCallee(const Use *U) const

Return true if U is the use that defines the callee of this ACS.

Definition AbstractCallSite.h:139

CallBase * getInstruction() const

Return the underlying instruction.

Definition AbstractCallSite.h:114

bool isCallbackCall() const

Return true if this ACS represents a callback call.

Definition AbstractCallSite.h:127

bool isDirectCall() const

Return true if this ACS represents a direct call.

Definition AbstractCallSite.h:117

bool isIndirectCall() const

Return true if this ACS represents an indirect call.

Definition AbstractCallSite.h:122

const Use & getCalleeUseForCallback() const

Return the use of the callee value in the underlying instruction.

Definition AbstractCallSite.h:204

static LLVM_ABI void getCallbackUses(const CallBase &CB, SmallVectorImpl< const Use * > &CallbackUses)

Add operand uses of CB that represent callback uses into CallbackUses.

LLVM_ABI AbstractCallSite(const Use *U)

Sole constructor for abstract call sites (ACS).

int getCallArgOperandNo(unsigned ArgNo) const

Return the operand index of the underlying instruction associated with the function parameter number ...

Definition AbstractCallSite.h:171

bool isCallee(Value::const_user_iterator UI) const

Return true if UI is the use that defines the callee of this ACS.

Definition AbstractCallSite.h:134

Value * getCallArgOperand(Argument &Arg) const

Return the operand of the underlying instruction associated with Arg.

Definition AbstractCallSite.h:179

Value * getCallArgOperand(unsigned ArgNo) const

Return the operand of the underlying instruction associated with the function parameter number ArgNo ...

Definition AbstractCallSite.h:185

int getCallArgOperandNo(Argument &Arg) const

Return the operand index of the underlying instruction associated with Arg.

Definition AbstractCallSite.h:165

Value * getCalledOperand() const

Return the pointer to function that is being called.

Definition AbstractCallSite.h:212

unsigned getNumArgOperands() const

Return the number of parameters of the callee.

Definition AbstractCallSite.h:156

Function * getCalledFunction() const

Return the function being called if this is a direct call, otherwise return null (if it's an indirect...

Definition AbstractCallSite.h:220

This class represents an incoming formal argument to a Function.

unsigned getArgNo() const

Return the index of this formal argument in its containing function.

Base class for all callable instructions (InvokeInst and CallInst) Holds everything related to callin...

This class consists of common code factored out of the SmallVector class to reduce code duplication b...

This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.

A Use represents the edge between a Value definition and its users.

const Use & getOperandUse(unsigned i) const

LLVM Value Representation.

user_iterator_impl< const User > const_user_iterator

This is an optimization pass for GlobalISel generic memory operations.

decltype(auto) dyn_cast(const From &Val)

dyn_cast - Return the argument parameter cast to the specified type.

void forEachCallbackCallSite(const CallBase &CB, UnaryFunction Func)

Apply function Func to each CB's callback call site.

Definition AbstractCallSite.h:228

void forEachCallbackFunction(const CallBase &CB, UnaryFunction Func)

Apply function Func to each CB's callback function.

Definition AbstractCallSite.h:240

The encoding of a callback with regards to the underlying instruction.

Definition AbstractCallSite.h:55

SmallVector< int, 0 > ParameterEncodingTy

For direct/indirect calls the parameter encoding is empty.

Definition AbstractCallSite.h:67

ParameterEncodingTy ParameterEncoding

Definition AbstractCallSite.h:68