mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-11-23 16:19:52 +00:00
Fix style issues from r163302 pointed out by Evan.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@163491 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -3045,13 +3045,12 @@ static bool GetCaseResults(SwitchInst *SI,
|
|||||||
/// DefaultResult to fill the holes in the table. If the table ends up
|
/// DefaultResult to fill the holes in the table. If the table ends up
|
||||||
/// containing the same result in each element, set *SingleResult to that value
|
/// containing the same result in each element, set *SingleResult to that value
|
||||||
/// and return NULL.
|
/// and return NULL.
|
||||||
static GlobalVariable *BuildLookupTable(
|
static GlobalVariable *BuildLookupTable(Module &M,
|
||||||
Module &M,
|
uint64_t TableSize,
|
||||||
uint64_t TableSize,
|
ConstantInt *Offset,
|
||||||
ConstantInt *Offset,
|
const SmallVector<std::pair<ConstantInt*, Constant*>, 4>& Results,
|
||||||
const std::vector<std::pair<ConstantInt*,Constant*> >& Results,
|
Constant *DefaultResult,
|
||||||
Constant *DefaultResult,
|
Constant **SingleResult) {
|
||||||
Constant **SingleResult) {
|
|
||||||
assert(Results.size() && "Need values to build lookup table");
|
assert(Results.size() && "Need values to build lookup table");
|
||||||
assert(TableSize >= Results.size() && "Table needs to hold all values");
|
assert(TableSize >= Results.size() && "Table needs to hold all values");
|
||||||
|
|
||||||
@@ -3133,7 +3132,7 @@ static bool SwitchToLookupTable(SwitchInst *SI,
|
|||||||
ConstantInt *MaxCaseVal = CI.getCaseValue();
|
ConstantInt *MaxCaseVal = CI.getCaseValue();
|
||||||
|
|
||||||
BasicBlock *CommonDest = NULL;
|
BasicBlock *CommonDest = NULL;
|
||||||
typedef std::vector<std::pair<ConstantInt*, Constant*> > ResultListTy;
|
typedef SmallVector<std::pair<ConstantInt*, Constant*>, 4> ResultListTy;
|
||||||
SmallDenseMap<PHINode*, ResultListTy> ResultLists;
|
SmallDenseMap<PHINode*, ResultListTy> ResultLists;
|
||||||
SmallDenseMap<PHINode*, Constant*> DefaultResults;
|
SmallDenseMap<PHINode*, Constant*> DefaultResults;
|
||||||
SmallDenseMap<PHINode*, Type*> ResultTypes;
|
SmallDenseMap<PHINode*, Type*> ResultTypes;
|
||||||
@@ -3161,16 +3160,14 @@ static bool SwitchToLookupTable(SwitchInst *SI,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get the resulting values for the default case.
|
// Get the resulting values for the default case.
|
||||||
{
|
SmallVector<std::pair<PHINode*, Constant*>, 4> DefaultResultsList;
|
||||||
SmallVector<std::pair<PHINode*, Constant*>, 4> DefaultResultsList;
|
if (!GetCaseResults(SI, SI->getDefaultDest(), &CommonDest, DefaultResultsList))
|
||||||
if (!GetCaseResults(SI, SI->getDefaultDest(), &CommonDest, DefaultResultsList))
|
return false;
|
||||||
return false;
|
for (size_t I = 0, E = DefaultResultsList.size(); I != E; ++I) {
|
||||||
for (size_t I = 0, E = DefaultResultsList.size(); I != E; ++I) {
|
PHINode *PHI = DefaultResultsList[I].first;
|
||||||
PHINode *PHI = DefaultResultsList[I].first;
|
Constant *Result = DefaultResultsList[I].second;
|
||||||
Constant *Result = DefaultResultsList[I].second;
|
DefaultResults[PHI] = Result;
|
||||||
DefaultResults[PHI] = Result;
|
ResultTypes[PHI] = Result->getType();
|
||||||
ResultTypes[PHI] = Result->getType();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
APInt RangeSpread = MaxCaseVal->getValue() - MinCaseVal->getValue();
|
APInt RangeSpread = MaxCaseVal->getValue() - MinCaseVal->getValue();
|
||||||
|
|||||||
Reference in New Issue
Block a user