forked from OSchip/llvm-project
parent
61b5e3c6a9
commit
144a43a2fd
|
@ -1688,7 +1688,7 @@ EmitAtomicUpdateValue(CodeGenFunction &CGF, AtomicInfo &Atomics, RValue OldRVal,
|
||||||
UpRVal = OldRVal;
|
UpRVal = OldRVal;
|
||||||
DesiredLVal = CGF.MakeAddrLValue(DesiredAddr, AtomicLVal.getType());
|
DesiredLVal = CGF.MakeAddrLValue(DesiredAddr, AtomicLVal.getType());
|
||||||
} else {
|
} else {
|
||||||
// Build new lvalue for temp address
|
// Build new lvalue for temp address.
|
||||||
Address Ptr = Atomics.materializeRValue(OldRVal);
|
Address Ptr = Atomics.materializeRValue(OldRVal);
|
||||||
LValue UpdateLVal;
|
LValue UpdateLVal;
|
||||||
if (AtomicLVal.isBitField()) {
|
if (AtomicLVal.isBitField()) {
|
||||||
|
@ -1721,7 +1721,7 @@ EmitAtomicUpdateValue(CodeGenFunction &CGF, AtomicInfo &Atomics, RValue OldRVal,
|
||||||
}
|
}
|
||||||
UpRVal = CGF.EmitLoadOfLValue(UpdateLVal, SourceLocation());
|
UpRVal = CGF.EmitLoadOfLValue(UpdateLVal, SourceLocation());
|
||||||
}
|
}
|
||||||
// Store new value in the corresponding memory area
|
// Store new value in the corresponding memory area.
|
||||||
RValue NewRVal = UpdateOp(UpRVal);
|
RValue NewRVal = UpdateOp(UpRVal);
|
||||||
if (NewRVal.isScalar()) {
|
if (NewRVal.isScalar()) {
|
||||||
CGF.EmitStoreThroughLValue(NewRVal, DesiredLVal);
|
CGF.EmitStoreThroughLValue(NewRVal, DesiredLVal);
|
||||||
|
@ -1786,7 +1786,7 @@ void AtomicInfo::EmitAtomicUpdateOp(
|
||||||
SourceLocation(), /*AsValue=*/false);
|
SourceLocation(), /*AsValue=*/false);
|
||||||
EmitAtomicUpdateValue(CGF, *this, OldRVal, UpdateOp, NewAtomicAddr);
|
EmitAtomicUpdateValue(CGF, *this, OldRVal, UpdateOp, NewAtomicAddr);
|
||||||
auto *DesiredVal = CGF.Builder.CreateLoad(NewAtomicIntAddr);
|
auto *DesiredVal = CGF.Builder.CreateLoad(NewAtomicIntAddr);
|
||||||
// Try to write new value using cmpxchg operation
|
// Try to write new value using cmpxchg operation.
|
||||||
auto Res = EmitAtomicCompareExchangeOp(PHI, DesiredVal, AO, Failure);
|
auto Res = EmitAtomicCompareExchangeOp(PHI, DesiredVal, AO, Failure);
|
||||||
PHI->addIncoming(Res.first, CGF.Builder.GetInsertBlock());
|
PHI->addIncoming(Res.first, CGF.Builder.GetInsertBlock());
|
||||||
CGF.Builder.CreateCondBr(Res.second, ExitBB, ContBB);
|
CGF.Builder.CreateCondBr(Res.second, ExitBB, ContBB);
|
||||||
|
@ -1797,7 +1797,7 @@ static void EmitAtomicUpdateValue(CodeGenFunction &CGF, AtomicInfo &Atomics,
|
||||||
RValue UpdateRVal, Address DesiredAddr) {
|
RValue UpdateRVal, Address DesiredAddr) {
|
||||||
LValue AtomicLVal = Atomics.getAtomicLValue();
|
LValue AtomicLVal = Atomics.getAtomicLValue();
|
||||||
LValue DesiredLVal;
|
LValue DesiredLVal;
|
||||||
// Build new lvalue for temp address
|
// Build new lvalue for temp address.
|
||||||
if (AtomicLVal.isBitField()) {
|
if (AtomicLVal.isBitField()) {
|
||||||
DesiredLVal =
|
DesiredLVal =
|
||||||
LValue::MakeBitfield(DesiredAddr, AtomicLVal.getBitFieldInfo(),
|
LValue::MakeBitfield(DesiredAddr, AtomicLVal.getBitFieldInfo(),
|
||||||
|
@ -1814,7 +1814,7 @@ static void EmitAtomicUpdateValue(CodeGenFunction &CGF, AtomicInfo &Atomics,
|
||||||
DesiredAddr, AtomicLVal.getExtVectorElts(), AtomicLVal.getType(),
|
DesiredAddr, AtomicLVal.getExtVectorElts(), AtomicLVal.getType(),
|
||||||
AtomicLVal.getBaseInfo(), AtomicLVal.getTBAAInfo());
|
AtomicLVal.getBaseInfo(), AtomicLVal.getTBAAInfo());
|
||||||
}
|
}
|
||||||
// Store new value in the corresponding memory area
|
// Store new value in the corresponding memory area.
|
||||||
assert(UpdateRVal.isScalar());
|
assert(UpdateRVal.isScalar());
|
||||||
CGF.EmitStoreThroughLValue(UpdateRVal, DesiredLVal);
|
CGF.EmitStoreThroughLValue(UpdateRVal, DesiredLVal);
|
||||||
}
|
}
|
||||||
|
@ -1866,7 +1866,7 @@ void AtomicInfo::EmitAtomicUpdateOp(llvm::AtomicOrdering AO, RValue UpdateRVal,
|
||||||
}
|
}
|
||||||
EmitAtomicUpdateValue(CGF, *this, UpdateRVal, NewAtomicAddr);
|
EmitAtomicUpdateValue(CGF, *this, UpdateRVal, NewAtomicAddr);
|
||||||
auto *DesiredVal = CGF.Builder.CreateLoad(NewAtomicIntAddr);
|
auto *DesiredVal = CGF.Builder.CreateLoad(NewAtomicIntAddr);
|
||||||
// Try to write new value using cmpxchg operation
|
// Try to write new value using cmpxchg operation.
|
||||||
auto Res = EmitAtomicCompareExchangeOp(PHI, DesiredVal, AO, Failure);
|
auto Res = EmitAtomicCompareExchangeOp(PHI, DesiredVal, AO, Failure);
|
||||||
PHI->addIncoming(Res.first, CGF.Builder.GetInsertBlock());
|
PHI->addIncoming(Res.first, CGF.Builder.GetInsertBlock());
|
||||||
CGF.Builder.CreateCondBr(Res.second, ExitBB, ContBB);
|
CGF.Builder.CreateCondBr(Res.second, ExitBB, ContBB);
|
||||||
|
|
Loading…
Reference in New Issue