Make meanings of variables clearer in action table generation (NFC)

Summary:

Reviewers: kristina, zhmu, dschuff, rnk

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D52680

llvm-svn: 343724
This commit is contained in:
Heejin Ahn 2018-10-03 21:30:15 +00:00
parent a65c2dbfd6
commit 9d224346b2
1 changed files with 12 additions and 11 deletions

View File

@ -99,7 +99,7 @@ void EHStreamer::computeActionsTable(
FirstActions.reserve(LandingPads.size());
int FirstAction = 0;
unsigned SizeActions = 0;
unsigned SizeActions = 0; // Total size of all action entries for a function
const LandingPadInfo *PrevLPI = nullptr;
for (SmallVectorImpl<const LandingPadInfo *>::const_iterator
@ -107,23 +107,24 @@ void EHStreamer::computeActionsTable(
const LandingPadInfo *LPI = *I;
const std::vector<int> &TypeIds = LPI->TypeIds;
unsigned NumShared = PrevLPI ? sharedTypeIDs(LPI, PrevLPI) : 0;
unsigned SizeSiteActions = 0;
unsigned SizeSiteActions = 0; // Total size of all entries for a landingpad
if (NumShared < TypeIds.size()) {
unsigned SizeAction = 0;
// Size of one action entry (typeid + next action)
unsigned SizeActionEntry = 0;
unsigned PrevAction = (unsigned)-1;
if (NumShared) {
unsigned SizePrevIds = PrevLPI->TypeIds.size();
assert(Actions.size());
PrevAction = Actions.size() - 1;
SizeAction = getSLEB128Size(Actions[PrevAction].NextAction) +
SizeActionEntry = getSLEB128Size(Actions[PrevAction].NextAction) +
getSLEB128Size(Actions[PrevAction].ValueForTypeID);
for (unsigned j = NumShared; j != SizePrevIds; ++j) {
assert(PrevAction != (unsigned)-1 && "PrevAction is invalid!");
SizeAction -= getSLEB128Size(Actions[PrevAction].ValueForTypeID);
SizeAction += -Actions[PrevAction].NextAction;
SizeActionEntry -= getSLEB128Size(Actions[PrevAction].ValueForTypeID);
SizeActionEntry += -Actions[PrevAction].NextAction;
PrevAction = Actions[PrevAction].Previous;
}
}
@ -136,9 +137,9 @@ void EHStreamer::computeActionsTable(
isFilterEHSelector(TypeID) ? FilterOffsets[-1 - TypeID] : TypeID;
unsigned SizeTypeID = getSLEB128Size(ValueForTypeID);
int NextAction = SizeAction ? -(SizeAction + SizeTypeID) : 0;
SizeAction = SizeTypeID + getSLEB128Size(NextAction);
SizeSiteActions += SizeAction;
int NextAction = SizeActionEntry ? -(SizeActionEntry + SizeTypeID) : 0;
SizeActionEntry = SizeTypeID + getSLEB128Size(NextAction);
SizeSiteActions += SizeActionEntry;
ActionEntry Action = { ValueForTypeID, NextAction, PrevAction };
Actions.push_back(Action);
@ -146,7 +147,7 @@ void EHStreamer::computeActionsTable(
}
// Record the first action of the landing pad site.
FirstAction = SizeActions + SizeSiteActions - SizeAction + 1;
FirstAction = SizeActions + SizeSiteActions - SizeActionEntry + 1;
} // else identical - re-use previous FirstAction
// Information used when creating the call-site table. The action record