Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 7, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 44 additions & 30 deletions include/swift/SIL/SILBuilder.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@

namespace swift {

using Atomicity = RefCountingInst::Atomicity;

class SILDebugScope;

class SILBuilder {
Expand Down Expand Up @@ -658,26 +660,30 @@ class SILBuilder {
targetType));
}

RetainValueInst *createRetainValue(SILLocation Loc, SILValue operand) {
return insert(new (F.getModule())
RetainValueInst(getSILDebugLocation(Loc), operand));
RetainValueInst *createRetainValue(SILLocation Loc, SILValue operand,
Atomicity atomicity) {
return insert(new (F.getModule()) RetainValueInst(getSILDebugLocation(Loc),
operand, atomicity));
}

ReleaseValueInst *createReleaseValue(SILLocation Loc, SILValue operand) {
return insert(new (F.getModule())
ReleaseValueInst(getSILDebugLocation(Loc), operand));
ReleaseValueInst *createReleaseValue(SILLocation Loc, SILValue operand,
Atomicity atomicity) {
return insert(new (F.getModule()) ReleaseValueInst(getSILDebugLocation(Loc),
operand, atomicity));
}

AutoreleaseValueInst *createAutoreleaseValue(SILLocation Loc,
SILValue operand) {
SILValue operand,
Atomicity atomicity) {
return insert(new (F.getModule()) AutoreleaseValueInst(
getSILDebugLocation(Loc), operand));
getSILDebugLocation(Loc), operand, atomicity));
}

SetDeallocatingInst *createSetDeallocating(SILLocation Loc,
SILValue operand) {
SILValue operand,
Atomicity atomicity) {
return insert(new (F.getModule()) SetDeallocatingInst(
getSILDebugLocation(Loc), operand));
getSILDebugLocation(Loc), operand, atomicity));
}

StructInst *createStruct(SILLocation Loc, SILType Ty,
Expand Down Expand Up @@ -1018,35 +1024,43 @@ class SILBuilder {
return insert(new (F.getModule())
CopyBlockInst(getSILDebugLocation(Loc), Operand));
}
StrongRetainInst *createStrongRetain(SILLocation Loc, SILValue Operand) {
return insert(new (F.getModule())
StrongRetainInst(getSILDebugLocation(Loc), Operand));
StrongRetainInst *createStrongRetain(SILLocation Loc, SILValue Operand,
Atomicity atomicity) {
return insert(new (F.getModule()) StrongRetainInst(getSILDebugLocation(Loc),
Operand, atomicity));
}
StrongReleaseInst *createStrongRelease(SILLocation Loc, SILValue Operand) {
return insert(new (F.getModule())
StrongReleaseInst(getSILDebugLocation(Loc), Operand));
StrongReleaseInst *createStrongRelease(SILLocation Loc, SILValue Operand,
Atomicity atomicity) {
return insert(new (F.getModule()) StrongReleaseInst(
getSILDebugLocation(Loc), Operand, atomicity));
}
StrongPinInst *createStrongPin(SILLocation Loc, SILValue Operand) {
return insert(new (F.getModule())
StrongPinInst(getSILDebugLocation(Loc), Operand));
StrongPinInst *createStrongPin(SILLocation Loc, SILValue Operand,
Atomicity atomicity) {
return insert(new (F.getModule()) StrongPinInst(getSILDebugLocation(Loc),
Operand, atomicity));
}
StrongUnpinInst *createStrongUnpin(SILLocation Loc, SILValue Operand) {
return insert(new (F.getModule())
StrongUnpinInst(getSILDebugLocation(Loc), Operand));
StrongUnpinInst *createStrongUnpin(SILLocation Loc, SILValue Operand,
Atomicity atomicity) {
return insert(new (F.getModule()) StrongUnpinInst(getSILDebugLocation(Loc),
Operand, atomicity));
}
StrongRetainUnownedInst *createStrongRetainUnowned(SILLocation Loc,
SILValue Operand) {
SILValue Operand,
Atomicity atomicity) {
return insert(new (F.getModule()) StrongRetainUnownedInst(
getSILDebugLocation(Loc), Operand));
getSILDebugLocation(Loc), Operand, atomicity));
}
UnownedRetainInst *createUnownedRetain(SILLocation Loc, SILValue Operand) {
return insert(new (F.getModule())
UnownedRetainInst(getSILDebugLocation(Loc), Operand));
UnownedRetainInst *createUnownedRetain(SILLocation Loc, SILValue Operand,
Atomicity atomicity) {
return insert(new (F.getModule()) UnownedRetainInst(
getSILDebugLocation(Loc), Operand, atomicity));
}
UnownedReleaseInst *createUnownedRelease(SILLocation Loc, SILValue Operand) {
return insert(new (F.getModule())
UnownedReleaseInst(getSILDebugLocation(Loc), Operand));
UnownedReleaseInst *createUnownedRelease(SILLocation Loc, SILValue Operand,
Atomicity atomicity) {
return insert(new (F.getModule()) UnownedReleaseInst(
getSILDebugLocation(Loc), Operand, atomicity));
}

FixLifetimeInst *createFixLifetime(SILLocation Loc, SILValue Operand) {
return insert(new (F.getModule())
FixLifetimeInst(getSILDebugLocation(Loc), Operand));
Expand Down
33 changes: 22 additions & 11 deletions include/swift/SIL/SILCloner.h
Original file line number Diff line number Diff line change
Expand Up @@ -1029,7 +1029,8 @@ SILCloner<ImplClass>::visitRetainValueInst(RetainValueInst *Inst) {
getBuilder().setCurrentDebugScope(getOpScope(Inst->getDebugScope()));
doPostProcess(Inst,
getBuilder().createRetainValue(getOpLocation(Inst->getLoc()),
getOpValue(Inst->getOperand())));
getOpValue(Inst->getOperand()),
Inst->getAtomicity()));
}

template<typename ImplClass>
Expand All @@ -1038,7 +1039,8 @@ SILCloner<ImplClass>::visitReleaseValueInst(ReleaseValueInst *Inst) {
getBuilder().setCurrentDebugScope(getOpScope(Inst->getDebugScope()));
doPostProcess(Inst,
getBuilder().createReleaseValue(getOpLocation(Inst->getLoc()),
getOpValue(Inst->getOperand())));
getOpValue(Inst->getOperand()),
Inst->getAtomicity()));
}

template<typename ImplClass>
Expand All @@ -1047,7 +1049,8 @@ SILCloner<ImplClass>::visitAutoreleaseValueInst(AutoreleaseValueInst *Inst) {
getBuilder().setCurrentDebugScope(getOpScope(Inst->getDebugScope()));
doPostProcess(Inst,
getBuilder().createAutoreleaseValue(getOpLocation(Inst->getLoc()),
getOpValue(Inst->getOperand())));
getOpValue(Inst->getOperand()),
Inst->getAtomicity()));
}

