clang: lib/CodeGen/CGAtomic.cpp File Reference (original) (raw)

#include "[CGCall.h](CGCall%5F8h%5Fsource.html)"
#include "[CGRecordLayout.h](CGRecordLayout%5F8h%5Fsource.html)"
#include "[CodeGenFunction.h](CodeGenFunction%5F8h%5Fsource.html)"
#include "[CodeGenModule.h](CodeGenModule%5F8h%5Fsource.html)"
#include "[TargetInfo.h](lib%5F2CodeGen%5F2TargetInfo%5F8h%5Fsource.html)"
#include "[clang/AST/ASTContext.h](ASTContext%5F8h%5Fsource.html)"
#include "[clang/CodeGen/CGFunctionInfo.h](CGFunctionInfo%5F8h%5Fsource.html)"
#include "[clang/Frontend/FrontendDiagnostic.h](FrontendDiagnostic%5F8h%5Fsource.html)"
#include "llvm/ADT/DenseMap.h"
#include "llvm/IR/DataLayout.h"
#include "llvm/IR/Intrinsics.h"

Go to the source code of this file.

Functions
static RValue emitAtomicLibcall (CodeGenFunction &CGF, StringRef fnName, QualType resultType, CallArgList &args)
static bool isFullSizeType (CodeGenModule &CGM, llvm::Type *type, uint64_t expectedSize)
Does a store of the given IR type modify the full expected width?
static void emitAtomicCmpXchg (CodeGenFunction &CGF, AtomicExpr *E, bool IsWeak, Address Dest, Address Ptr, Address Val1, Address Val2, uint64_t Size, llvm::AtomicOrdering SuccessOrder, llvm::AtomicOrdering FailureOrder, llvm::SyncScope::ID Scope)
static void emitAtomicCmpXchgFailureSet (CodeGenFunction &CGF, AtomicExpr *E, bool IsWeak, Address Dest, Address Ptr, Address Val1, Address Val2, llvm::Value *FailureOrderVal, uint64_t Size, llvm::AtomicOrdering SuccessOrder, llvm::SyncScope::ID Scope)
Given an ordering required on success, emit all possible cmpxchg instructions to cope with the provided (but possibly only dynamically known) FailureOrder.
static llvm::Value * EmitPostAtomicMinMax (CGBuilderTy &Builder, AtomicExpr::AtomicOp Op, bool IsSigned, llvm::Value *OldVal, llvm::Value *RHS)
Duplicate the atomic min/max operation in conventional IR for the builtin variants that return the new rather than the original value.
static void EmitAtomicOp (CodeGenFunction &CGF, AtomicExpr *E, Address Dest, Address Ptr, Address Val1, Address Val2, llvm::Value *IsWeak, llvm::Value *FailureOrder, uint64_t Size, llvm::AtomicOrdering Order, llvm::SyncScope::ID Scope)
static Address EmitValToTemp (CodeGenFunction &CGF, Expr *E)
static void EmitAtomicOp (CodeGenFunction &CGF, AtomicExpr *Expr, Address Dest, Address Ptr, Address Val1, Address Val2, llvm::Value *IsWeak, llvm::Value *FailureOrder, uint64_t Size, llvm::AtomicOrdering Order, llvm::Value *Scope)
static bool shouldCastToInt (llvm::Type *ValTy, bool CmpXchg)
Return true if.
static void EmitAtomicUpdateValue (CodeGenFunction &CGF, AtomicInfo &Atomics, RValue OldRVal, const llvm::function_ref< RValue(RValue)> &UpdateOp, Address DesiredAddr)
static void EmitAtomicUpdateValue (CodeGenFunction &CGF, AtomicInfo &Atomics, RValue UpdateRVal, Address DesiredAddr)

emitAtomicCmpXchg()

static void emitAtomicCmpXchg ( CodeGenFunction & CGF, AtomicExpr * E, bool IsWeak, Address Dest, Address Ptr, Address Val1, Address Val2, uint64_t Size, llvm::AtomicOrdering SuccessOrder, llvm::AtomicOrdering FailureOrder, llvm::SyncScope::ID Scope ) static

Definition at line 376 of file CGAtomic.cpp.

References clang::CodeGen::CodeGenFunction::Builder, clang::CodeGen::CGBuilderTy::CreateAtomicCmpXchg(), clang::CodeGen::CodeGenFunction::createBasicBlock(), clang::CodeGen::CGBuilderTy::CreateLoad(), clang::CodeGen::CGBuilderTy::CreateStore(), clang::CodeGen::CodeGenFunction::CurFn, E, clang::CodeGen::CodeGenFunction::EmitStoreOfScalar(), clang::CodeGen::CodeGenFunction::getTargetHooks(), clang::Expr::getType(), clang::CodeGen::CodeGenFunction::MakeAddrLValue(), and clang::CodeGen::TargetCodeGenInfo::setTargetAtomicMetadata().

