clang: lib/CIR/CodeGen/CIRGenCall.h Source File (original) (raw)

1

2

3

4

5

6

7

8

9

10

11

12

13

14#ifndef CLANG_LIB_CODEGEN_CIRGENCALL_H

15#define CLANG_LIB_CODEGEN_CIRGENCALL_H

16

18#include "mlir/IR/Operation.h"

20#include "llvm/ADT/SmallVector.h"

21

23

25

26

30

31public:

35 : calleeProtoTy(calleeProtoTy), calleeDecl(calleeDecl) {}

37 : calleeProtoTy(nullptr), calleeDecl(calleeDecl) {}

38

40 return calleeProtoTy;

41 }

43};

44

45class CIRGenCallee {

46 enum class SpecialKind : uintptr_t {

47 Invalid,

48 Builtin,

49 PseudoDestructor,

50 Virtual,

51

52 Last = Virtual

53 };

54

55 struct BuiltinInfoStorage {

57 unsigned id;

58 };

59 struct PseudoDestructorInfoStorage {

61 };

62 struct VirtualInfoStorage {

66 cir::FuncType fTy;

67 };

68

69 SpecialKind kindOrFunctionPtr;

70

71 union {

76 };

77

78 explicit CIRGenCallee(SpecialKind kind) : kindOrFunctionPtr(kind) {}

79

80public:

81 CIRGenCallee() : kindOrFunctionPtr(SpecialKind::Invalid) {}

82

84 : kindOrFunctionPtr(SpecialKind(reinterpret_cast<uintptr_t>(funcPtr))),

86 assert(funcPtr && "configuring callee without function pointer");

87 }

88

94

95 bool isBuiltin() const { return kindOrFunctionPtr == SpecialKind::Builtin; }

96

105

106 static CIRGenCallee forBuiltin(unsigned builtinID,

108 CIRGenCallee result(SpecialKind::Builtin);

111 return result;

112 }

113

116 CIRGenCallee result(SpecialKind::PseudoDestructor);

118 return result;

119 }

120

122 return kindOrFunctionPtr == SpecialKind::PseudoDestructor;

123 }

124

129

133

134

135

137

144

147 return reinterpret_cast<mlir::Operation *>(kindOrFunctionPtr);

148 }

149

150 bool isVirtual() const { return kindOrFunctionPtr == SpecialKind::Virtual; }

151

154 cir::FuncType fTy) {

155 CIRGenCallee result(SpecialKind::Virtual);

160 return result;

161 }

162

167

172

177

182

185 kindOrFunctionPtr = SpecialKind(reinterpret_cast<uintptr_t>(functionPtr));

186 }

187};

188

189

190

192

194private:

195 union {

197 LValue lv;

198 };

199 bool hasLV;

200

201

202

203 [[maybe_unused]] mutable bool isUsed;

204

205public:

207

210

213

215

217 assert(hasLV && !isUsed);

218 return lv;

219 }

220

222 assert(!hasLV && !isUsed);

223 return rv;

224 }

225

226 bool isAggregate() const { return hasLV || rv.isAggregate(); }

227

229};

230

232public:

234

236 emplace_back(lvalue, type);

237 }

238

239

240

241

243 insert(end(), other.begin(), other.end());

244

245

249 }

250};

251

252

253

256

257public:

260

261 bool isNull() const { return !addr.isValid(); }

263};

264

265}

266

267#endif

Abstract information about a function or function prototype.

Definition CIRGenCall.h:27

CIRGenCalleeInfo()

Definition CIRGenCall.h:32

CIRGenCalleeInfo(clang::GlobalDecl calleeDecl)

Definition CIRGenCall.h:36

clang::GlobalDecl getCalleeDecl() const

Definition CIRGenCall.h:42

CIRGenCalleeInfo(const clang::FunctionProtoType *calleeProtoTy, clang::GlobalDecl calleeDecl)

Definition CIRGenCall.h:33

const clang::FunctionProtoType * getCalleeFunctionProtoType() const

Definition CIRGenCall.h:39

Definition CIRGenCall.h:45

bool isPseudoDestructor() const

Definition CIRGenCall.h:121

void setFunctionPointer(mlir::Operation *functionPtr)

Definition CIRGenCall.h:183

bool isVirtual() const

Definition CIRGenCall.h:150

const clang::FunctionDecl * getBuiltinDecl() const

Definition CIRGenCall.h:97

bool isOrdinary() const

Definition CIRGenCall.h:130