template<typename ImplClass>
Expand All @@ -1056,7 +1059,8 @@ SILCloner<ImplClass>::visitSetDeallocatingInst(SetDeallocatingInst *Inst) {
getBuilder().setCurrentDebugScope(getOpScope(Inst->getDebugScope()));
doPostProcess(Inst,
getBuilder().createSetDeallocating(getOpLocation(Inst->getLoc()),
getOpValue(Inst->getOperand())));
getOpValue(Inst->getOperand()),
Inst->getAtomicity()));
}

template<typename ImplClass>
Expand Down Expand Up @@ -1423,7 +1427,8 @@ SILCloner<ImplClass>::visitStrongRetainInst(StrongRetainInst *Inst) {
getBuilder().setCurrentDebugScope(getOpScope(Inst->getDebugScope()));
doPostProcess(Inst,
getBuilder().createStrongRetain(getOpLocation(Inst->getLoc()),
getOpValue(Inst->getOperand())));
getOpValue(Inst->getOperand()),
Inst->getAtomicity()));
}

template<typename ImplClass>
Expand Down Expand Up @@ -1451,7 +1456,8 @@ SILCloner<ImplClass>::visitStrongPinInst(StrongPinInst *Inst) {
getBuilder().setCurrentDebugScope(getOpScope(Inst->getDebugScope()));
doPostProcess(Inst,
getBuilder().createStrongPin(getOpLocation(Inst->getLoc()),
getOpValue(Inst->getOperand())));
getOpValue(Inst->getOperand()),
Inst->getAtomicity()));
}

template<typename ImplClass>
Expand All @@ -1460,7 +1466,8 @@ SILCloner<ImplClass>::visitStrongUnpinInst(StrongUnpinInst *Inst) {
getBuilder().setCurrentDebugScope(getOpScope(Inst->getDebugScope()));
doPostProcess(Inst,
getBuilder().createStrongUnpin(getOpLocation(Inst->getLoc()),
getOpValue(Inst->getOperand())));
getOpValue(Inst->getOperand()),
Inst->getAtomicity()));
}

template<typename ImplClass>
Expand All @@ -1469,7 +1476,8 @@ SILCloner<ImplClass>::visitStrongReleaseInst(StrongReleaseInst *Inst) {
getBuilder().setCurrentDebugScope(getOpScope(Inst->getDebugScope()));
doPostProcess(Inst,
getBuilder().createStrongRelease(getOpLocation(Inst->getLoc()),
getOpValue(Inst->getOperand())));
getOpValue(Inst->getOperand()),
Inst->getAtomicity()));
}

template<typename ImplClass>
Expand All @@ -1479,7 +1487,8 @@ visitStrongRetainUnownedInst(StrongRetainUnownedInst *Inst) {
getBuilder().setCurrentDebugScope(getOpScope(Inst->getDebugScope()));
doPostProcess(Inst,
getBuilder().createStrongRetainUnowned(getOpLocation(Inst->getLoc()),
getOpValue(Inst->getOperand())));
getOpValue(Inst->getOperand()),
Inst->getAtomicity()));
}

template<typename ImplClass>
Expand All @@ -1488,7 +1497,8 @@ SILCloner<ImplClass>::visitUnownedRetainInst(UnownedRetainInst *Inst) {
getBuilder().setCurrentDebugScope(getOpScope(Inst->getDebugScope()));
doPostProcess(Inst,
getBuilder().createUnownedRetain(getOpLocation(Inst->getLoc()),
getOpValue(Inst->getOperand())));
getOpValue(Inst->getOperand()),
Inst->getAtomicity()));
}

template<typename ImplClass>
Expand All @@ -1497,7 +1507,8 @@ SILCloner<ImplClass>::visitUnownedReleaseInst(UnownedReleaseInst *Inst) {
getBuilder().setCurrentDebugScope(getOpScope(Inst->getDebugScope()));
doPostProcess(Inst,
getBuilder().createUnownedRelease(getOpLocation(Inst->getLoc()),
getOpValue(Inst->getOperand())));
getOpValue(Inst->getOperand()),
Inst->getAtomicity()));
}
template<typename ImplClass>
void SILCloner<ImplClass>::visitIsUniqueInst(IsUniqueInst *Inst) {
Expand Down
Loading