Referenced by emitAtomicCmpXchgFailureSet().

emitAtomicCmpXchgFailureSet()

static void emitAtomicCmpXchgFailureSet ( CodeGenFunction & CGF, AtomicExpr * E, bool IsWeak, Address Dest, Address Ptr, Address Val1, Address Val2, llvm::Value * FailureOrderVal, uint64_t Size, llvm::AtomicOrdering SuccessOrder, llvm::SyncScope::ID Scope ) static

emitAtomicLibcall()

EmitAtomicOp() [1/2]

static void EmitAtomicOp ( CodeGenFunction & CGF, AtomicExpr * E, Address Dest, Address Ptr, Address Val1, Address Val2, llvm::Value * IsWeak, llvm::Value * FailureOrder, uint64_t Size, llvm::AtomicOrdering Order, llvm::SyncScope::ID Scope ) static

EmitAtomicOp() [2/2]

static void EmitAtomicOp ( CodeGenFunction & CGF, AtomicExpr * Expr, Address Dest, Address Ptr, Address Val1, Address Val2, llvm::Value * IsWeak, llvm::Value * FailureOrder, uint64_t Size, llvm::AtomicOrdering Order, llvm::Value * Scope ) static

Definition at line 759 of file CGAtomic.cpp.

References clang::CodeGen::CodeGenFunction::Builder, clang::CodeGen::CodeGenFunction::CGM, clang::CodeGen::CodeGenFunction::createBasicBlock(), clang::CodeGen::CodeGenFunction::CurFn, EmitAtomicOp(), clang::getAsString(), clang::CodeGen::CodeGenFunction::getLangOpts(), clang::CodeGen::CodeGenModule::getLangOpts(), clang::CodeGen::CodeGenFunction::getLLVMContext(), clang::CodeGen::CodeGenModule::getLLVMContext(), clang::CodeGen::TargetCodeGenInfo::getLLVMSyncScopeID(), and clang::CodeGen::CodeGenFunction::getTargetHooks().

EmitAtomicUpdateValue() [1/2]

Definition at line 1721 of file CGAtomic.cpp.

References clang::CodeGen::CodeGenFunction::EmitLoadOfLValue(), clang::CodeGen::CodeGenFunction::EmitStoreOfComplex(), clang::CodeGen::CodeGenFunction::EmitStoreThroughLValue(), clang::CodeGen::LValue::getBaseInfo(), clang::CodeGen::LValue::getBitFieldInfo(), clang::CodeGen::RValue::getComplexVal(), clang::CodeGen::LValue::getExtVectorElts(), clang::CodeGen::LValue::getTBAAInfo(), clang::CodeGen::LValue::getType(), clang::CodeGen::LValue::getVectorIdx(), clang::CodeGen::LValue::isBitField(), clang::CodeGen::RValue::isComplex(), clang::CodeGen::LValue::isExtVectorElt(), clang::CodeGen::RValue::isScalar(), clang::CodeGen::LValue::isSimple(), clang::CodeGen::LValue::isVectorElt(), clang::CodeGen::CodeGenFunction::MakeAddrLValue(), clang::CodeGen::LValue::MakeBitfield(), clang::CodeGen::LValue::MakeExtVectorElt(), and clang::CodeGen::LValue::MakeVectorElt().

EmitAtomicUpdateValue() [2/2]

Definition at line 1841 of file CGAtomic.cpp.

References clang::CodeGen::CodeGenFunction::EmitStoreThroughLValue(), clang::CodeGen::LValue::getBaseInfo(), clang::CodeGen::LValue::getBitFieldInfo(), clang::CodeGen::LValue::getExtVectorElts(), clang::CodeGen::LValue::getTBAAInfo(), clang::CodeGen::LValue::getType(), clang::CodeGen::LValue::getVectorIdx(), clang::CodeGen::LValue::isBitField(), clang::CodeGen::LValue::isExtVectorElt(), clang::CodeGen::RValue::isScalar(), clang::CodeGen::LValue::isVectorElt(), clang::CodeGen::LValue::MakeBitfield(), clang::CodeGen::LValue::MakeExtVectorElt(), and clang::CodeGen::LValue::MakeVectorElt().

EmitPostAtomicMinMax()

Duplicate the atomic min/max operation in conventional IR for the builtin variants that return the new rather than the original value.

Definition at line 503 of file CGAtomic.cpp.

Referenced by EmitAtomicOp().

EmitValToTemp()

isFullSizeType()

shouldCastToInt()

Return true if.

Parameters

ValTy is a type that should be casted to integer around the atomic memory operation. If
CmpXchg is true, then the cast of a floating point type is made as that instruction can not have floating point operands. TODO: Allow compare-and-exchange and FP - see comment in AtomicExpandPass.cpp.

Definition at line 1420 of file CGAtomic.cpp.