void OutliningMetadataCollector::emitCallToOutlinedCopy( Address dest, Address src, SILType T, const TypeInfo &ti, IsInitialization_t isInit, IsTake_t isTake) const { llvm::SmallVector<llvm::Value *, 4> args; args.push_back(IGF.Builder.CreateElementBitCast(src, ti.getStorageType()) .getAddress()); args.push_back(IGF.Builder.CreateElementBitCast(dest, ti.getStorageType()) .getAddress()); addMetadataArguments(args); llvm::Constant *outlinedFn; if (isInit && isTake) { outlinedFn = IGF.IGM.getOrCreateOutlinedInitializeWithTakeFunction(T, ti, *this); } else if (isInit) { outlinedFn = IGF.IGM.getOrCreateOutlinedInitializeWithCopyFunction(T, ti, *this); } else if (isTake) { outlinedFn = IGF.IGM.getOrCreateOutlinedAssignWithTakeFunction(T, ti, *this); } else { outlinedFn = IGF.IGM.getOrCreateOutlinedAssignWithCopyFunction(T, ti, *this); } llvm::CallInst *call = IGF.Builder.CreateCall(outlinedFn, args); call->setCallingConv(IGF.IGM.DefaultCC); }
void OutliningMetadataCollector::emitCallToOutlinedDestroy( Address addr, SILType T, const TypeInfo &ti) const { llvm::SmallVector<llvm::Value *, 4> args; args.push_back(IGF.Builder.CreateElementBitCast(addr, ti.getStorageType()) .getAddress()); addMetadataArguments(args); auto outlinedFn = IGF.IGM.getOrCreateOutlinedDestroyFunction(T, ti, *this); llvm::CallInst *call = IGF.Builder.CreateCall(outlinedFn, args); call->setCallingConv(IGF.IGM.DefaultCC); }
DebugTypeInfo DebugTypeInfo::getFromTypeInfo(DeclContext *DC, swift::Type Ty, const TypeInfo &Info) { Size size; if (Info.isFixedSize()) { const FixedTypeInfo &FixTy = *cast<const FixedTypeInfo>(&Info); size = FixTy.getFixedSize(); } else { // FIXME: Handle NonFixedTypeInfo here or assert that we won't // encounter one. size = Size(0); } return DebugTypeInfo(DC, Ty.getPointer(), Info.getStorageType(), size, Info.getBestKnownAlignment()); }
void IRGenFunction::emitFakeExplosion(const TypeInfo &type, Explosion &explosion) { if (!isa<LoadableTypeInfo>(type)) { explosion.add(llvm::UndefValue::get(type.getStorageType()->getPointerTo())); return; } ExplosionSchema schema = cast<LoadableTypeInfo>(type).getSchema(); for (auto &element : schema) { llvm::Type *elementType; if (element.isAggregate()) { elementType = element.getAggregateType()->getPointerTo(); } else { elementType = element.getScalarType(); } explosion.add(llvm::UndefValue::get(elementType)); } }