18#include "mlir/Dialect/LLVMIR/LLVMDialect.h"
19#include "mlir/IR/Attributes.h"
22#include "llvm/ADT/FloatingPointMode.h"
23#include "llvm/ADT/StringSet.h"
24#include "llvm/Support/TypeSize.h"
33 void *buffer =
operator new(
34 totalSizeToAlloc<CanQualType>(
argTypes.size() + 1));
38 CIRGenFunctionInfo *fi =
new (buffer) CIRGenFunctionInfo();
40 fi->noReturn = info.getNoReturn();
43 fi->required = required;
50 assert((!required.allowsOptionalArgs() ||
51 required.getNumRequiredArgs() <= fi->numArgs) &&
52 "more required arguments than argument types");
54 fi->getArgTypes()[0] = resultType;
67 mlir::Type resultType =
convertType(info.getReturnType());
69 argTypes.reserve(info.getNumRequiredArgs());
71 for (
const CanQualType &argType : info.requiredArguments())
74 return cir::FuncType::get(argTypes,
75 (resultType ? resultType : builder.getVoidTy()),
101 mlir::OpBuilder::InsertionGuard guard(builder);
102 builder.setInsertionPointAfter(value.getDefiningOp());
103 builder.createStore(*
currSrcLoc, value, dest);
107 mlir::NamedAttrList &attrs,
114 attrs.set(cir::CIRDialect::getNoThrowAttrName(),
115 mlir::UnitAttr::get(builder.getContext()));
119 mlir::NamedAttrList &attrs,
121 const NoBuiltinAttr *nba =
nullptr) {
125 if (langOpts.NoBuiltin ||
126 (nba && llvm::is_contained(nba->builtinNames(),
"*"))) {
129 attrs.set(cir::CIRDialect::getNoBuiltinsAttrName(),
130 mlir::ArrayAttr::get(&ctx, {}));
134 llvm::SetVector<mlir::Attribute> nbFuncs;
135 auto addNoBuiltinAttr = [&ctx, &nbFuncs](StringRef builtinName) {
136 nbFuncs.insert(mlir::StringAttr::get(&ctx, builtinName));
145 llvm::for_each(nba->builtinNames(), addNoBuiltinAttr);
147 if (!nbFuncs.empty())
148 attrs.set(cir::CIRDialect::getNoBuiltinsAttrName(),
149 mlir::ArrayAttr::get(&ctx, nbFuncs.getArrayRef()));
156 llvm::DenormalMode fp32DenormalMode,
157 mlir::NamedAttrList &attrs) {
169 mlir::NamedAttrList &attrs) {
174static llvm::StringLiteral
177 case llvm::ZeroCallUsedRegs::ZeroCallUsedRegsKind::Skip:
178 llvm_unreachable(
"No string value, shouldn't be able to get here");
179 case llvm::ZeroCallUsedRegs::ZeroCallUsedRegsKind::UsedGPRArg:
180 return "used-gpr-arg";
181 case llvm::ZeroCallUsedRegs::ZeroCallUsedRegsKind::UsedGPR:
183 case llvm::ZeroCallUsedRegs::ZeroCallUsedRegsKind::UsedArg:
185 case llvm::ZeroCallUsedRegs::ZeroCallUsedRegsKind::Used:
187 case llvm::ZeroCallUsedRegs::ZeroCallUsedRegsKind::AllGPRArg:
188 return "all-gpr-arg";
189 case llvm::ZeroCallUsedRegs::ZeroCallUsedRegsKind::AllGPR:
191 case llvm::ZeroCallUsedRegs::ZeroCallUsedRegsKind::AllArg:
193 case llvm::ZeroCallUsedRegs::ZeroCallUsedRegsKind::All:
197 llvm_unreachable(
"Unknown kind?");
204 mlir::MLIRContext *mlirCtx, StringRef name,
bool hasOptNoneAttr,
206 bool attrOnCallSite, mlir::NamedAttrList &attrs) {
209 if (!hasOptNoneAttr) {
210 if (codeGenOpts.OptimizeSize)
211 attrs.set(cir::CIRDialect::getOptimizeForSizeAttrName(),
212 mlir::UnitAttr::get(mlirCtx));
213 if (codeGenOpts.OptimizeSize == 2)
214 attrs.set(cir::CIRDialect::getMinSizeAttrName(),
215 mlir::UnitAttr::get(mlirCtx));
221 if (attrOnCallSite) {
224 attrs.set(cir::CIRDialect::getNoBuiltinAttrName(),
225 mlir::UnitAttr::get(mlirCtx));
228 attrs.set(cir::CIRDialect::getTrapFuncNameAttrName(),
229 mlir::StringAttr::get(mlirCtx, codeGenOpts.
TrapFuncName));
244 if (codeGenOpts.getZeroCallUsedRegs() ==
245 llvm::ZeroCallUsedRegs::ZeroCallUsedRegsKind::Skip)
246 attrs.erase(cir::CIRDialect::getZeroCallUsedRegsAttrName());
248 attrs.set(cir::CIRDialect::getZeroCallUsedRegsAttrName(),
249 mlir::StringAttr::get(mlirCtx,
251 codeGenOpts.getZeroCallUsedRegs())));
260 attrs.set(cir::CIRDialect::getConvergentAttrName(),
261 mlir::UnitAttr::get(mlirCtx));
267 if (codeGenOpts.SaveRegParams && !attrOnCallSite)
268 attrs.set(cir::CIRDialect::getSaveRegParamsAttrName(),
269 mlir::UnitAttr::get(mlirCtx));
278 [mlirCtx](llvm::StringRef arg) {
279 auto [var, value] = arg.split(
'=');
282 ? cast<mlir::Attribute>(mlir::UnitAttr::get(mlirCtx))
283 : cast<mlir::Attribute>(mlir::StringAttr::get(mlirCtx, value));
284 return mlir::NamedAttribute(var, valueAttr);
287 if (!defaultFuncAttrs.empty())
288 attrs.set(cir::CIRDialect::getDefaultFuncAttrsAttrName(),
289 mlir::DictionaryAttr::get(mlirCtx, defaultFuncAttrs));
301 mlir::NamedAttrList &attrs) {
304 codeGenOpts, langOpts, attrOnCallSite,
307 if (!attrOnCallSite) {
320 mlir::NamedAttrList &retAttrs, cir::CallingConv &callingConv,
321 cir::SideEffect &sideEffect,
bool attrOnCallSite,
bool isThunk) {
323 sideEffect = cir::SideEffect::All;
325 auto addUnitAttr = [&](llvm::StringRef name) {
329 if (info.isNoReturn())
330 addUnitAttr(cir::CIRDialect::getNoReturnAttrName());
342 const NoBuiltinAttr *nba =
nullptr;
348 if (targetDecl->
hasAttr<NoThrowAttr>())
349 addUnitAttr(cir::CIRDialect::getNoThrowAttrName());
354 if (targetDecl->
hasAttr<NoReturnAttr>())
355 addUnitAttr(cir::CIRDialect::getNoReturnAttrName());
356 if (targetDecl->
hasAttr<ReturnsTwiceAttr>())
357 addUnitAttr(cir::CIRDialect::getReturnsTwiceAttrName());
358 if (targetDecl->
hasAttr<ColdAttr>())
359 addUnitAttr(cir::CIRDialect::getColdAttrName());
360 if (targetDecl->
hasAttr<HotAttr>())
361 addUnitAttr(cir::CIRDialect::getHotAttrName());
362 if (targetDecl->
hasAttr<NoDuplicateAttr>())
363 addUnitAttr(cir::CIRDialect::getNoDuplicatesAttrName());
364 if (targetDecl->
hasAttr<ConvergentAttr>())
365 addUnitAttr(cir::CIRDialect::getConvergentAttrName());
367 if (
const FunctionDecl *func = dyn_cast<FunctionDecl>(targetDecl)) {
381 if (func->isNoReturn())
382 addUnitAttr(cir::CIRDialect::getNoReturnAttrName());
383 nba = func->getAttr<NoBuiltinAttr>();
390 if (targetDecl->
hasAttr<ConstAttr>()) {
393 sideEffect = cir::SideEffect::Const;
394 }
else if (targetDecl->
hasAttr<PureAttr>()) {
396 sideEffect = cir::SideEffect::Pure;
399 attrs.set(cir::CIRDialect::getSideEffectAttrName(),
405 if (targetDecl->
hasAttr<ReturnsNonNullAttr>() &&
406 !codeGenOpts.NullPointerIsValid)
407 retAttrs.set(mlir::LLVM::LLVMDialect::getNonNullAttrName(),
409 if (targetDecl->
hasAttr<AnyX86NoCallerSavedRegistersAttr>())
410 addUnitAttr(cir::CIRDialect::getNoCallerSavedRegsAttrName());
413 if (targetDecl->
hasAttr<LeafAttr>())
414 addUnitAttr(cir::CIRDialect::getNoCallbackAttrName());
418 if (
auto *allocSizeAttr = targetDecl->
getAttr<AllocSizeAttr>()) {
419 unsigned size = allocSizeAttr->getElemSizeParam().getLLVMIndex();
421 if (allocSizeAttr->getNumElemsParam().isValid()) {
422 unsigned numElts = allocSizeAttr->getNumElemsParam().getLLVMIndex();
423 attrs.set(cir::CIRDialect::getAllocSizeAttrName(),
424 builder.getDenseI32ArrayAttr(
425 {static_cast<int>(size), static_cast<int>(numElts)}));
427 attrs.set(cir::CIRDialect::getAllocSizeAttrName(),
428 builder.getDenseI32ArrayAttr({static_cast<int>(size)}));
435 if (langOpts.CUDA && !langOpts.CUDAIsDevice &&
436 targetDecl->
hasAttr<CUDAGlobalAttr>()) {
440 auto attr = cir::CUDAKernelNameAttr::get(
443 attrs.set(
attr.getMnemonic(),
attr);
448 if (
auto *modularFormat = targetDecl->
getAttr<ModularFormatAttr>()) {
450 StringRef
type =
format->getType()->getName();
451 std::string formatIdx = std::to_string(
format->getFormatIdx());
452 std::string firstArg = std::to_string(
format->getFirstArg());
454 type, formatIdx, firstArg,
455 modularFormat->getModularImplFn()->getName(),
456 modularFormat->getImplName()};
457 llvm::append_range(args, modularFormat->aspects());
458 attrs.set(cir::CIRDialect::getModularFormatAttrName(),
459 builder.getStringAttr(llvm::join(args,
",")));
465 bool hasOptNoneAttr = targetDecl && targetDecl->
hasAttr<OptimizeNoneAttr>();
477 if (targetDecl->
hasAttr<ZeroCallUsedRegsAttr>()) {
480 targetDecl->
getAttr<ZeroCallUsedRegsAttr>()->getZeroCallUsedRegs();
482 cir::CIRDialect::getZeroCallUsedRegsAttrName(),
483 mlir::StringAttr::get(
485 ZeroCallUsedRegsAttr::ConvertZeroCallUsedRegsKindToStr(
kind)));
488 if (targetDecl->
hasAttr<NoConvergentAttr>())
489 attrs.erase(cir::CIRDialect::getConvergentAttrName());
494 if (!attrOnCallSite) {
498 static const llvm::StringSet<> returnsTwiceFn{
499 "_setjmpex",
"setjmp",
"_setjmp",
"vfork",
500 "sigsetjmp",
"__sigsetjmp",
"savectx",
"getcontext"};
501 if (returnsTwiceFn.contains(name))
502 addUnitAttr(cir::CIRDialect::getReturnsTwiceAttrName());
504 llvm::StringMap<std::string> cpuAndFeatures;
507 for (
const auto &[key, val] : cpuAndFeatures)
508 attrs.set(key, builder.getStringAttr(val));
518 constructFunctionReturnAttributes(info, targetDecl, isThunk, retAttrs);
519 constructFunctionArgumentAttributes(info, targetDecl, isThunk, attrOnCallSite,
523bool CIRGenModule::hasStrictReturn(
QualType retTy,
const Decl *targetDecl) {
529 if (
getLangOpts().Sanitize.has(SanitizerKind::Memory))
536 if (
const FunctionDecl *func = dyn_cast<FunctionDecl>(targetDecl)) {
537 if (func->isExternC())
539 }
else if (
const VarDecl *var = dyn_cast<VarDecl>(targetDecl)) {
541 if (var->isExternC())
554bool CIRGenModule::mayDropFunctionReturn(
const ASTContext &context,
558 if (
const RecordType *recTy =
560 if (
const auto *record = dyn_cast<CXXRecordDecl>(recTy->getDecl()))
561 return record->hasTrivialDestructor();
604 if (
const MatrixType *Matrix = dyn_cast<MatrixType>(clangTy))
616 if (langOpts.NoHonorInfs)
618 if (langOpts.NoHonorNaNs)
623void CIRGenModule::constructFunctionReturnAttributes(
625 mlir::NamedAttrList &retAttrs) {
627 QualType retTy =
info.getReturnType();
628 const cir::ABIArgInfo retInfo =
info.getReturnInfo();
631 if (codeGenOpts.EnableNoundefAttrs && hasStrictReturn(retTy, targetDecl) &&
634 retAttrs.set(mlir::LLVM::LLVMDialect::getNoUndefAttrName(),
639 retAttrs.set(mlir::LLVM::LLVMDialect::getNoFPClassAttrName(),
640 builder.getI64IntegerAttr(mask));
646 if (
const auto *refTy = retTy->
getAs<ReferenceType>()) {
647 QualType pointeeTy = refTy->getPointeeType();
649 retAttrs.set(mlir::LLVM::LLVMDialect::getDereferenceableAttrName(),
650 builder.getI64IntegerAttr(
653 if (
getTypes().getTargetAddressSpace(pointeeTy) == 0 &&
654 !codeGenOpts.NullPointerIsValid)
655 retAttrs.set(mlir::LLVM::LLVMDialect::getNonNullAttrName(),
659 retAttrs.set(mlir::LLVM::LLVMDialect::getAlignAttrName(),
660 builder.getI64IntegerAttr(
666void CIRGenModule::constructFunctionArgumentAttributes(
668 bool attrOnCallSite, llvm::MutableArrayRef<mlir::NamedAttrList> argAttrs) {
673 if (
info.isInstanceMethod() && !isThunk) {
674 QualType thisPtrTy =
info.arguments()[0];
680 if (!codeGenOpts.NullPointerIsValid &&
681 getTypes().getTargetAddressSpace(thisPtrTy) == 0) {
682 argAttrs[0].set(mlir::LLVM::LLVMDialect::getDereferenceableAttrName(),
683 builder.getI64IntegerAttr(
685 argAttrs[0].set(mlir::LLVM::LLVMDialect::getNonNullAttrName(),
692 mlir::LLVM::LLVMDialect::getDereferenceableOrNullAttrName(),
693 builder.getI64IntegerAttr(
bytes));
697 mlir::LLVM::LLVMDialect::getAlignAttrName(),
698 builder.getI64IntegerAttr(
715 const auto *fd = dyn_cast_or_null<FunctionDecl>(targetDecl);
720 SmallVector<const ParmVarDecl *> parmDecls;
721 parmDecls.reserve(argAttrs.size());
723 if (
info.isInstanceMethod())
724 parmDecls.push_back(
nullptr);
725 parmDecls.insert(parmDecls.end(), fd->param_begin(), fd->param_end());
727 parmDecls.resize(argAttrs.size(),
nullptr);
729 for (
const auto &[argAttrList, argCanType, pvd] :
730 llvm::zip_equal(argAttrs,
info.arguments(), parmDecls)) {
732 QualType argType = argCanType;
735 if (codeGenOpts.EnableNoundefAttrs &&
737 argAttrList.set(mlir::LLVM::LLVMDialect::getNoUndefAttrName(),
745 if (
const auto *refTy = argType->
getAs<ReferenceType>()) {
748 argAttrList.set(mlir::LLVM::LLVMDialect::getDereferenceableAttrName(),
749 builder.getI64IntegerAttr(
751 if (
getTypes().getTargetAddressSpace(pointeeTy) == 0 &&
752 !codeGenOpts.NullPointerIsValid)
753 argAttrList.set(mlir::LLVM::LLVMDialect::getNonNullAttrName(),
757 mlir::LLVM::LLVMDialect::getAlignAttrName(),
758 builder.getI64IntegerAttr(
764 argAttrList.set(mlir::LLVM::LLVMDialect::getNoFPClassAttrName(),
765 builder.getI64IntegerAttr(mask));
769 if (!attrOnCallSite && pvd && pvd->getType()->isPointerType() &&
770 pvd->getType().isRestrictQualified() && !fd->getBuiltinID())
771 argAttrList.set(mlir::LLVM::LLVMDialect::getNoAliasAttrName(),
776 if (pvd && argType->
isAnyPointerType() && !codeGenOpts.NullPointerIsValid) {
777 unsigned srcIdx = pvd->getFunctionScopeIndex();
778 if (pvd->hasAttr<NonNullAttr>() ||
779 (fd->getAttr<NonNullAttr>() &&
780 fd->getAttr<NonNullAttr>()->isNonNull(srcIdx)))
781 argAttrList.set(mlir::LLVM::LLVMDialect::getNonNullAttrName(),
801 if (!fpt->hasExtParameterInfos()) {
802 prefix.append(fpt->param_type_begin(), fpt->param_type_end());
809 prefix.reserve(prefix.size() + fpt->getNumParams());
811 fpt->getExtParameterInfos();
812 assert(extInfos.size() == fpt->getNumParams());
813 for (
auto [paramType, extInfo] : llvm::zip_equal(
814 llvm::make_range(fpt->param_type_begin(), fpt->param_type_end()),
816 prefix.push_back(paramType);
817 if (extInfo.hasPassObjectSize())
829 bool passParams =
true;
831 if (
auto *cd = dyn_cast<CXXConstructorDecl>(md)) {
834 if (
auto inherited = cd->getInheritedConstructor())
845 theCXXABI.buildStructorSignature(gd, argTypes);
849 (passParams && md->isVariadic() ?
RequiredArgs(argTypes.size())
852 CanQualType resultType = theCXXABI.hasThisReturn(gd) ? argTypes.front()
853 : theCXXABI.hasMostDerivedReturn(gd)
854 ? astContext.VoidPtrTy
857 assert(!theCXXABI.hasThisReturn(gd) &&
858 "Please send PR with a test and remove this");
864 fpt->getExtInfo(), required);
880 cgm.errorNYI(
"deriveThisType: no record decl");
903 fpt->getExtInfo(), required);
917 if (
type->isReferenceType()) {
923 "emitDelegateCallArg: ObjCAutoRefCount");
932 if (
type->isRecordType() &&
933 type->castAsRecordDecl()->isParamDestroyedInCallee() &&
936 "emitDelegateCallArg: callee-destructed param");
947 if (
const auto *proto = dyn_cast<FunctionProtoType>(fnType)) {
953 if (proto->isVariadic())
957 cgm.
errorNYI(
"call to function without a prototype");
960 for (
const CallArg &arg : args)
978 unsigned extraPrefixArgs,
unsigned extraSuffixArgs,
bool passProtoArgs) {
982 for (
const auto &arg : args)
983 argTypes.push_back(astContext.getCanonicalParamType(arg.ty));
986 unsigned totalPrefixArgs = 1 + extraPrefixArgs;
991 fpt, totalPrefixArgs + extraSuffixArgs)
995 if (theCXXABI.hasThisReturn(gd))
997 "arrangeCXXConstructorCall: hasThisReturn");
998 if (theCXXABI.hasMostDerivedReturn(gd))
1000 "arrangeCXXConstructorCall: hasMostDerivedReturn");
1007 fpt->getExtInfo(), required);
1018 assert(numPrefixArgs + 1 <= args.size() &&
1019 "Emitting a call with less args than the required prefix?");
1023 for (
const CallArg &arg : args)
1024 argTypes.push_back(astContext.getCanonicalParamType(arg.ty));
1029 true, argTypes, proto->
getExtInfo(), required);
1042 for (
const CallArg &arg : args)
1043 argTypes.push_back(astContext.getCanonicalParamType(arg.ty));
1072 auto *thisType = theCXXABI.getThisArgumentTypeForMethod(md);
1094 return ::arrangeCIRFunctionInfo(
1095 *
this,
true, argTypes,
1103 if (
const auto *md = dyn_cast<CXXMethodDecl>(fd))
1104 if (md->isInstance())
1140 if (!ac.
getDecl() || !(
sanOpts.has(SanitizerKind::NonnullAttribute) ||
1141 sanOpts.has(SanitizerKind::NullabilityArg)))
1143 cgm.errorNYI(
"non-null arg check is NYI");
1146static cir::CIRCallOpInterface
1148 cir::FuncType indirectFuncTy, mlir::Value indirectFuncVal,
1149 cir::FuncOp directFuncOp,
1151 const mlir::NamedAttrList &attrs,
1153 const mlir::NamedAttrList &retAttrs) {
1158 assert(builder.getInsertionBlock() &&
"expected valid basic block");
1161 if (indirectFuncTy) {
1165 cirCallArgs, attrs, argAttrs, retAttrs);
1167 op = builder.
createCallOp(callLoc, directFuncOp, cirCallArgs, attrs,
1168 argAttrs, retAttrs);
1178 return ::arrangeCIRFunctionInfo(*
this,
false, argTypes,
1194 cir::CIRCallOpInterface *callOp,
1195 bool isMustTail, mlir::Location loc) {
1203 const FunctionDecl *calleeDecl = dyn_cast_or_null<FunctionDecl>(targetDecl);
1208 for (
auto [argNo, arg, canQualArgType] :
1209 llvm::enumerate(args, funcInfo.
argTypes())) {
1215 if (!mlir::isa<cir::RecordType>(argType) &&
1216 !mlir::isa<cir::ComplexType>(argType)) {
1218 if (arg.isAggregate())
1219 cgm.errorNYI(loc,
"emitCall: aggregate call argument");
1220 v = arg.getKnownRValue().getValue();
1223 if (argType != v.getType() && mlir::isa<cir::IntType>(v.getType()))
1224 cgm.errorNYI(loc,
"emitCall: widening integer call argument");
1228 if (argType != v.getType()) {
1229 auto argPtrTy = mlir::dyn_cast<cir::PointerType>(argType);
1230 auto vPtrTy = mlir::dyn_cast<cir::PointerType>(v.getType());
1231 if (argPtrTy && vPtrTy &&
1232 argPtrTy.getPointee() == vPtrTy.getPointee() &&
1233 argPtrTy.getAddrSpace() != vPtrTy.getAddrSpace()) {
1243 cirCallArgs[argNo] = v;
1246 if (!arg.isAggregate()) {
1248 arg.copyInto(*
this, src, loc);
1250 src = arg.hasLValue() ? arg.getKnownLValue().getAddress()
1251 : arg.getKnownRValue().getAggregateAddress();
1258 mlir::Location argLoc = loc;
1271 if (srcTy != argType) {
1272 cgm.errorNYI(loc,
"emitCall: source type does not match argument type");
1288 cirCallArgs[argNo] = builder.createLoad(argLoc, src);
1297 mlir::NamedAttrList attrs;
1298 std::vector<mlir::NamedAttrList> argAttrs(funcInfo.
arguments().size());
1299 mlir::NamedAttrList retAttrs;
1301 if (
auto calleeFuncOp = dyn_cast<cir::FuncOp>(calleePtr))
1302 funcName = calleeFuncOp.getName();
1306 cir::CallingConv callingConv;
1307 cir::SideEffect sideEffect;
1309 attrs, argAttrs, retAttrs, callingConv, sideEffect,
1312 auto resolvedFuncOpFromGlobal = [&](mlir::Operation *op) -> cir::FuncOp {
1313 if (
auto fnOp = dyn_cast<cir::FuncOp>(op))
1315 if (
auto getGlobalOp = dyn_cast<cir::GetGlobalOp>(op)) {
1320 mlir::Operation *globalOp =
cgm.getGlobalValue(getGlobalOp.getName());
1321 assert(globalOp &&
"undefined global function");
1327 cir::FuncType indirectFuncTy;
1328 mlir::Value indirectFuncVal;
1329 cir::FuncOp directFuncOp;
1338 if (cir::FuncOp candidate = resolvedFuncOpFromGlobal(calleePtr)) {
1339 if (candidate.getFunctionType() == cirFuncTy) {
1340 directFuncOp = candidate;
1342 mlir::Value addr = cir::GetGlobalOp::create(
1343 builder, loc, cir::PointerType::get(candidate.getFunctionType()),
1344 candidate.getSymName());
1345 indirectFuncTy = cirFuncTy;
1347 builder.createBitcast(addr, cir::PointerType::get(cirFuncTy));
1350 [[maybe_unused]] mlir::ValueTypeRange<mlir::ResultRange> resultTypes =
1351 calleePtr->getResultTypes();
1352 [[maybe_unused]]
auto funcPtrTy =
1353 mlir::dyn_cast<cir::PointerType>(resultTypes.front());
1354 assert(funcPtrTy && mlir::isa<cir::FuncType>(funcPtrTy.getPointee()) &&
1355 "expected pointer to function");
1357 indirectFuncTy = cirFuncTy;
1358 indirectFuncVal = calleePtr->getResult(0);
1365 bool cannotThrow = attrs.getNamed(
"nothrow").has_value();
1368 mlir::Location callLoc = loc;
1369 cir::CIRCallOpInterface theCall =
1370 emitCallLikeOp(*
this, loc, indirectFuncTy, indirectFuncVal, directFuncOp,
1371 cirCallArgs, isInvoke, attrs, argAttrs, retAttrs);
1381 theCall.setInlineKind(cir::InlineKind::NoInline);
1383 !
cgm.getTargetCIRGenInfo().wouldInliningViolateFunctionCallABI(
1384 callerDecl, calleeDecl))
1385 theCall.setInlineKind(cir::InlineKind::AlwaysInline);
1391 if (triple.isPPC() || triple.isMIPS()) {
1393 "musttail call target legality checks");
1403 "musttail call that skips cleanups");
1407 theCall->setAttr(cir::CIRDialect::getMustTailAttrName(),
1408 builder.getUnitAttr());
1411 cir::ReturnOp::create(builder, loc);
1413 cir::ReturnOp::create(builder, loc, theCall->getResult(0));
1418 builder.createBlock(builder.getBlock()->getParent());
1434 mlir::ResultRange results = theCall->getOpResults();
1435 assert(results.size() <= 1 &&
"multiple returns from a call");
1442 mlir::ResultRange results = theCall->getOpResults();
1443 assert(results.size() == 1 &&
"unexpected number of returns");
1447 if (results[0].
getType() != retCIRTy)
1448 cgm.errorNYI(loc,
"bitcast on function return value");
1450 mlir::Region *region = builder.getBlock()->getParent();
1451 if (region != theCall->getParentRegion())
1452 cgm.errorNYI(loc,
"function calls with cleanup");
1457 mlir::ResultRange results = theCall->getOpResults();
1458 assert(!results.empty() &&
1459 "Expected at least one result for complex rvalue");
1463 llvm_unreachable(
"Invalid evaluation kind");
1467 mlir::Location loc)
const {
1469 if (!hasLV &&
rv.isScalar())
1471 else if (!hasLV &&
rv.isComplex())
1481 mlir::NamedAttrList attrs) {
1486 cir::CallOp call = builder.createCallOp(loc, callee, args);
1487 assert(call->getNumResults() <= 1 &&
1488 "runtime functions have at most 1 result");
1491 call->setAttrs(attrs);
1493 if (call->getNumResults() == 0)
1496 return call->getResult(0);
1502 "reference binding to unmaterialized r-value!");
1518 bool destroyedInCallee =
true;
1520 destroyedInCallee = rd->hasNonTrivialDestructor();
1522 if (destroyedInCallee)
1527 args.
add(rv, argType);
1529 if (destroyedInCallee &&
getLangOpts().Exceptions)
1531 "callee-destructed param with exceptions");
1546QualType CIRGenFunction::getVarArgType(
const Expr *arg) {
1551 return arg->getType();
1554 cgm.
errorNYI(arg->getSourceRange(),
"getVarArgType: NYI for Windows target");
1555 return arg->getType();
1572 llvm::iterator_range<clang::CallExpr::const_arg_iterator> argRange,
1579 bool isVariadic =
false;
1584 isVariadic = fpt->isVariadic();
1586 argTypes.assign(fpt->param_type_begin() + paramsToSkip,
1587 fpt->param_type_end());
1591 for (
const clang::Expr *a : llvm::drop_begin(argRange, argTypes.size()))
1592 argTypes.push_back(isVariadic ? getVarArgType(a) : a->getType());
1593 assert(argTypes.size() == (
size_t)(argRange.end() - argRange.begin()));
1600 auto leftToRight =
true;
1603 auto maybeEmitImplicitObjectSize = [&](
size_t i,
const Expr *arg,
1612 assert(emittedArg.getValue() &&
"We emitted nothing for the arg?");
1615 emittedArg.getValue(), ps->isDynamic());
1621 std::iter_swap(args.rbegin(), std::next(args.rbegin()));
1625 size_t callArgsStart = args.size();
1626 for (
size_t i = 0; i != argTypes.size(); ++i) {
1627 size_t idx = leftToRight ? i : argTypes.size() - i - 1;
1629 size_t initialArgSize = args.size();
1635 assert(initialArgSize + 1 == args.size() &&
1636 "The code below depends on only adding one arg per emitCallArg");
1637 (void)initialArgSize;
1641 if (!args.back().hasLValue()) {
1642 RValue rvArg = args.back().getKnownRValue();
1644 maybeEmitImplicitObjectSize(idx, *currentArg, rvArg);
1648 std::reverse(args.begin() + callArgsStart, args.end());
static StringRef bytes(const std::vector< T, Allocator > &v)
static void addTrivialDefaultFunctionAttributes(mlir::MLIRContext *mlirCtx, StringRef name, bool hasOptNoneAttr, const CodeGenOptions &codeGenOpts, const LangOptions &langOpts, bool attrOnCallSite, mlir::NamedAttrList &attrs)
Add default attributes to a function, which have merge semantics under -mlink-builtin-bitcode and sho...
static void addNoBuiltinAttributes(mlir::MLIRContext &ctx, mlir::NamedAttrList &attrs, const LangOptions &langOpts, const NoBuiltinAttr *nba=nullptr)
static bool determineNoUndef(QualType clangTy, CIRGenTypes &types, const cir::CIRDataLayout &layout, const cir::ABIArgInfo &argInfo)
static void addDenormalModeAttrs(llvm::DenormalMode fpDenormalMode, llvm::DenormalMode fp32DenormalMode, mlir::NamedAttrList &attrs)
Add denormal-fp-math and denormal-fp-math-f32 as appropriate for the requested denormal behavior,...
static unsigned getNoFPClassTestMask(const LangOptions &langOpts)
Compute the nofpclass mask for FP types based on language options.
static void addMergeableDefaultFunctionAttributes(const CodeGenOptions &codeGenOpts, mlir::NamedAttrList &attrs)
Add default attributes to a function, which have merge semantics under -mlink-builtin-bitcode and sho...
static void appendParameterTypes(const CIRGenTypes &cgt, SmallVectorImpl< CanQualType > &prefix, CanQual< FunctionProtoType > fpt)
Adds the formal parameters in FPT to the given prefix.
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, llvm::ArrayRef< mlir::NamedAttrList > argAttrs, const mlir::NamedAttrList &retAttrs)
static void addAttributesFromFunctionProtoType(CIRGenBuilderTy &builder, mlir::NamedAttrList &attrs, const FunctionProtoType *fpt)
static llvm::StringLiteral getZeroCallUsedRegsKindStr(llvm::ZeroCallUsedRegs::ZeroCallUsedRegsKind k)
static CanQual< FunctionProtoType > getFormalType(const CXXMethodDecl *md)
Returns the canonical formal type of the given C++ method.
static const CIRGenFunctionInfo & arrangeFreeFunctionLikeCall(CIRGenTypes &cgt, CIRGenModule &cgm, const CallArgList &args, const FunctionType *fnType)
static const CIRGenFunctionInfo & arrangeCIRFunctionInfo(CIRGenTypes &cgt, bool instanceMethod, 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...
static StringRef getTriple(const Command &Job)
*collection of selector each with an associated kind and an ordered *collection of selectors A selector has a kind
static bool isVirtualCall(const CallExpr *CE)
bool isIndirectAliased() const
static ABIArgInfo getDirect(mlir::Type ty=nullptr)
cir::CallOp createIndirectCallOp(mlir::Location loc, mlir::Value indirectTarget, cir::FuncType funcType, mlir::ValueRange operands, llvm::ArrayRef< mlir::NamedAttribute > attrs={}, llvm::ArrayRef< mlir::NamedAttrList > argAttrs={}, llvm::ArrayRef< mlir::NamedAttribute > resAttrs={})
cir::CallOp createCallOp(mlir::Location loc, mlir::SymbolRefAttr callee, mlir::Type returnType, mlir::ValueRange operands, llvm::ArrayRef< mlir::NamedAttribute > attrs={}, llvm::ArrayRef< mlir::NamedAttrList > argAttrs={}, llvm::ArrayRef< mlir::NamedAttribute > resAttrs={})
bool typeSizeEqualsStoreSize(mlir::Type ty) const
Returns true if no extra padding bits are needed when storing the specified type.
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 getCanonicalSizeType() const
QualType getSizeType() const
Return the unique type for "size_t" (C99 7.17), defined in <stddef.h>.
const TargetInfo & getTargetInfo() const
CanQualType getCanonicalTagType(const TagDecl *TD) const
Represents an array type, per C99 6.7.5.2 - Array Declarators.
mlir::Type getElementType() const
void setExternallyDestructed(bool destructed=true)
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.
Address getThisAddress() const
cir::FuncType getVirtualFunctionType() const
const clang::CallExpr * getVirtualCallExpr() const
mlir::Operation * getFunctionPointer() const
CanQualType getReturnType() const
static CIRGenFunctionInfo * create(FunctionType::ExtInfo info, bool instanceMethod, CanQualType resultType, llvm::ArrayRef< CanQualType > argTypes, RequiredArgs required)
llvm::MutableArrayRef< CanQualType > argTypes()
bool isInstanceMethod() const
llvm::ArrayRef< CanQualType > arguments() const
const_arg_iterator argTypesBegin() const
An abstract representation of regular/ObjC call/message targets.
bool hasFunctionDecl() const
unsigned getNumParams() const
const clang::Decl * getDecl() 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)
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.
EHScopeStack::stable_iterator prologueCleanupDepth
The cleanup depth enclosing all the cleanups associated with the parameters.
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.
void emitAggregateCopy(LValue dest, LValue src, QualType eltTy, AggValueSlot::Overlap_t mayOverlap, bool isVolatile=false)
Emit an aggregate copy.
mlir::Location getLoc(clang::SourceLocation srcLoc)
Helpers to convert Clang's SourceLocation to a MLIR Location.
void emitAggregateStore(mlir::Value value, Address dest)
mlir::Value performAddrSpaceCast(mlir::Value v, mlir::Type destTy) const
RValue emitReferenceBindingToExpr(const Expr *e)
Emits a reference binding to the passed in expression.
mlir::Value evaluateOrEmitBuiltinObjectSize(const clang::Expr *e, unsigned type, cir::IntType resType, mlir::Value emittedE, bool isDynamic)
EHScopeStack ehStack
Tracks function scope overall cleanup handling.
AggValueSlot createAggTemp(QualType ty, mlir::Location loc, const Twine &name="tmp", Address *alloca=nullptr)
Create a temporary memory object for the given aggregate type.
clang::SanitizerSet sanOpts
Sanitizers enabled for this function.
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...
const CallExpr * mustTailCall
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()
void emitCallArg(CallArgList &args, const clang::Expr *e, clang::QualType argType)
const clang::Decl * curCodeDecl
This is the inner-most code context, which includes blocks.
CIRGenBuilderTy & getBuilder()
void emitNonNullArgCheck(RValue rv, QualType argType, SourceLocation argLoc, AbstractCallee ac, unsigned paramNum)
Create a check for a function parameter that may potentially be declared as non-null.
mlir::Value emitRuntimeCall(mlir::Location loc, cir::FuncOp callee, llvm::ArrayRef< mlir::Value > args={}, mlir::NamedAttrList attrs={})
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.
std::optional< mlir::Location > currSrcLoc
Use to track source locations across nested visitor traversals.
clang::ASTContext & getContext() const
RValue emitCall(const CIRGenFunctionInfo &funcInfo, const CIRGenCallee &callee, ReturnValueSlot returnValue, const CallArgList &args, cir::CIRCallOpInterface *callOp, bool isMustTail, mlir::Location loc)
bool inAlwaysInlineAttributedStmt
True if the current statement has always_inline attribute.
bool inNoInlineAttributedStmt
True if the current statement has noinline attribute.
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...
void emitAggExpr(const clang::Expr *e, AggValueSlot slot)
This class organizes the cross-function state that is used while generating CIR code.
llvm::StringRef getMangledName(clang::GlobalDecl gd)
DiagnosticBuilder errorNYI(SourceLocation, llvm::StringRef)
Helpers to emit "not yet implemented" error diagnostics.
clang::ASTContext & getASTContext() const
void addDefaultFunctionAttributes(StringRef name, bool hasOptNoneAttr, bool attrOnCallSite, mlir::NamedAttrList &attrs)
Helper function for constructAttributeList/others.
CIRGenBuilderTy & getBuilder()
CharUnits getMinimumObjectSize(QualType ty)
Returns the minimum object size for an object of the given type.
const cir::CIRDataLayout getDataLayout() const
const clang::CodeGenOptions & getCodeGenOpts() const
const clang::LangOptions & getLangOpts() const
void constructAttributeList(llvm::StringRef name, const CIRGenFunctionInfo &info, CIRGenCalleeInfo calleeInfo, mlir::NamedAttrList &attrs, llvm::MutableArrayRef< mlir::NamedAttrList > argAttrs, mlir::NamedAttrList &retAttrs, cir::CallingConv &callingConv, cir::SideEffect &sideEffect, bool attrOnCallSite, bool isThunk)
Get the CIR attributes and calling convention to use for a particular function type.
const TargetCIRGenInfo & getTargetCIRGenInfo()
mlir::MLIRContext & getMLIRContext()
CIRGenCXXABI & getCXXABI() const
clang::CharUnits getNaturalPointeeTypeAlignment(clang::QualType t, LValueBaseInfo *baseInfo=nullptr)
This class organizes the cross-module state that is used while lowering AST types to CIR types.
const CIRGenFunctionInfo & arrangeGlobalDeclaration(GlobalDecl gd)
const CIRGenFunctionInfo & arrangeCXXMethodDeclaration(const clang::CXXMethodDecl *md)
C++ methods have some special rules and also have implicit parameters.
const CIRGenFunctionInfo & arrangeCXXStructorDeclaration(clang::GlobalDecl gd)
const CIRGenFunctionInfo & arrangeCIRFunctionInfo(CanQualType returnType, bool isInstanceMethod, llvm::ArrayRef< CanQualType > argTypes, FunctionType::ExtInfo info, RequiredArgs required)
const CIRGenFunctionInfo & arrangeFreeFunctionCall(const CallArgList &args, const FunctionType *fnType)
const CIRGenFunctionInfo & arrangeFreeFunctionType(CanQual< FunctionProtoType > fpt)
const CIRGenFunctionInfo & arrangeBuiltinFunctionCall(QualType resultType, const CallArgList &args)
A builtin function is a freestanding function using the default C conventions.
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.
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...
cir::FuncType getFunctionType(const CIRGenFunctionInfo &info)
Get the CIR function type for.
bool inheritingCtorHasParams(const InheritedConstructor &inherited, CXXCtorType type)
Determine if a C++ inheriting constructor should have parameters matching those of its inherited cons...
clang::CanQualType deriveThisType(const clang::CXXRecordDecl *rd, const clang::CXXMethodDecl *md)
Derives the 'this' type for CIRGen purposes, i.e.
const CIRGenFunctionInfo & arrangeFunctionDeclaration(const clang::FunctionDecl *fd)
Free functions are functions that are compatible with an ordinary C function pointer type.
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.
mlir::Type convertType(clang::QualType type)
Convert a Clang type into a mlir::Type.
mlir::Type convertTypeForMem(clang::QualType, bool forBitField=false)
Convert type T into an mlir::Type.
void addUncopiedAggregate(LValue lvalue, clang::QualType type)
void add(RValue rvalue, clang::QualType type)
Address getAddress() const
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.
bool isImplicitObjectMemberFunction() const
[C++2b][dcl.fct]/p7 An implicit object member function is a non-static member function without an exp...
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.
QuantityType getQuantity() const
getQuantity - Get the raw integer representation of this quantity.
CodeGenOptions - Track various options which control how the code is optimized and passed to the back...
llvm::DenormalMode FPDenormalMode
The floating-point denormal mode to use.
llvm::DenormalMode FP32DenormalMode
The floating-point denormal mode to use, for float.
std::string TrapFuncName
If not an empty string, trap intrinsics are lowered to calls to this function instead of to trap inst...
std::vector< std::string > DefaultFunctionAttrs
Complex values, per C99 6.2.5p11.
bool constructsVirtualBase() const
Returns true if the constructed base class is a virtual base class subobject of this declaration's cl...
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.
A class which abstracts out some details necessary for making a call.
FunctionType - C99 6.7.5.3 - Function Declarators.
ExtInfo getExtInfo() const
QualType getReturnType() const
GlobalDecl - represents a global declaration.
CXXCtorType getCtorType() const
GlobalDecl getWithKernelReferenceKind(KernelReferenceKind Kind)
const Decl * getDecl() const
Description of a constructor that was inherited from a base class.
ConstructorUsingShadowDecl * getShadowDecl() const
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
std::vector< std::string > NoBuiltinFuncs
A list of all -fno-builtin-* function names (e.g., memset).
bool isNoBuiltinFunc(StringRef Name) const
Is this a libc/libm function that is no longer recognized as a builtin because a -fno-builtin-* optio...
SanitizerSet Sanitize
Set of enabled sanitizers.
bool assumeFunctionsAreConvergent() const
Represents a matrix type, as defined in the Matrix Types clang extensions.
A (possibly-)qualified type.
bool isTriviallyCopyableType(const ASTContext &Context) const
Return true if this is a trivially copyable type (C++0x [basic.types]p9)
QualType getCanonicalType() const
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...
bool hasConstructorVariants() const
Does this ABI have different entrypoints for complete-object and base-subobject constructors?
const llvm::Triple & getTriple() const
Returns the target triple of the primary target.
TargetCXXABI getCXXABI() const
Get the C++ ABI currently in use.
CXXRecordDecl * getAsCXXRecordDecl() const
Retrieves the CXXRecordDecl that this type refers to, either because the type is a RecordType or beca...
bool isVoidPointerType() const
bool isConstantSizeType() const
Return true if this is not a variable sized type, according to the rules of C99 6....
CanQualType getCanonicalTypeUnqualified() const
bool isReferenceType() const
bool isScalarType() const
QualType getPointeeType() const
If this is a pointer, ObjC object pointer, or block pointer, this returns the respective pointee.
bool isBitIntType() const
RecordDecl * castAsRecordDecl() const
bool isMemberPointerType() const
bool isObjectType() const
Determine whether this type is an object type.
bool isIncompleteType(NamedDecl **Def=nullptr) const
Types are partitioned into 3 broad categories (C99 6.2.5p1): object types, function types,...
bool hasFloatingRepresentation() const
Determine whether this type has a floating-point representation of some sort, e.g....
const T * getAsCanonical() const
If this type is canonically the specified type, return its canonical type cast to that specified type...
bool isAnyPointerType() const
const T * getAs() const
Member-template getAs<specific type>'.
bool isNullPtrType() const
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?
Represents a GCC generic vector type.
bool isSized(mlir::Type ty)
Returns true if the type is a CIR sized type.
@ 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.
void info(bool Verbose, unsigned Level, const char *Fmt, Ts &&...Args)
Prints an indented note to stderr when Verbose is set.
Top level wrappers for InstallAPI frontend operations.
CanQual< Type > CanQualType
Represents a canonical, potentially-qualified type.
CXXCtorType
C++ constructor types.
@ Ctor_Complete
Complete object ctor.
bool isa(CodeGen::Address addr)
bool isUnresolvedExceptionSpec(ExceptionSpecificationType ESpecType)
@ OK_Ordinary
An ordinary object is located at an address in memory.
@ Vector
'vector' clause, allowed on 'loop', Combined, and 'routine' directives.
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 cudaSupport()
static bool opCallFnInfoOpts()
static bool msvcCXXPersonality()
static bool opCallCIRGenFuncInfoParamInfo()
Similar to AddedStructorArgs, but only notes the number of additional arguments.
llvm::PointerUnion< const clang::FunctionProtoType *, const clang::ObjCMethodDecl * > p
RValue getRValue(CIRGenFunction &cgf, mlir::Location loc) const
void copyInto(CIRGenFunction &cgf, Address addr, mlir::Location loc) const
bool has(SanitizerMask K) const
Check if a certain (single) sanitizer is enabled.