const CXXPseudoDestructorExpr * getPseudoDestructorExpr() const

Definition CIRGenCall.h:125

static CIRGenCallee forDirect(mlir::Operation *funcPtr, const CIRGenCalleeInfo &abstractInfo=CIRGenCalleeInfo())

Definition CIRGenCall.h:90

unsigned getBuiltinID() const

Definition CIRGenCall.h:101

bool isBuiltin() const

Definition CIRGenCall.h:95

VirtualInfoStorage virtualInfo

Definition CIRGenCall.h:75

CIRGenCalleeInfo getAbstractInfo() const

Definition CIRGenCall.h:138

clang::GlobalDecl getVirtualMethodDecl() const

Definition CIRGenCall.h:168

BuiltinInfoStorage builtinInfo

Definition CIRGenCall.h:73

CIRGenCallee prepareConcreteCallee(CIRGenFunction &cgf) const

If this is a delayed callee computation of some sort, prepare a concrete callee.

Address getThisAddress() const

Definition CIRGenCall.h:173

static CIRGenCallee forBuiltin(unsigned builtinID, const clang::FunctionDecl *builtinDecl)

Definition CIRGenCall.h:106

cir::FuncType getVirtualFunctionType() const

Definition CIRGenCall.h:178

CIRGenCallee(const CIRGenCalleeInfo &abstractInfo, mlir::Operation *funcPtr)

Definition CIRGenCall.h:83

CIRGenCallee()

Definition CIRGenCall.h:81

static CIRGenCallee forVirtual(const clang::CallExpr *ce, clang::GlobalDecl md, Address addr, cir::FuncType fTy)

Definition CIRGenCall.h:152

CIRGenCalleeInfo abstractInfo

Definition CIRGenCall.h:72

const clang::CallExpr * getVirtualCallExpr() const

Definition CIRGenCall.h:163

mlir::Operation * getFunctionPointer() const

Definition CIRGenCall.h:145

PseudoDestructorInfoStorage pseudoDestructorInfo

Definition CIRGenCall.h:74

static CIRGenCallee forPseudoDestructor(const clang::CXXPseudoDestructorExpr *expr)

Definition CIRGenCall.h:115

Definition CIRGenCall.h:231

void addFrom(const CallArgList &other)

Add all the arguments from another CallArgList to this one.

Definition CIRGenCall.h:242

void addUncopiedAggregate(LValue lvalue, clang::QualType type)

Definition CIRGenCall.h:235

void add(RValue rvalue, clang::QualType type)

Definition CIRGenCall.h:233

Type for representing both the decl and type of parameters to a function.

Definition CIRGenCall.h:191

This trivial value class is used to represent the result of an expression that is evaluated.

ReturnValueSlot()=default

Address getValue() const

Definition CIRGenCall.h:262

bool isNull() const

Definition CIRGenCall.h:261

ReturnValueSlot(Address addr)

Definition CIRGenCall.h:259

Represents a C++ pseudo-destructor (C++ [expr.pseudo]).

CallExpr - Represents a function call (C99 6.5.2.2, C++ [expr.call]).

Represents a function declaration or definition.

Represents a prototype with parameter type info, e.g.

GlobalDecl - represents a global declaration.

A (possibly-)qualified type.

const internal::VariadicAllOfMatcher< Type > type

Matches Types in the clang AST.

const internal::VariadicAllOfMatcher< Decl > decl

Matches declarations.

const internal::VariadicDynCastAllOfMatcher< Stmt, Expr > expr

Matches expressions.

nullptr

This class represents a compute construct, representing a 'Kind' of ‘parallel’, 'serial',...

__UINTPTR_TYPE__ uintptr_t

An unsigned integer type with the property that any valid pointer to void can be converted to this ty...

static bool cleanupsToDeactivate()

clang::QualType ty

Definition CIRGenCall.h:206

LValue lv

Definition CIRGenCall.h:197

bool isAggregate() const

Definition CIRGenCall.h:226

CallArg(RValue rv, clang::QualType ty)

Definition CIRGenCall.h:208

CallArg(LValue lv, clang::QualType ty)

Definition CIRGenCall.h:211

bool hasLValue() const

Definition CIRGenCall.h:214

RValue getKnownRValue() const

Definition CIRGenCall.h:221

RValue rv

Definition CIRGenCall.h:196

void copyInto(CIRGenFunction &cgf, Address addr, mlir::Location loc) const

LValue getKnownLValue() const

Definition CIRGenCall.h:216