clang: lib/CIR/CodeGen/CIRGenCall.cpp Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12
13
19
20using namespace clang;
22
27
28 void *buffer = operator new(
29 totalSizeToAlloc(argTypes.size() + 1));
30
32
33 CIRGenFunctionInfo *fi = new (buffer) CIRGenFunctionInfo();
34
35 fi->required = required;
36 fi->numArgs = argTypes.size();
37
38 fi->getArgTypes()[0] = resultType;
41
42 return fi;
43}
44
49
54
57
58 return cir::FuncType::get(argTypes,
59 (resultType ? resultType : builder.getVoidTy()),
61}
62
66
68 cgm.errorNYI("getFunctionTypeForVTable: non-convertible function type");
69
71}
72
79 }
80 return *this;
81}
82
84
85
86
87
88
89
90
91
92
93
94
95 mlir::OpBuilder::InsertionGuard guard(builder);
96 builder.setInsertionPointAfter(value.getDefiningOp());
97 builder.createStore(*currSrcLoc, value, dest);
98}
99
101 mlir::NamedAttrList &attrs,
103 if (!fpt)
104 return;
105
108 attrs.set(cir::CIRDialect::getNoThrowAttrName(),
109 mlir::UnitAttr::get(builder.getContext()));
110}
111
112
114 mlir::NamedAttrList &attrs) {
116 auto sideEffect = cir::SideEffect::All;
117
120
122
123 if (targetDecl) {
124 if (targetDecl->hasAttr())
125 attrs.set(cir::CIRDialect::getNoThrowAttrName(),
127
128 if (const FunctionDecl *func = dyn_cast(targetDecl)) {
132 }
133
135
136
137 if (targetDecl->hasAttr()) {
138
139
140 sideEffect = cir::SideEffect::Const;
141 } else if (targetDecl->hasAttr()) {
142
143 sideEffect = cir::SideEffect::Pure;
144 }
145
147 }
148
150
151 attrs.set(cir::CIRDialect::getSideEffectAttrName(),
152 cir::SideEffectAttr::get(&getMLIRContext(), sideEffect));
153}
154
155
161
162
163
164
169
170 if (!fpt->hasExtParameterInfos()) {
171 prefix.append(fpt->param_type_begin(), fpt->param_type_end());
172 return;
173 }
174
175 cgt.getCGModule().errorNYI("appendParameterTypes: hasExtParameterInfos");
176}
177
181
183 argTypes.push_back(deriveThisType(md->getParent(), md));
184
185 bool passParams = true;
186
187 if (auto *cd = dyn_cast(md)) {
188
189
190 if (cd->getInheritedConstructor())
191 cgm.errorNYI(cd->getSourceRange(),
192 "arrangeCXXStructorDeclaration: inheriting constructor");
193 }
194
196
197 if (passParams)
199
200
202 theCXXABI.buildStructorSignature(gd, argTypes);
204
206 (passParams && md->isVariadic() ? RequiredArgs(argTypes.size())
208
209 CanQualType resultType = theCXXABI.hasThisReturn(gd) ? argTypes.front()
210 : theCXXABI.hasMostDerivedReturn(gd)
211 ? astContext.VoidPtrTy
212 : astContext.VoidTy;
213
214 assert(!theCXXABI.hasThisReturn(gd) &&
215 "Please send PR with a test and remove this");
216
219
221}
222
223
224
225
226
230 if (rd) {
232 } else {
233
234
235
236 cgm.errorNYI("deriveThisType: no record decl");
238 }
239
240 if (md)
244}
245
246
247
259
263
264
266
268
269 if (type->getAsCXXRecordDecl()) {
271 "emitDelegateCallArg: record argument");
272 return;
273 }
274
275
276
277 if (type->isReferenceType()) {
278 args.add(
281 } else if (getLangOpts().ObjCAutoRefCount) {
283 "emitDelegateCallArg: ObjCAutoRefCount");
284
285
286 } else {
288 }
289
290
292 if (type->isRecordType() &&
293 type->castAsRecordDecl()->isParamDestroyedInCallee() &&
296 "emitDelegateCallArg: callee-destructed param");
297 }
298}
299
304
306
307 if (const auto *proto = dyn_cast(fnType)) {
308 if (proto->isVariadic())
310 if (proto->hasExtParameterInfos())
311 cgm.errorNYI("call to functions with extra parameter info");
314 cgm.errorNYI("call to function without a prototype");
315
317 for (const CallArg &arg : args)
319
323
326}
327
328
329
330
331
332
333
336 unsigned extraPrefixArgs, unsigned extraSuffixArgs, bool passProtoArgs) {
337
338
340 for (const auto &arg : args)
341 argTypes.push_back(astContext.getCanonicalParamType(arg.ty));
342
343
344 unsigned totalPrefixArgs = 1 + extraPrefixArgs;
345
349 fpt, totalPrefixArgs + extraSuffixArgs)
351
353 if (theCXXABI.hasThisReturn(gd))
355 "arrangeCXXConstructorCall: hasThisReturn");
356 if (theCXXABI.hasMostDerivedReturn(gd))
358 "arrangeCXXConstructorCall: hasMostDerivedReturn");
359 CanQualType resultType = astContext.VoidTy;
360
363
365}
366
367
368
369
370
373 RequiredArgs required, unsigned numPrefixArgs) {
375 assert(numPrefixArgs + 1 <= args.size() &&
376 "Emitting a call with less args than the required prefix?");
377
378
380 for (const CallArg &arg : args)
381 argTypes.push_back(astContext.getCanonicalParamType(arg.ty));
382
387 argTypes, required);
388}
389
395
396
397
398
403
404 auto prototype =
407
409
410 auto *thisType = theCXXABI.getThisArgumentTypeForMethod(md);
412 }
413
415}
416
417
418
419
420
421
427
428
430
432 return ::arrangeCIRFunctionInfo(
433 *this, argTypes,
435}
436
437
438
441 if (const auto *md = dyn_cast(fd))
442 if (md->isInstance())
444
446
448
450
451
452
459 }
460
462}
463
464static cir::CIRCallOpInterface
466 cir::FuncType indirectFuncTy, mlir::Value indirectFuncVal,
467 cir::FuncOp directFuncOp,
469 const mlir::NamedAttrList &attrs) {
471
473
474 if (isInvoke) {
475
476
477
478
479
480
481
482
483
484 assert(cgf.curLexScope && "expected scope");
486 if (!tryOp) {
488 "emitCallLikeOp: call does not have an associated cir.try");
489 return {};
490 }
491
492 if (tryOp.getSynthetic()) {
493 cgf.cgm.errorNYI("emitCallLikeOp: tryOp synthetic");
494 return {};
495 }
496
497 cir::CallOp callOpWithExceptions;
498 if (indirectFuncTy) {
499 cgf.cgm.errorNYI("emitCallLikeOp: indirect function type");
500 return {};
501 }
502
503 callOpWithExceptions =
504 builder.createCallOp(callLoc, directFuncOp, cirCallArgs);
505
507 return callOpWithExceptions;
508 }
509
510 assert(builder.getInsertionBlock() && "expected valid basic block");
511
512 cir::CallOp op;
513 if (indirectFuncTy) {
514
517 cirCallArgs, attrs);
518 } else {
519 op = builder.createCallOp(callLoc, directFuncOp, cirCallArgs, attrs);
520 }
521
522 return op;
523}
524
529 return ::arrangeCIRFunctionInfo(*this, argTypes, fpt);
530}
531
538
543 cir::CIRCallOpInterface *callOp,
544 mlir::Location loc) {
547
549
551
552
553 for (auto [argNo, arg, canQualArgType] :
554 llvm::enumerate(args, funcInfo.argTypes())) {
555
556
558
559 mlir::Type argType = convertType(canQualArgType);
560 if (!mlir::isacir::RecordType(argType) &&
561 !mlir::isacir::ComplexType(argType)) {
562 mlir::Value v;
563 if (arg.isAggregate())
564 cgm.errorNYI(loc, "emitCall: aggregate call argument");
565 v = arg.getKnownRValue().getValue();
566
567
568 if (argType != v.getType() && mlir::isacir::IntType(v.getType()))
569 cgm.errorNYI(loc, "emitCall: widening integer call argument");
570
571
572
573
574
576 cirCallArgs[argNo] = v;
577 } else {
579 if (!arg.isAggregate()) {
581 arg.copyInto(*this, src, loc);
582 } else {
583 src = arg.hasLValue() ? arg.getKnownLValue().getAddress()
584 : arg.getKnownRValue().getAggregateAddress();
585 }
586
587
588
590
591 mlir::Location argLoc = loc;
592
593
594
595
596
597
598
599
600
601
602
604 if (srcTy != argType) {
605 cgm.errorNYI(loc, "emitCall: source type does not match argument type");
606 } else {
607
608
609
611 }
612
613
614
615
616
617
618
619
621 cirCallArgs[argNo] = builder.createLoad(argLoc, src);
622 }
623 }
624
627
629
630 mlir::NamedAttrList attrs;
631 StringRef funcName;
632 if (auto calleeFuncOp = dyn_castcir::FuncOp(calleePtr))
633 funcName = calleeFuncOp.getName();
634
638
639 cir::FuncType indirectFuncTy;
640 mlir::Value indirectFuncVal;
641 cir::FuncOp directFuncOp;
642 if (auto fnOp = dyn_castcir::FuncOp(calleePtr)) {
643 directFuncOp = fnOp;
644 } else if (auto getGlobalOp = mlir::dyn_castcir::GetGlobalOp(calleePtr)) {
645
646
647
648
649 mlir::Operation *globalOp = cgm.getGlobalValue(getGlobalOp.getName());
650 assert(globalOp && "undefined global function");
651 directFuncOp = mlir::castcir::FuncOp(globalOp);
652 } else {
653 [[maybe_unused]] mlir::ValueTypeRangemlir::ResultRange resultTypes =
654 calleePtr->getResultTypes();
655 [[maybe_unused]] auto funcPtrTy =
656 mlir::dyn_castcir::PointerType(resultTypes.front());
657 assert(funcPtrTy && mlir::isacir::FuncType(funcPtrTy.getPointee()) &&
658 "expected pointer to function");
659
660 indirectFuncTy = cirFuncTy;
661 indirectFuncVal = calleePtr->getResult(0);
662 }
663
667
668 bool cannotThrow = attrs.getNamed("nothrow").has_value();
670
671 mlir::Location callLoc = loc;
672 cir::CIRCallOpInterface theCall =
673 emitCallLikeOp(*this, loc, indirectFuncTy, indirectFuncVal, directFuncOp,
674 cirCallArgs, isInvoke, attrs);
675
676 if (callOp)
677 *callOp = theCall;
678
681
682 mlir::Type retCIRTy = convertType(retTy);
688
691
692 mlir::ResultRange results = theCall->getOpResults();
693 assert(results.size() <= 1 && "multiple returns from a call");
694
698 }
700 mlir::ResultRange results = theCall->getOpResults();
701 assert(results.size() == 1 && "unexpected number of returns");
702
703
704
705 if (results[0].getType() != retCIRTy)
706 cgm.errorNYI(loc, "bitcast on function return value");
707
708 mlir::Region *region = builder.getBlock()->getParent();
709 if (region != theCall->getParentRegion())
710 cgm.errorNYI(loc, "function calls with cleanup");
711
713 }
715 mlir::ResultRange results = theCall->getOpResults();
716 assert(!results.empty() &&
717 "Expected at least one result for complex rvalue");
719 }
720 }
721 llvm_unreachable("Invalid evaluation kind");
722}
723
725 mlir::Location loc) const {
727 if (!hasLV && rv.isScalar())
728 cgf.cgm.errorNYI(loc, "copyInto scalar value");
729 else if (!hasLV && rv.isComplex())
731 else
733 isUsed = true;
734}
735
737 cir::FuncOp callee,
739
741
742 cir::CallOp call = builder.createCallOp(loc, callee, args);
743 assert(call->getNumResults() <= 1 &&
744 "runtime functions have at most 1 result");
745
746 if (call->getNumResults() == 0)
747 return nullptr;
748
749 return call->getResult(0);
750}
751
755 "reference binding to unmaterialized r-value!");
756
760 }
761
763
764
765
766
771 }
772
774 cast(e)->getCastKind() == CK_LValueToRValue) {
778 return;
779 }
780
782}
783
784QualType CIRGenFunction::getVarArgType(const Expr *arg) {
785
786
787
788 if (().getTriple().isOSWindows())
789 return arg->getType();
790
792 cgm.errorNYI(arg->getSourceRange(), "getVarArgType: NYI for Windows target");
793 return arg->getType();
794}
795
796
797
807
810 llvm::iterator_rangeclang::CallExpr::const\_arg\_iterator argRange,
813
815
816
817 bool isVariadic = false;
818 if (prototype.p) {
820
822 isVariadic = fpt->isVariadic();
824 argTypes.assign(fpt->param_type_begin() + paramsToSkip,
825 fpt->param_type_end());
826 }
827
828
829 for (const clang::Expr *a : llvm::drop_begin(argRange, argTypes.size()))
830 argTypes.push_back(isVariadic ? getVarArgType(a) : a->getType());
831 assert(argTypes.size() == (size_t)(argRange.end() - argRange.begin()));
832
833
834
835
836
837
838 auto leftToRight = true;
840
841 auto maybeEmitImplicitObjectSize = [&](size_t i, const Expr *arg,
844 return;
846 if (!ps)
847 return;
848
850 cgm.errorNYI("emit implicit object size for call arg");
851 };
852
853
854 size_t callArgsStart = args.size();
855 for (size_t i = 0; i != argTypes.size(); ++i) {
856 size_t idx = leftToRight ? i : argTypes.size() - i - 1;
858 size_t initialArgSize = args.size();
859
860 emitCallArg(args, *currentArg, argTypes[idx]);
861
862
863
864 assert(initialArgSize + 1 == args.size() &&
865 "The code below depends on only adding one arg per emitCallArg");
866 (void)initialArgSize;
867
868
869
870 if (!args.back().hasLValue()) {
871 RValue rvArg = args.back().getKnownRValue();
873 maybeEmitImplicitObjectSize(idx, *currentArg, rvArg);
874 }
875
876 if (!leftToRight)
877 std::reverse(args.begin() + callArgsStart, args.end());
878 }
879}
static cir::CIRCallOpInterface emitCallLikeOp(CIRGenFunction &cgf, mlir::Location callLoc, cir::FuncType indirectFuncTy, mlir::Value indirectFuncVal, cir::FuncOp directFuncOp, const SmallVectorImpl< mlir::Value > &cirCallArgs, bool isInvoke, const mlir::NamedAttrList &attrs)
Definition CIRGenCall.cpp:465
static const CIRGenFunctionInfo & arrangeCIRFunctionInfo(CIRGenTypes &cgt, SmallVectorImpl< CanQualType > &prefix, CanQual< FunctionProtoType > fpt)
Arrange the CIR function layout for a value of the given function type, on top of any implicit parame...
Definition CIRGenCall.cpp:249
static void appendParameterTypes(const CIRGenTypes &cgt, SmallVectorImpl< CanQualType > &prefix, CanQual< FunctionProtoType > fpt)
Adds the formal parameters in FPT to the given prefix.
Definition CIRGenCall.cpp:165
static void addAttributesFromFunctionProtoType(CIRGenBuilderTy &builder, mlir::NamedAttrList &attrs, const FunctionProtoType *fpt)
Definition CIRGenCall.cpp:100
static CanQual< FunctionProtoType > getFormalType(const CXXMethodDecl *md)
Returns the canonical formal type of the given C++ method.
Definition CIRGenCall.cpp:156
static const CIRGenFunctionInfo & arrangeFreeFunctionLikeCall(CIRGenTypes &cgt, CIRGenModule &cgm, const CallArgList &args, const FunctionType *fnType)
Definition CIRGenCall.cpp:301
TokenType getType() const
Returns the token's type, e.g.
cir::CallOp createCallOp(mlir::Location loc, mlir::SymbolRefAttr callee, mlir::Type returnType, mlir::ValueRange operands, llvm::ArrayRef< mlir::NamedAttribute > attrs={})
cir::CallOp createIndirectCallOp(mlir::Location loc, mlir::Value indirectTarget, cir::FuncType funcType, mlir::ValueRange operands, llvm::ArrayRef< mlir::NamedAttribute > attrs={})
CanQualType getCanonicalParamType(QualType T) const
Return the canonical parameter type corresponding to the specific potentially non-canonical one.
QualType getPointerType(QualType T) const
Return the uniqued reference to the type for a pointer to the specified type.
CanQualType getCanonicalTagType(const TagDecl *TD) const
mlir::Type getElementType() const
static AggValueSlot ignored()
Returns an aggregate value slot indicating that the aggregate value is being ignored.
virtual CIRGenCallee getVirtualFunctionPointer(CIRGenFunction &cgf, clang::GlobalDecl gd, Address thisAddr, mlir::Type ty, SourceLocation loc)=0
Build a virtual function pointer in the ABI-specific way.
Abstract information about a function or function prototype.
clang::GlobalDecl getCalleeDecl() const
const clang::FunctionProtoType * getCalleeFunctionProtoType() const
CIRGenCalleeInfo getAbstractInfo() const
clang::GlobalDecl getVirtualMethodDecl() const
CIRGenCallee prepareConcreteCallee(CIRGenFunction &cgf) const
If this is a delayed callee computation of some sort, prepare a concrete callee.
Definition CIRGenCall.cpp:73
Address getThisAddress() const
cir::FuncType getVirtualFunctionType() const
const clang::CallExpr * getVirtualCallExpr() const
mlir::Operation * getFunctionPointer() const
CanQualType getReturnType() const
unsigned getNumRequiredArgs() const
llvm::MutableArrayRef< CanQualType > argTypes()
llvm::ArrayRef< CanQualType > requiredArguments() const
const_arg_iterator argTypesBegin() const
static CIRGenFunctionInfo * create(CanQualType resultType, llvm::ArrayRef< CanQualType > argTypes, RequiredArgs required)
Definition CIRGenCall.cpp:24
An abstract representation of regular/ObjC call/message targets.
bool hasFunctionDecl() const
unsigned getNumParams() const
const clang::ParmVarDecl * getParamDecl(unsigned I) const
void emitCallArgs(CallArgList &args, PrototypeWrapper prototype, llvm::iterator_range< clang::CallExpr::const_arg_iterator > argRange, AbstractCallee callee=AbstractCallee(), unsigned paramsToSkip=0)
Definition CIRGenCall.cpp:808
mlir::Type convertType(clang::QualType t)
static cir::TypeEvaluationKind getEvaluationKind(clang::QualType type)
Return the cir::TypeEvaluationKind of QualType type.
RValue convertTempToRValue(Address addr, clang::QualType type, clang::SourceLocation loc)
Given the address of a temporary variable, produce an r-value of its type.
CIRGenTypes & getTypes() const
const clang::LangOptions & getLangOpts() const
const TargetInfo & getTarget() const
LValue emitLValue(const clang::Expr *e)
Emit code to compute a designator that specifies the location of the expression.
Address getAddrOfLocalVar(const clang::VarDecl *vd)
Return the address of a local variable.
mlir::Location getLoc(clang::SourceLocation srcLoc)
Helpers to convert Clang's SourceLocation to a MLIR Location.
void emitAggregateStore(mlir::Value value, Address dest)
Definition CIRGenCall.cpp:83
RValue emitReferenceBindingToExpr(const Expr *e)
Emits a reference binding to the passed in expression.
AggValueSlot createAggTemp(QualType ty, mlir::Location loc, const Twine &name="tmp", Address *alloca=nullptr)
Create a temporary memory object for the given aggregate type.
void populateCatchHandlersIfRequired(cir::TryOp tryOp)
RValue getUndefRValue(clang::QualType ty)
Get an appropriate 'undef' rvalue for the given type.
Address returnValue
The temporary alloca to hold the return value.
static bool hasAggregateEvaluationKind(clang::QualType type)
RValue emitAnyExprToTemp(const clang::Expr *e)
Similarly to emitAnyExpr(), however, the result will always be accessible even if no aggregate locati...
Definition CIRGenCall.cpp:798
void emitStoreOfComplex(mlir::Location loc, mlir::Value v, LValue dest, bool isInit)
EmitStoreOfComplex - Store a complex number into the specified l-value.
std::string getCounterAggTmpAsString()
RValue emitCall(const CIRGenFunctionInfo &funcInfo, const CIRGenCallee &callee, ReturnValueSlot returnValue, const CallArgList &args, cir::CIRCallOpInterface *callOp, mlir::Location loc)
Definition CIRGenCall.cpp:539
void emitCallArg(CallArgList &args, const clang::Expr *e, clang::QualType argType)
Definition CIRGenCall.cpp:752
CIRGenBuilderTy & getBuilder()
mlir::Value emitRuntimeCall(mlir::Location loc, cir::FuncOp callee, llvm::ArrayRef< mlir::Value > args={})
Definition CIRGenCall.cpp:736
LValue makeAddrLValue(Address addr, QualType ty, AlignmentSource source=AlignmentSource::Type)
bool isCatchOrCleanupRequired()
RValue emitAnyExpr(const clang::Expr *e, AggValueSlot aggSlot=AggValueSlot::ignored(), bool ignoreResult=false)
Emit code to compute the specified expression which can have any type.
void emitDelegateCallArg(CallArgList &args, const clang::VarDecl *param, clang::SourceLocation loc)
We are performing a delegate call; that is, the current function is delegating to another one.
Definition CIRGenCall.cpp:260
LexicalScope * curLexScope
std::optional< mlir::Location > currSrcLoc
Use to track source locations across nested visitor traversals.
clang::ASTContext & getContext() const
Address createMemTemp(QualType t, mlir::Location loc, const Twine &name="tmp", Address *alloca=nullptr, mlir::OpBuilder::InsertPoint ip={})
Create a temporary memory object of the given type, with appropriate alignmen and cast it to the defa...
This class organizes the cross-function state that is used while generating CIR code.
DiagnosticBuilder errorNYI(SourceLocation, llvm::StringRef)
Helpers to emit "not yet implemented" error diagnostics.
void constructAttributeList(CIRGenCalleeInfo calleeInfo, mlir::NamedAttrList &attrs)
Get the CIR attributes and calling convention to use for a particular function type.
Definition CIRGenCall.cpp:113
CIRGenBuilderTy & getBuilder()
const TargetCIRGenInfo & getTargetCIRGenInfo()
mlir::MLIRContext & getMLIRContext()
CIRGenCXXABI & getCXXABI() const
This class organizes the cross-module state that is used while lowering AST types to CIR types.
CIRGenModule & getCGModule() const
const CIRGenFunctionInfo & arrangeGlobalDeclaration(GlobalDecl gd)
const CIRGenFunctionInfo & arrangeCXXMethodDeclaration(const clang::CXXMethodDecl *md)
C++ methods have some special rules and also have implicit parameters.
Definition CIRGenCall.cpp:400
const CIRGenFunctionInfo & arrangeCXXStructorDeclaration(clang::GlobalDecl gd)
Definition CIRGenCall.cpp:179
const CIRGenFunctionInfo & arrangeFreeFunctionCall(const CallArgList &args, const FunctionType *fnType)
Definition CIRGenCall.cpp:391
const CIRGenFunctionInfo & arrangeFreeFunctionType(CanQual< FunctionProtoType > fpt)
Definition CIRGenCall.cpp:526
bool isFuncTypeConvertible(const clang::FunctionType *ft)
Utility to check whether a function type can be converted to a CIR type (i.e.
cir::FuncType getFunctionTypeForVTable(clang::GlobalDecl gd)
Get the CIR function type for use in a vtable, given a CXXMethodDecl.
Definition CIRGenCall.cpp:63
const CIRGenFunctionInfo & arrangeCXXConstructorCall(const CallArgList &args, const clang::CXXConstructorDecl *d, clang::CXXCtorType ctorKind, unsigned extraPrefixArgs, unsigned extraSuffixArgs, bool passProtoArgs=true)
Arrange a call to a C++ method, passing the given arguments.
Definition CIRGenCall.cpp:334
const CIRGenFunctionInfo & arrangeCXXMethodType(const clang::CXXRecordDecl *rd, const clang::FunctionProtoType *ftp, const clang::CXXMethodDecl *md)
Arrange the argument and result information for a call to an unknown C++ non-static member function o...
Definition CIRGenCall.cpp:423
const CIRGenFunctionInfo & arrangeCIRFunctionInfo(CanQualType returnType, llvm::ArrayRef< CanQualType > argTypes, RequiredArgs required)
cir::FuncType getFunctionType(const CIRGenFunctionInfo &info)
Get the CIR function type for.
Definition CIRGenCall.cpp:50
clang::CanQualType deriveThisType(const clang::CXXRecordDecl *rd, const clang::CXXMethodDecl *md)
Derives the 'this' type for CIRGen purposes, i.e.
Definition CIRGenCall.cpp:227
const CIRGenFunctionInfo & arrangeFunctionDeclaration(const clang::FunctionDecl *fd)
Free functions are functions that are compatible with an ordinary C function pointer type.
Definition CIRGenCall.cpp:440
clang::ASTContext & getASTContext() const
const CIRGenFunctionInfo & arrangeCXXMethodCall(const CallArgList &args, const clang::FunctionProtoType *type, RequiredArgs required, unsigned numPrefixArgs)
Arrange a call to a C++ method, passing the given arguments.
Definition CIRGenCall.cpp:371
mlir::Type convertType(clang::QualType type)
Convert a Clang type into a mlir::Type.
void addUncopiedAggregate(LValue lvalue, clang::QualType type)
void add(RValue rvalue, clang::QualType type)
This trivial value class is used to represent the result of an expression that is evaluated.
static RValue get(mlir::Value v)
static RValue getAggregate(Address addr, bool isVolatile=false)
Convert an Address to an RValue.
static RValue getComplex(mlir::Value v)
A class for recording the number of arguments that a function signature requires.
static RequiredArgs getFromProtoWithExtraSlots(const clang::FunctionProtoType *prototype, unsigned additional)
Compute the arguments required by the given formal prototype, given that there may be some additional...
Contains the address where the return value of a function can be stored, and whether the address is v...
virtual bool isNoProtoCallVariadic(const FunctionNoProtoType *fnType) const
Determine whether a call to an unprototyped functions under the given calling convention should use t...
Represents a C++ constructor within a class.
Represents a static or instance method of a struct/union/class.
Qualifiers getMethodQualifiers() const
Represents a C++ struct/union/class.
CallExpr - Represents a function call (C99 6.5.2.2, C++ [expr.call]).
SourceLocation getBeginLoc() const
ConstExprIterator const_arg_iterator
Represents a canonical, potentially-qualified type.
static CanQual< Type > CreateUnsafe(QualType Other)
CanProxy< U > castAs() const
CanQual< T > getUnqualifiedType() const
Retrieve the unqualified form of this type.
CanProxy< U > getAs() const
Retrieve a canonical type pointer with a different static type, upcasting or downcasting as needed.
This represents one expression.
ExprObjectKind getObjectKind() const
getObjectKind - The object kind that this expression produces.
Represents a function declaration or definition.
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
Represents a K&R-style 'int foo()' function, which has no information available about its arguments.
Represents a prototype with parameter type info, e.g.
ExceptionSpecificationType getExceptionSpecType() const
Get the kind of exception specification on this function.
bool isNothrow(bool ResultIfDependent=false) const
Determine whether this function type has a non-throwing exception specification.
FunctionType - C99 6.7.5.3 - Function Declarators.
QualType getReturnType() const
GlobalDecl - represents a global declaration.
const Decl * getDecl() const
A (possibly-)qualified type.
LangAS getAddressSpace() const
bool isParamDestroyedInCallee() const
Encodes a location in the source.
SourceRange getSourceRange() const LLVM_READONLY
SourceLocation tokens are not useful in isolation - they are low level value objects created/interpre...
CanQualType getCanonicalTypeUnqualified() const
bool isReferenceType() const
RecordDecl * castAsRecordDecl() const
const T * getAs() const
Member-template getAs'.
bool isRecordType() const
Represents a variable declaration or definition.
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
QualType::DestructionKind needsDestruction(const ASTContext &Ctx) const
Would the destruction of this variable have any effect, and if so, what kind?
@ Decl
The l-value was an access to a declared entity or something equivalently strong, like the address of ...
const internal::VariadicAllOfMatcher< Type > type
Matches Types in the clang AST.
The JSON file list parser is used to communicate input to InstallAPI.
CanQual< Type > CanQualType
Represents a canonical, potentially-qualified type.
CXXCtorType
C++ constructor types.
bool isa(CodeGen::Address addr)
bool isUnresolvedExceptionSpec(ExceptionSpecificationType ESpecType)
@ OK_Ordinary
An ordinary object is located at an address in memory.
U cast(CodeGen::Address addr)
static bool opCallBitcastArg()
static bool opCallCIRGenFuncInfoExtParamInfo()
static bool functionUsesSEHTry()
static bool emitLifetimeMarkers()
static bool lowerAggregateLoadStore()
static bool opCallSurroundingTry()
static bool nothrowAttr()
static bool opCallReturn()
static bool opCallPaddingArgs()
static bool opCallExtParameterInfo()
static bool dataLayoutTypeAllocSize()
static bool opCallObjCMethod()
static bool opCallInAlloca()
static bool opCallCallConv()
static bool opFuncCallingConv()
static bool opCallAttrs()
static bool opCallImplicitObjectSizeArgs()
static bool opCallMustTail()
static bool cudaSupport()
static bool opCallFnInfoOpts()
static bool msvcCXXPersonality()
static bool opCallCIRGenFuncInfoParamInfo()
Similar to AddedStructorArgs, but only notes the number of additional arguments.
cir::TryOp getClosestTryParent()
llvm::PointerUnion< const clang::FunctionProtoType *, const clang::ObjCMethodDecl * > p
void copyInto(CIRGenFunction &cgf, Address addr, mlir::Location loc) const
Definition CIRGenCall.cpp:724