Lines Matching refs:CGF
29 CodeGenFunction &CGF; member in __anondcc4705e0111::AtomicInfo
40 AtomicInfo(CodeGenFunction &CGF, LValue &lvalue) : CGF(CGF) { in AtomicInfo() argument
45 EvaluationKind = CGF.getEvaluationKind(ValueTy); in AtomicInfo()
47 ASTContext &C = CGF.getContext(); in AtomicInfo()
90 CharUnits size = CGF.getContext().toCharUnitsFromBits(AtomicSizeInBits); in getAtomicSizeValue()
91 return CGF.CGM.getSize(size); in getAtomicSizeValue()
110 addr = CGF.Builder.CreateStructGEP(addr, 0); in projectValue()
113 CGF.getContext(), lvalue.getTBAAInfo()); in projectValue()
124 static RValue emitAtomicLibcall(CodeGenFunction &CGF, in emitAtomicLibcall() argument
129 CGF.CGM.getTypes().arrangeFreeFunctionCall(resultType, args, in emitAtomicLibcall()
131 llvm::FunctionType *fnTy = CGF.CGM.getTypes().GetFunctionType(fnInfo); in emitAtomicLibcall()
132 llvm::Constant *fn = CGF.CGM.CreateRuntimeFunction(fnTy, fnName); in emitAtomicLibcall()
133 return CGF.EmitCall(fnInfo, fn, ReturnValueSlot(), args); in emitAtomicLibcall()
154 return !isFullSizeType(CGF.CGM, type, AtomicSizeInBits); in requiresMemSetZero()
156 return !isFullSizeType(CGF.CGM, type->getStructElementType(0), in requiresMemSetZero()
171 CGF.Builder.CreateMemSet(addr, llvm::ConstantInt::get(CGF.Int8Ty, 0), in emitMemSetZeroIfNecessary()
177 static void emitAtomicCmpXchg(CodeGenFunction &CGF, AtomicExpr *E, bool IsWeak, in emitAtomicCmpXchg() argument
184 llvm::LoadInst *Expected = CGF.Builder.CreateLoad(Val1); in emitAtomicCmpXchg()
186 llvm::LoadInst *Desired = CGF.Builder.CreateLoad(Val2); in emitAtomicCmpXchg()
189 llvm::AtomicCmpXchgInst *Pair = CGF.Builder.CreateAtomicCmpXchg( in emitAtomicCmpXchg()
196 llvm::Value *Old = CGF.Builder.CreateExtractValue(Pair, 0); in emitAtomicCmpXchg()
197 llvm::Value *Cmp = CGF.Builder.CreateExtractValue(Pair, 1); in emitAtomicCmpXchg()
202 CGF.createBasicBlock("cmpxchg.store_expected", CGF.CurFn); in emitAtomicCmpXchg()
207 CGF.createBasicBlock("cmpxchg.continue", CGF.CurFn); in emitAtomicCmpXchg()
211 CGF.Builder.CreateCondBr(Cmp, ContinueBB, StoreExpectedBB); in emitAtomicCmpXchg()
213 CGF.Builder.SetInsertPoint(StoreExpectedBB); in emitAtomicCmpXchg()
215 llvm::StoreInst *StoreExpected = CGF.Builder.CreateStore(Old, Val1); in emitAtomicCmpXchg()
218 CGF.Builder.CreateBr(ContinueBB); in emitAtomicCmpXchg()
220 CGF.Builder.SetInsertPoint(ContinueBB); in emitAtomicCmpXchg()
222 CGF.EmitStoreOfScalar(Cmp, CGF.MakeAddrLValue(Dest, E->getType())); in emitAtomicCmpXchg()
229 static void emitAtomicCmpXchgFailureSet(CodeGenFunction &CGF, AtomicExpr *E, in emitAtomicCmpXchgFailureSet() argument
255 emitAtomicCmpXchg(CGF, E, IsWeak, Dest, Ptr, Val1, Val2, Size, Align, in emitAtomicCmpXchgFailureSet()
263 MonotonicBB = CGF.createBasicBlock("monotonic_fail", CGF.CurFn); in emitAtomicCmpXchgFailureSet()
265 AcquireBB = CGF.createBasicBlock("acquire_fail", CGF.CurFn); in emitAtomicCmpXchgFailureSet()
267 SeqCstBB = CGF.createBasicBlock("seqcst_fail", CGF.CurFn); in emitAtomicCmpXchgFailureSet()
269 llvm::BasicBlock *ContBB = CGF.createBasicBlock("atomic.continue", CGF.CurFn); in emitAtomicCmpXchgFailureSet()
271 llvm::SwitchInst *SI = CGF.Builder.CreateSwitch(FailureOrderVal, MonotonicBB); in emitAtomicCmpXchgFailureSet()
278 CGF.Builder.SetInsertPoint(MonotonicBB); in emitAtomicCmpXchgFailureSet()
279 emitAtomicCmpXchg(CGF, E, IsWeak, Dest, Ptr, Val1, Val2, in emitAtomicCmpXchgFailureSet()
281 CGF.Builder.CreateBr(ContBB); in emitAtomicCmpXchgFailureSet()
284 CGF.Builder.SetInsertPoint(AcquireBB); in emitAtomicCmpXchgFailureSet()
285 emitAtomicCmpXchg(CGF, E, IsWeak, Dest, Ptr, Val1, Val2, in emitAtomicCmpXchgFailureSet()
287 CGF.Builder.CreateBr(ContBB); in emitAtomicCmpXchgFailureSet()
288 SI->addCase(CGF.Builder.getInt32(AtomicExpr::AO_ABI_memory_order_consume), in emitAtomicCmpXchgFailureSet()
290 SI->addCase(CGF.Builder.getInt32(AtomicExpr::AO_ABI_memory_order_acquire), in emitAtomicCmpXchgFailureSet()
294 CGF.Builder.SetInsertPoint(SeqCstBB); in emitAtomicCmpXchgFailureSet()
295 emitAtomicCmpXchg(CGF, E, IsWeak, Dest, Ptr, Val1, Val2, in emitAtomicCmpXchgFailureSet()
297 CGF.Builder.CreateBr(ContBB); in emitAtomicCmpXchgFailureSet()
298 SI->addCase(CGF.Builder.getInt32(AtomicExpr::AO_ABI_memory_order_seq_cst), in emitAtomicCmpXchgFailureSet()
302 CGF.Builder.SetInsertPoint(ContBB); in emitAtomicCmpXchgFailureSet()
305 static void EmitAtomicOp(CodeGenFunction &CGF, AtomicExpr *E, llvm::Value *Dest, in EmitAtomicOp() argument
318 emitAtomicCmpXchgFailureSet(CGF, E, false, Dest, Ptr, Val1, Val2, in EmitAtomicOp()
322 emitAtomicCmpXchgFailureSet(CGF, E, true, Dest, Ptr, Val1, Val2, in EmitAtomicOp()
328 emitAtomicCmpXchgFailureSet(CGF, E, IsWeakC->getZExtValue(), Dest, Ptr, in EmitAtomicOp()
333 CGF.createBasicBlock("cmpxchg.strong", CGF.CurFn); in EmitAtomicOp()
334 llvm::BasicBlock *WeakBB = CGF.createBasicBlock("cmxchg.weak", CGF.CurFn); in EmitAtomicOp()
336 CGF.createBasicBlock("cmpxchg.continue", CGF.CurFn); in EmitAtomicOp()
338 llvm::SwitchInst *SI = CGF.Builder.CreateSwitch(IsWeak, WeakBB); in EmitAtomicOp()
339 SI->addCase(CGF.Builder.getInt1(false), StrongBB); in EmitAtomicOp()
341 CGF.Builder.SetInsertPoint(StrongBB); in EmitAtomicOp()
342 emitAtomicCmpXchgFailureSet(CGF, E, false, Dest, Ptr, Val1, Val2, in EmitAtomicOp()
344 CGF.Builder.CreateBr(ContBB); in EmitAtomicOp()
346 CGF.Builder.SetInsertPoint(WeakBB); in EmitAtomicOp()
347 emitAtomicCmpXchgFailureSet(CGF, E, true, Dest, Ptr, Val1, Val2, in EmitAtomicOp()
349 CGF.Builder.CreateBr(ContBB); in EmitAtomicOp()
351 CGF.Builder.SetInsertPoint(ContBB); in EmitAtomicOp()
358 llvm::LoadInst *Load = CGF.Builder.CreateLoad(Ptr); in EmitAtomicOp()
362 llvm::StoreInst *StoreDest = CGF.Builder.CreateStore(Load, Dest); in EmitAtomicOp()
371 llvm::LoadInst *LoadVal1 = CGF.Builder.CreateLoad(Val1); in EmitAtomicOp()
373 llvm::StoreInst *Store = CGF.Builder.CreateStore(LoadVal1, Ptr); in EmitAtomicOp()
434 llvm::LoadInst *LoadVal1 = CGF.Builder.CreateLoad(Val1); in EmitAtomicOp()
437 CGF.Builder.CreateAtomicRMW(Op, Ptr, LoadVal1, Order); in EmitAtomicOp()
444 Result = CGF.Builder.CreateBinOp(PostOp, RMWI, LoadVal1); in EmitAtomicOp()
446 Result = CGF.Builder.CreateNot(Result); in EmitAtomicOp()
447 llvm::StoreInst *StoreDest = CGF.Builder.CreateStore(Result, Dest); in EmitAtomicOp()
454 EmitValToTemp(CodeGenFunction &CGF, Expr *E) { in EmitValToTemp() argument
455 llvm::Value *DeclPtr = CGF.CreateMemTemp(E->getType(), ".atomictmp"); in EmitValToTemp()
456 CGF.EmitAnyExprToMem(E, DeclPtr, E->getType().getQualifiers(), in EmitValToTemp()
462 AddDirectArgument(CodeGenFunction &CGF, CallArgList &Args, in AddDirectArgument() argument
467 unsigned Align = CGF.getContext().getTypeAlignInChars(ValTy).getQuantity(); in AddDirectArgument()
468 Val = CGF.EmitLoadOfScalar(Val, false, Align, ValTy, Loc); in AddDirectArgument()
472 Args.add(RValue::get(CGF.EmitCastToVoidPtr(Val)), in AddDirectArgument()
473 CGF.getContext().VoidPtrTy); in AddDirectArgument()
866 llvm::IntegerType::get(CGF.getLLVMContext(), AtomicSizeInBits); in emitCastToAtomicIntPointer()
867 return CGF.Builder.CreateBitCast(addr, ty->getPointerTo(addrspace)); in emitCastToAtomicIntPointer()
878 addr = CGF.Builder.CreateStructGEP(addr, 0); in convertTempToRValue()
882 return CGF.convertTempToRValue(addr, getValueType(), loc); in convertTempToRValue()
985 CGF.EmitAggregateCopy(dest.getAddress(), in emitCopyIntoMemory()
1004 CGF.EmitStoreOfScalar(rvalue.getScalarVal(), dest, /*init*/ true); in emitCopyIntoMemory()
1006 CGF.EmitStoreOfComplex(rvalue.getComplexVal(), dest, /*init*/ true); in emitCopyIntoMemory()
1020 llvm::Value *temp = CGF.CreateMemTemp(getAtomicType(), "atomic-store-temp"); in materializeRValue()
1021 LValue tempLV = CGF.MakeAddrLValue(temp, getAtomicType(), getAtomicAlignment()); in materializeRValue()