Merge pull request #2067 from swiftix/SR-249

Add [nonatomic] attribute to all SIL reference counting instructions.

Support this attribute at SIL level,  IRGen and LLVM-based ARC passes.
This commit is contained in:
swiftix
2016-04-06 23:56:43 -07:00
53 changed files with 1118 additions and 478 deletions

View File

@@ -2913,7 +2913,8 @@ void IRGenSILFunction::visitRetainValueInst(swift::RetainValueInst *i) {
Explosion in = getLoweredExplosion(i->getOperand());
Explosion out;
cast<LoadableTypeInfo>(getTypeInfo(i->getOperand()->getType()))
.copy(*this, in, out);
.copy(*this, in, out, i->isAtomic() ? irgen::Atomicity::Atomic
: irgen::Atomicity::NonAtomic);
out.claimAll();
}
@@ -2964,7 +2965,8 @@ void IRGenSILFunction::visitSetDeallocatingInst(SetDeallocatingInst *i) {
void IRGenSILFunction::visitReleaseValueInst(swift::ReleaseValueInst *i) {
Explosion in = getLoweredExplosion(i->getOperand());
cast<LoadableTypeInfo>(getTypeInfo(i->getOperand()->getType()))
.consume(*this, in);
.consume(*this, in, i->isAtomic() ? irgen::Atomicity::Atomic
: irgen::Atomicity::NonAtomic);
}
void IRGenSILFunction::visitStructInst(swift::StructInst *i) {
@@ -3229,7 +3231,9 @@ void IRGenSILFunction::visitCopyBlockInst(CopyBlockInst *i) {
void IRGenSILFunction::visitStrongPinInst(swift::StrongPinInst *i) {
Explosion lowered = getLoweredExplosion(i->getOperand());
llvm::Value *object = lowered.claimNext();
llvm::Value *pinHandle = emitNativeTryPin(object);
llvm::Value *pinHandle =
emitNativeTryPin(object, i->isAtomic() ? irgen::Atomicity::Atomic
: irgen::Atomicity::NonAtomic);
Explosion result;
result.add(pinHandle);
@@ -3239,19 +3243,22 @@ void IRGenSILFunction::visitStrongPinInst(swift::StrongPinInst *i) {
void IRGenSILFunction::visitStrongUnpinInst(swift::StrongUnpinInst *i) {
Explosion lowered = getLoweredExplosion(i->getOperand());
llvm::Value *pinHandle = lowered.claimNext();
emitNativeUnpin(pinHandle);
emitNativeUnpin(pinHandle, i->isAtomic() ? irgen::Atomicity::Atomic
: irgen::Atomicity::NonAtomic);
}
void IRGenSILFunction::visitStrongRetainInst(swift::StrongRetainInst *i) {
Explosion lowered = getLoweredExplosion(i->getOperand());
auto &ti = cast<ReferenceTypeInfo>(getTypeInfo(i->getOperand()->getType()));
ti.strongRetain(*this, lowered);
ti.strongRetain(*this, lowered, i->isAtomic() ? irgen::Atomicity::Atomic
: irgen::Atomicity::NonAtomic);
}
void IRGenSILFunction::visitStrongReleaseInst(swift::StrongReleaseInst *i) {
Explosion lowered = getLoweredExplosion(i->getOperand());
auto &ti = cast<ReferenceTypeInfo>(getTypeInfo(i->getOperand()->getType()));
ti.strongRelease(*this, lowered);
ti.strongRelease(*this, lowered, i->isAtomic() ? irgen::Atomicity::Atomic
: irgen::Atomicity::NonAtomic);
}
/// Given a SILType which is a ReferenceStorageType, return the type