mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-21 03:32:21 +00:00
Convert to work with new AliasAnalysis interface by conservatively assuming all pointers are arbitrarily large accesses
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5636 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
f98d8d8611
commit
2d0a4a4eb8
@ -13,6 +13,8 @@
|
|||||||
#include "llvm/Assembly/Writer.h"
|
#include "llvm/Assembly/Writer.h"
|
||||||
#include "llvm/Support/InstIterator.h"
|
#include "llvm/Support/InstIterator.h"
|
||||||
|
|
||||||
|
// FIXME: This should keep sizes associated with pointers!
|
||||||
|
|
||||||
/// mergeSetIn - Merge the specified alias set into this alias set...
|
/// mergeSetIn - Merge the specified alias set into this alias set...
|
||||||
///
|
///
|
||||||
void AliasSet::mergeSetIn(AliasSet &AS) {
|
void AliasSet::mergeSetIn(AliasSet &AS) {
|
||||||
@ -59,7 +61,7 @@ void AliasSet::addPointer(AliasSetTracker &AST, HashNodePair &Entry){
|
|||||||
|
|
||||||
if (isMustAlias()) // Check to see if we have to downgrade to _may_ alias
|
if (isMustAlias()) // Check to see if we have to downgrade to _may_ alias
|
||||||
if (Value *V = getSomePointer())
|
if (Value *V = getSomePointer())
|
||||||
if (AA.alias(V, Entry.first) == AliasAnalysis::MayAlias)
|
if (AA.alias(V, ~0, Entry.first, ~0) == AliasAnalysis::MayAlias)
|
||||||
AliasTy = MayAlias;
|
AliasTy = MayAlias;
|
||||||
|
|
||||||
Entry.second.setAliasSet(this);
|
Entry.second.setAliasSet(this);
|
||||||
@ -89,13 +91,13 @@ bool AliasSet::aliasesPointer(const Value *Ptr, AliasAnalysis &AA) const {
|
|||||||
// SOME value in the set...
|
// SOME value in the set...
|
||||||
Value *SomePtr = getSomePointer();
|
Value *SomePtr = getSomePointer();
|
||||||
assert(SomePtr && "Empty must-alias set??");
|
assert(SomePtr && "Empty must-alias set??");
|
||||||
return AA.alias(SomePtr, Ptr);
|
return AA.alias(SomePtr, ~0, Ptr, ~0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If this is a may-alias set, we have to check all of the pointers in the set
|
// If this is a may-alias set, we have to check all of the pointers in the set
|
||||||
// to be sure it doesn't alias the set...
|
// to be sure it doesn't alias the set...
|
||||||
for (iterator I = begin(), E = end(); I != E; ++I)
|
for (iterator I = begin(), E = end(); I != E; ++I)
|
||||||
if (AA.alias(Ptr, *I))
|
if (AA.alias(Ptr, ~0, *I, ~0))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
// Check the call sites list and invoke list...
|
// Check the call sites list and invoke list...
|
||||||
@ -119,7 +121,7 @@ bool AliasSet::aliasesCallSite(CallSite CS, AliasAnalysis &AA) const {
|
|||||||
AliasSet *AliasSetTracker::findAliasSetForPointer(const Value *Ptr) {
|
AliasSet *AliasSetTracker::findAliasSetForPointer(const Value *Ptr) {
|
||||||
AliasSet *FoundSet = 0;
|
AliasSet *FoundSet = 0;
|
||||||
for (iterator I = begin(), E = end(); I != E; ++I)
|
for (iterator I = begin(), E = end(); I != E; ++I)
|
||||||
if (I->aliasesPointer(Ptr, AA)) {
|
if (!I->Forward && I->aliasesPointer(Ptr, AA)) {
|
||||||
if (FoundSet == 0) { // If this is the first alias set ptr can go into...
|
if (FoundSet == 0) { // If this is the first alias set ptr can go into...
|
||||||
FoundSet = I; // Remember it.
|
FoundSet = I; // Remember it.
|
||||||
} else { // Otherwise, we must merge the sets...
|
} else { // Otherwise, we must merge the sets...
|
||||||
@ -133,10 +135,10 @@ AliasSet *AliasSetTracker::findAliasSetForPointer(const Value *Ptr) {
|
|||||||
AliasSet *AliasSetTracker::findAliasSetForCallSite(CallSite CS) {
|
AliasSet *AliasSetTracker::findAliasSetForCallSite(CallSite CS) {
|
||||||
AliasSet *FoundSet = 0;
|
AliasSet *FoundSet = 0;
|
||||||
for (iterator I = begin(), E = end(); I != E; ++I)
|
for (iterator I = begin(), E = end(); I != E; ++I)
|
||||||
if (I->aliasesCallSite(CS, AA)) {
|
if (!I->Forward && I->aliasesCallSite(CS, AA)) {
|
||||||
if (FoundSet == 0) { // If this is the first alias set ptr can go into...
|
if (FoundSet == 0) { // If this is the first alias set ptr can go into...
|
||||||
FoundSet = I; // Remember it.
|
FoundSet = I; // Remember it.
|
||||||
} else { // Otherwise, we must merge the sets...
|
} else if (!I->Forward) { // Otherwise, we must merge the sets...
|
||||||
FoundSet->mergeSetIn(*I); // Merge in contents...
|
FoundSet->mergeSetIn(*I); // Merge in contents...
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -123,17 +123,17 @@ void LoopBodyInfo::incorporate(BasicBlock &BB) {
|
|||||||
LoopBodyInfo::PointerClass LoopBodyInfo::calculatePointerInfo(Value *V,
|
LoopBodyInfo::PointerClass LoopBodyInfo::calculatePointerInfo(Value *V,
|
||||||
AliasAnalysis &AA) const {
|
AliasAnalysis &AA) const {
|
||||||
for (unsigned i = 0, e = Calls.size(); i != e; ++i)
|
for (unsigned i = 0, e = Calls.size(); i != e; ++i)
|
||||||
if (AA.canCallModify(*Calls[i], V))
|
if (AA.getModRefInfo(Calls[i], V, ~0))
|
||||||
return PointerMayStore;
|
return PointerMayStore;
|
||||||
|
|
||||||
for (unsigned i = 0, e = Invokes.size(); i != e; ++i)
|
for (unsigned i = 0, e = Invokes.size(); i != e; ++i)
|
||||||
if (AA.canInvokeModify(*Invokes[i], V))
|
if (AA.getModRefInfo(Invokes[i], V, ~0))
|
||||||
return PointerMayStore;
|
return PointerMayStore;
|
||||||
|
|
||||||
PointerClass Result = PointerNoStore;
|
PointerClass Result = PointerNoStore;
|
||||||
for (std::set<Value*>::const_iterator I = StoredPointers.begin(),
|
for (std::set<Value*>::const_iterator I = StoredPointers.begin(),
|
||||||
E = StoredPointers.end(); I != E; ++I)
|
E = StoredPointers.end(); I != E; ++I)
|
||||||
if (AA.alias(V, *I))
|
if (AA.alias(V, ~0, *I, ~0))
|
||||||
if (V == *I)
|
if (V == *I)
|
||||||
Result = PointerMustStore; // If this is the only alias, return must
|
Result = PointerMustStore; // If this is the only alias, return must
|
||||||
else
|
else
|
||||||
@ -485,7 +485,7 @@ void LICM::findPromotableValuesInLoop(
|
|||||||
bool PointerOk = true;
|
bool PointerOk = true;
|
||||||
for (std::set<Value*>::const_iterator I =CurLBI->LoadedPointers.begin(),
|
for (std::set<Value*>::const_iterator I =CurLBI->LoadedPointers.begin(),
|
||||||
E = CurLBI->LoadedPointers.end(); I != E; ++I)
|
E = CurLBI->LoadedPointers.end(); I != E; ++I)
|
||||||
if (AA->alias(V, *I) == AliasAnalysis::MayAlias) {
|
if (AA->alias(V, ~0, *I, ~0) == AliasAnalysis::MayAlias) {
|
||||||
PointerOk = false;
|
PointerOk = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -503,13 +503,13 @@ void LICM::findPromotableValuesInLoop(
|
|||||||
for (std::set<Value*>::const_iterator
|
for (std::set<Value*>::const_iterator
|
||||||
I = CurLBI->LoadedPointers.begin(),
|
I = CurLBI->LoadedPointers.begin(),
|
||||||
E = CurLBI->LoadedPointers.end(); I != E; ++I)
|
E = CurLBI->LoadedPointers.end(); I != E; ++I)
|
||||||
if (AA->alias(V, *I) == AliasAnalysis::MustAlias)
|
if (AA->alias(V, ~0, *I, ~0) == AliasAnalysis::MustAlias)
|
||||||
ValueToAllocaMap[*I] = AI;
|
ValueToAllocaMap[*I] = AI;
|
||||||
|
|
||||||
for (std::set<Value*>::const_iterator
|
for (std::set<Value*>::const_iterator
|
||||||
I = CurLBI->StoredPointers.begin(),
|
I = CurLBI->StoredPointers.begin(),
|
||||||
E = CurLBI->StoredPointers.end(); I != E; ++I)
|
E = CurLBI->StoredPointers.end(); I != E; ++I)
|
||||||
if (AA->alias(V, *I) == AliasAnalysis::MustAlias)
|
if (AA->alias(V, ~0, *I, ~0) == AliasAnalysis::MustAlias)
|
||||||
ValueToAllocaMap[*I] = AI;
|
ValueToAllocaMap[*I] = AI;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user