mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-14 11:32:34 +00:00
Add support for free instructions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15197 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
c25b55a5b2
commit
5c88260f70
@ -27,6 +27,7 @@ namespace llvm {
|
|||||||
class AliasAnalysis;
|
class AliasAnalysis;
|
||||||
class LoadInst;
|
class LoadInst;
|
||||||
class StoreInst;
|
class StoreInst;
|
||||||
|
class FreeInst;
|
||||||
class AliasSetTracker;
|
class AliasSetTracker;
|
||||||
class AliasSet;
|
class AliasSet;
|
||||||
|
|
||||||
@ -263,6 +264,7 @@ public:
|
|||||||
///
|
///
|
||||||
bool add(LoadInst *LI);
|
bool add(LoadInst *LI);
|
||||||
bool add(StoreInst *SI);
|
bool add(StoreInst *SI);
|
||||||
|
bool add(FreeInst *FI);
|
||||||
bool add(CallSite CS); // Call/Invoke instructions
|
bool add(CallSite CS); // Call/Invoke instructions
|
||||||
bool add(CallInst *CI) { return add(CallSite(CI)); }
|
bool add(CallInst *CI) { return add(CallSite(CI)); }
|
||||||
bool add(InvokeInst *II) { return add(CallSite(II)); }
|
bool add(InvokeInst *II) { return add(CallSite(II)); }
|
||||||
@ -275,6 +277,7 @@ public:
|
|||||||
/// alias sets were eliminated.
|
/// alias sets were eliminated.
|
||||||
bool remove(LoadInst *LI);
|
bool remove(LoadInst *LI);
|
||||||
bool remove(StoreInst *SI);
|
bool remove(StoreInst *SI);
|
||||||
|
bool remove(FreeInst *FI);
|
||||||
bool remove(CallSite CS);
|
bool remove(CallSite CS);
|
||||||
bool remove(CallInst *CI) { return remove(CallSite(CI)); }
|
bool remove(CallInst *CI) { return remove(CallSite(CI)); }
|
||||||
bool remove(InvokeInst *II) { return remove(CallSite(II)); }
|
bool remove(InvokeInst *II) { return remove(CallSite(II)); }
|
||||||
|
@ -233,6 +233,13 @@ bool AliasSetTracker::add(StoreInst *SI) {
|
|||||||
return NewPtr;
|
return NewPtr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool AliasSetTracker::add(FreeInst *FI) {
|
||||||
|
bool NewPtr;
|
||||||
|
AliasSet &AS = addPointer(FI->getOperand(0), ~0,
|
||||||
|
AliasSet::Mods, NewPtr);
|
||||||
|
return NewPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bool AliasSetTracker::add(CallSite CS) {
|
bool AliasSetTracker::add(CallSite CS) {
|
||||||
bool NewPtr;
|
bool NewPtr;
|
||||||
@ -262,6 +269,8 @@ bool AliasSetTracker::add(Instruction *I) {
|
|||||||
return add(CI);
|
return add(CI);
|
||||||
else if (InvokeInst *II = dyn_cast<InvokeInst>(I))
|
else if (InvokeInst *II = dyn_cast<InvokeInst>(I))
|
||||||
return add(II);
|
return add(II);
|
||||||
|
else if (FreeInst *FI = dyn_cast<FreeInst>(I))
|
||||||
|
return add(FI);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -326,6 +335,13 @@ bool AliasSetTracker::remove(StoreInst *SI) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool AliasSetTracker::remove(FreeInst *FI) {
|
||||||
|
AliasSet *AS = findAliasSetForPointer(FI->getOperand(0), ~0);
|
||||||
|
if (!AS) return false;
|
||||||
|
remove(*AS);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
bool AliasSetTracker::remove(CallSite CS) {
|
bool AliasSetTracker::remove(CallSite CS) {
|
||||||
if (Function *F = CS.getCalledFunction())
|
if (Function *F = CS.getCalledFunction())
|
||||||
if (AA.doesNotAccessMemory(F))
|
if (AA.doesNotAccessMemory(F))
|
||||||
@ -345,8 +361,8 @@ bool AliasSetTracker::remove(Instruction *I) {
|
|||||||
return remove(SI);
|
return remove(SI);
|
||||||
else if (CallInst *CI = dyn_cast<CallInst>(I))
|
else if (CallInst *CI = dyn_cast<CallInst>(I))
|
||||||
return remove(CI);
|
return remove(CI);
|
||||||
else if (InvokeInst *II = dyn_cast<InvokeInst>(I))
|
else if (FreeInst *FI = dyn_cast<FreeInst>(I))
|
||||||
return remove(II);
|
return remove(FI);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user