mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2026-04-20 00:20:11 +00:00
Misc optimizer+codegen work for 'cmpxchg' and 'atomicrmw'. They appear to be
working on x86 (at least for trivial testcases); other architectures will need more work so that they actually emit the appropriate instructions for orderings stricter than 'monotonic'. (As far as I can tell, the ARM, PPC, Mips, and Alpha backends need such changes.) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@136457 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -317,22 +317,22 @@ bool FunctionComparator::isEquivalentOperation(const Instruction *I1,
|
||||
if (const InvokeInst *CI = dyn_cast<InvokeInst>(I1))
|
||||
return CI->getCallingConv() == cast<InvokeInst>(I2)->getCallingConv() &&
|
||||
CI->getAttributes() == cast<InvokeInst>(I2)->getAttributes();
|
||||
if (const InsertValueInst *IVI = dyn_cast<InsertValueInst>(I1)) {
|
||||
if (IVI->getNumIndices() != cast<InsertValueInst>(I2)->getNumIndices())
|
||||
return false;
|
||||
for (unsigned i = 0, e = IVI->getNumIndices(); i != e; ++i)
|
||||
if (IVI->idx_begin()[i] != cast<InsertValueInst>(I2)->idx_begin()[i])
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
if (const ExtractValueInst *EVI = dyn_cast<ExtractValueInst>(I1)) {
|
||||
if (EVI->getNumIndices() != cast<ExtractValueInst>(I2)->getNumIndices())
|
||||
return false;
|
||||
for (unsigned i = 0, e = EVI->getNumIndices(); i != e; ++i)
|
||||
if (EVI->idx_begin()[i] != cast<ExtractValueInst>(I2)->idx_begin()[i])
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
if (const InsertValueInst *IVI = dyn_cast<InsertValueInst>(I1))
|
||||
return IVI->getIndices() == cast<InsertValueInst>(I2)->getIndices();
|
||||
if (const ExtractValueInst *EVI = dyn_cast<ExtractValueInst>(I1))
|
||||
return EVI->getIndices() == cast<ExtractValueInst>(I2)->getIndices();
|
||||
if (const FenceInst *FI = dyn_cast<FenceInst>(I1))
|
||||
return FI->getOrdering() == cast<FenceInst>(I2)->getOrdering() &&
|
||||
FI->getSynchScope() == cast<FenceInst>(I2)->getSynchScope();
|
||||
if (const AtomicCmpXchgInst *CXI = dyn_cast<AtomicCmpXchgInst>(I1))
|
||||
return CXI->isVolatile() == cast<AtomicCmpXchgInst>(I2)->isVolatile() &&
|
||||
CXI->getOrdering() == cast<AtomicCmpXchgInst>(I2)->getOrdering() &&
|
||||
CXI->getSynchScope() == cast<AtomicCmpXchgInst>(I2)->getSynchScope();
|
||||
if (const AtomicRMWInst *RMWI = dyn_cast<AtomicRMWInst>(I1))
|
||||
return RMWI->getOperation() == cast<AtomicRMWInst>(I2)->getOperation() &&
|
||||
RMWI->isVolatile() == cast<AtomicRMWInst>(I2)->isVolatile() &&
|
||||
RMWI->getOrdering() == cast<AtomicRMWInst>(I2)->getOrdering() &&
|
||||
RMWI->getSynchScope() == cast<AtomicRMWInst>(I2)->getSynchScope();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user