mirror of
https://github.com/RPCS3/llvm.git
synced 2024-12-21 03:28:31 +00:00
Cleanup code to use iterators instead of ".size()".
Does any one else hate the name "const_reverse_iterator" as much as I do? git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77399 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
7b43f5cdd1
commit
5cff487665
@ -317,7 +317,7 @@ DwarfException::ComputeActionsTable(const SmallVectorImpl<const LandingPadInfo*>
|
|||||||
int FirstAction = 0;
|
int FirstAction = 0;
|
||||||
unsigned SizeActions = 0;
|
unsigned SizeActions = 0;
|
||||||
const LandingPadInfo *PrevLPI = 0;
|
const LandingPadInfo *PrevLPI = 0;
|
||||||
for (SmallVector<const LandingPadInfo *, 64>::const_iterator
|
for (SmallVectorImpl<const LandingPadInfo *>::const_iterator
|
||||||
I = LandingPads.begin(), E = LandingPads.end(); I != E; ++I) {
|
I = LandingPads.begin(), E = LandingPads.end(); I != E; ++I) {
|
||||||
const LandingPadInfo *LPI = *I;
|
const LandingPadInfo *LPI = *I;
|
||||||
const std::vector<int> &TypeIds = LPI->TypeIds;
|
const std::vector<int> &TypeIds = LPI->TypeIds;
|
||||||
@ -384,8 +384,10 @@ void DwarfException::EmitExceptionTable() {
|
|||||||
// duplicate actions.
|
// duplicate actions.
|
||||||
SmallVector<const LandingPadInfo *, 64> LandingPads;
|
SmallVector<const LandingPadInfo *, 64> LandingPads;
|
||||||
LandingPads.reserve(PadInfos.size());
|
LandingPads.reserve(PadInfos.size());
|
||||||
|
|
||||||
for (unsigned i = 0, N = PadInfos.size(); i != N; ++i)
|
for (unsigned i = 0, N = PadInfos.size(); i != N; ++i)
|
||||||
LandingPads.push_back(&PadInfos[i]);
|
LandingPads.push_back(&PadInfos[i]);
|
||||||
|
|
||||||
std::sort(LandingPads.begin(), LandingPads.end(), PadLT);
|
std::sort(LandingPads.begin(), LandingPads.end(), PadLT);
|
||||||
|
|
||||||
// Compute the actions table and gather the first action index for each
|
// Compute the actions table and gather the first action index for each
|
||||||
@ -394,18 +396,10 @@ void DwarfException::EmitExceptionTable() {
|
|||||||
SmallVector<unsigned, 64> FirstActions;
|
SmallVector<unsigned, 64> FirstActions;
|
||||||
unsigned SizeActions = ComputeActionsTable(LandingPads, Actions, FirstActions);
|
unsigned SizeActions = ComputeActionsTable(LandingPads, Actions, FirstActions);
|
||||||
|
|
||||||
// Compute the call-site table. The entry for an invoke has a try-range
|
|
||||||
// containing the call, a non-zero landing pad and an appropriate action. The
|
|
||||||
// entry for an ordinary call has a try-range containing the call and zero for
|
|
||||||
// the landing pad and the action. Calls marked 'nounwind' have no entry and
|
|
||||||
// must not be contained in the try-range of any entry - they form gaps in the
|
|
||||||
// table. Entries must be ordered by try-range address.
|
|
||||||
SmallVector<CallSiteEntry, 64> CallSites;
|
|
||||||
RangeMapType PadMap;
|
|
||||||
|
|
||||||
// Invokes and nounwind calls have entries in PadMap (due to being bracketed
|
// Invokes and nounwind calls have entries in PadMap (due to being bracketed
|
||||||
// by try-range labels when lowered). Ordinary calls do not, so appropriate
|
// by try-range labels when lowered). Ordinary calls do not, so appropriate
|
||||||
// try-ranges for them need be deduced.
|
// try-ranges for them need be deduced.
|
||||||
|
RangeMapType PadMap;
|
||||||
for (unsigned i = 0, N = LandingPads.size(); i != N; ++i) {
|
for (unsigned i = 0, N = LandingPads.size(); i != N; ++i) {
|
||||||
const LandingPadInfo *LandingPad = LandingPads[i];
|
const LandingPadInfo *LandingPad = LandingPads[i];
|
||||||
for (unsigned j = 0, E = LandingPad->BeginLabels.size(); j != E; ++j) {
|
for (unsigned j = 0, E = LandingPad->BeginLabels.size(); j != E; ++j) {
|
||||||
@ -416,6 +410,14 @@ void DwarfException::EmitExceptionTable() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Compute the call-site table. The entry for an invoke has a try-range
|
||||||
|
// containing the call, a non-zero landing pad and an appropriate action. The
|
||||||
|
// entry for an ordinary call has a try-range containing the call and zero for
|
||||||
|
// the landing pad and the action. Calls marked 'nounwind' have no entry and
|
||||||
|
// must not be contained in the try-range of any entry - they form gaps in the
|
||||||
|
// table. Entries must be ordered by try-range address.
|
||||||
|
SmallVector<CallSiteEntry, 64> CallSites;
|
||||||
|
|
||||||
// The end label of the previous invoke or nounwind try-range.
|
// The end label of the previous invoke or nounwind try-range.
|
||||||
unsigned LastLabel = 0;
|
unsigned LastLabel = 0;
|
||||||
|
|
||||||
@ -423,7 +425,7 @@ void DwarfException::EmitExceptionTable() {
|
|||||||
// an ordinary call) between the end of the previous try-range and now.
|
// an ordinary call) between the end of the previous try-range and now.
|
||||||
bool SawPotentiallyThrowing = false;
|
bool SawPotentiallyThrowing = false;
|
||||||
|
|
||||||
// Whether the last callsite entry was for an invoke.
|
// Whether the last CallSite entry was for an invoke.
|
||||||
bool PreviousIsInvoke = false;
|
bool PreviousIsInvoke = false;
|
||||||
|
|
||||||
// Visit all instructions in order of address.
|
// Visit all instructions in order of address.
|
||||||
@ -451,7 +453,6 @@ void DwarfException::EmitExceptionTable() {
|
|||||||
|
|
||||||
PadRange P = L->second;
|
PadRange P = L->second;
|
||||||
const LandingPadInfo *LandingPad = LandingPads[P.PadIndex];
|
const LandingPadInfo *LandingPad = LandingPads[P.PadIndex];
|
||||||
|
|
||||||
assert(BeginLabel == LandingPad->BeginLabels[P.RangeIndex] &&
|
assert(BeginLabel == LandingPad->BeginLabels[P.RangeIndex] &&
|
||||||
"Inconsistent landing pad map!");
|
"Inconsistent landing pad map!");
|
||||||
|
|
||||||
@ -562,8 +563,9 @@ void DwarfException::EmitExceptionTable() {
|
|||||||
Asm->EOL("Call-site table length");
|
Asm->EOL("Call-site table length");
|
||||||
|
|
||||||
// Emit the landing pad site information.
|
// Emit the landing pad site information.
|
||||||
for (unsigned i = 0, e = CallSites.size(); i < e; ++i) {
|
for (SmallVectorImpl<CallSiteEntry>::const_iterator
|
||||||
const CallSiteEntry &S = CallSites[i];
|
I = CallSites.begin(), E = CallSites.end(); I != E; ++I) {
|
||||||
|
const CallSiteEntry &S = *I;
|
||||||
const char *BeginTag;
|
const char *BeginTag;
|
||||||
unsigned BeginNumber;
|
unsigned BeginNumber;
|
||||||
|
|
||||||
@ -600,9 +602,9 @@ void DwarfException::EmitExceptionTable() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Emit the actions.
|
// Emit the actions.
|
||||||
for (unsigned I = 0, N = Actions.size(); I != N; ++I) {
|
for (SmallVectorImpl<ActionEntry>::const_iterator
|
||||||
ActionEntry &Action = Actions[I];
|
I = Actions.begin(), E = Actions.end(); I != E; ++I) {
|
||||||
|
const ActionEntry &Action = *I;
|
||||||
Asm->EmitSLEB128Bytes(Action.ValueForTypeID);
|
Asm->EmitSLEB128Bytes(Action.ValueForTypeID);
|
||||||
Asm->EOL("TypeInfo index");
|
Asm->EOL("TypeInfo index");
|
||||||
Asm->EmitSLEB128Bytes(Action.NextAction);
|
Asm->EmitSLEB128Bytes(Action.NextAction);
|
||||||
@ -610,8 +612,9 @@ void DwarfException::EmitExceptionTable() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Emit the type ids.
|
// Emit the type ids.
|
||||||
for (unsigned M = TypeInfos.size(); M; --M) {
|
for (std::vector<GlobalVariable *>::const_reverse_iterator
|
||||||
GlobalVariable *GV = TypeInfos[M - 1];
|
I = TypeInfos.rbegin(), E = TypeInfos.rend(); I != E; ++I) {
|
||||||
|
GlobalVariable *GV = *I;
|
||||||
PrintRelDirective();
|
PrintRelDirective();
|
||||||
|
|
||||||
if (GV) {
|
if (GV) {
|
||||||
@ -625,8 +628,9 @@ void DwarfException::EmitExceptionTable() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Emit the filter typeids.
|
// Emit the filter typeids.
|
||||||
for (unsigned j = 0, M = FilterIds.size(); j < M; ++j) {
|
for (std::vector<unsigned>::const_iterator
|
||||||
unsigned TypeID = FilterIds[j];
|
I = FilterIds.begin(), E = FilterIds.end(); I < E; ++I) {
|
||||||
|
unsigned TypeID = *I;
|
||||||
Asm->EmitULEB128Bytes(TypeID);
|
Asm->EmitULEB128Bytes(TypeID);
|
||||||
Asm->EOL("Filter TypeInfo index");
|
Asm->EOL("Filter TypeInfo index");
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user