mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-15 04:30:12 +00:00
minor cleanups
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34904 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
d7f3de655b
commit
57939df2eb
@ -239,6 +239,9 @@ public:
|
|||||||
return TrackedGlobals;
|
return TrackedGlobals;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline void markOverdefined(Value *V) {
|
||||||
|
markOverdefined(ValueState[V], V);
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// markConstant - Make a value be marked as "constant". If the value
|
// markConstant - Make a value be marked as "constant". If the value
|
||||||
@ -277,9 +280,6 @@ private:
|
|||||||
OverdefinedInstWorkList.push_back(V);
|
OverdefinedInstWorkList.push_back(V);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
inline void markOverdefined(Value *V) {
|
|
||||||
markOverdefined(ValueState[V], V);
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void mergeInValue(LatticeVal &IV, Value *V, LatticeVal &MergeWithV) {
|
inline void mergeInValue(LatticeVal &IV, Value *V, LatticeVal &MergeWithV) {
|
||||||
if (IV.isOverdefined() || MergeWithV.isUndefined())
|
if (IV.isOverdefined() || MergeWithV.isUndefined())
|
||||||
@ -1365,9 +1365,8 @@ bool SCCP::runOnFunction(Function &F) {
|
|||||||
Solver.MarkBlockExecutable(F.begin());
|
Solver.MarkBlockExecutable(F.begin());
|
||||||
|
|
||||||
// Mark all arguments to the function as being overdefined.
|
// Mark all arguments to the function as being overdefined.
|
||||||
std::map<Value*, LatticeVal> &Values = Solver.getValueMapping();
|
|
||||||
for (Function::arg_iterator AI = F.arg_begin(), E = F.arg_end(); AI != E; ++AI)
|
for (Function::arg_iterator AI = F.arg_begin(), E = F.arg_end(); AI != E; ++AI)
|
||||||
Values[AI].markOverdefined();
|
Solver.markOverdefined(AI);
|
||||||
|
|
||||||
// Solve for constants.
|
// Solve for constants.
|
||||||
bool ResolvedUndefs = true;
|
bool ResolvedUndefs = true;
|
||||||
@ -1385,6 +1384,8 @@ bool SCCP::runOnFunction(Function &F) {
|
|||||||
//
|
//
|
||||||
SmallSet<BasicBlock*, 16> &ExecutableBBs = Solver.getExecutableBlocks();
|
SmallSet<BasicBlock*, 16> &ExecutableBBs = Solver.getExecutableBlocks();
|
||||||
SmallVector<Instruction*, 32> Insts;
|
SmallVector<Instruction*, 32> Insts;
|
||||||
|
std::map<Value*, LatticeVal> &Values = Solver.getValueMapping();
|
||||||
|
|
||||||
for (Function::iterator BB = F.begin(), E = F.end(); BB != E; ++BB)
|
for (Function::iterator BB = F.begin(), E = F.end(); BB != E; ++BB)
|
||||||
if (!ExecutableBBs.count(BB)) {
|
if (!ExecutableBBs.count(BB)) {
|
||||||
DOUT << " BasicBlock Dead:" << *BB;
|
DOUT << " BasicBlock Dead:" << *BB;
|
||||||
@ -1486,14 +1487,13 @@ bool IPSCCP::runOnModule(Module &M) {
|
|||||||
// Loop over all functions, marking arguments to those with their addresses
|
// Loop over all functions, marking arguments to those with their addresses
|
||||||
// taken or that are external as overdefined.
|
// taken or that are external as overdefined.
|
||||||
//
|
//
|
||||||
std::map<Value*, LatticeVal> &Values = Solver.getValueMapping();
|
|
||||||
for (Module::iterator F = M.begin(), E = M.end(); F != E; ++F)
|
for (Module::iterator F = M.begin(), E = M.end(); F != E; ++F)
|
||||||
if (!F->hasInternalLinkage() || AddressIsTaken(F)) {
|
if (!F->hasInternalLinkage() || AddressIsTaken(F)) {
|
||||||
if (!F->isDeclaration())
|
if (!F->isDeclaration())
|
||||||
Solver.MarkBlockExecutable(F->begin());
|
Solver.MarkBlockExecutable(F->begin());
|
||||||
for (Function::arg_iterator AI = F->arg_begin(), E = F->arg_end();
|
for (Function::arg_iterator AI = F->arg_begin(), E = F->arg_end();
|
||||||
AI != E; ++AI)
|
AI != E; ++AI)
|
||||||
Values[AI].markOverdefined();
|
Solver.markOverdefined(AI);
|
||||||
} else {
|
} else {
|
||||||
Solver.AddTrackedFunction(F);
|
Solver.AddTrackedFunction(F);
|
||||||
}
|
}
|
||||||
@ -1525,6 +1525,7 @@ bool IPSCCP::runOnModule(Module &M) {
|
|||||||
SmallSet<BasicBlock*, 16> &ExecutableBBs = Solver.getExecutableBlocks();
|
SmallSet<BasicBlock*, 16> &ExecutableBBs = Solver.getExecutableBlocks();
|
||||||
SmallVector<Instruction*, 32> Insts;
|
SmallVector<Instruction*, 32> Insts;
|
||||||
SmallVector<BasicBlock*, 32> BlocksToErase;
|
SmallVector<BasicBlock*, 32> BlocksToErase;
|
||||||
|
std::map<Value*, LatticeVal> &Values = Solver.getValueMapping();
|
||||||
|
|
||||||
for (Module::iterator F = M.begin(), E = M.end(); F != E; ++F) {
|
for (Module::iterator F = M.begin(), E = M.end(); F != E; ++F) {
|
||||||
for (Function::arg_iterator AI = F->arg_begin(), E = F->arg_end();
|
for (Function::arg_iterator AI = F->arg_begin(), E = F->arg_end();
|
||||||
|
Loading…
Reference in New Issue
Block a user