From 9d224346b2a73f7f0d30fdf593e1975f7bc202a3 Mon Sep 17 00:00:00 2001 From: Heejin Ahn Date: Wed, 3 Oct 2018 21:30:15 +0000 Subject: [PATCH] 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 --- llvm/lib/CodeGen/AsmPrinter/EHStreamer.cpp | 23 +++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/llvm/lib/CodeGen/AsmPrinter/EHStreamer.cpp b/llvm/lib/CodeGen/AsmPrinter/EHStreamer.cpp index 89fe38572283..be04b9a6e8c8 100644 --- a/llvm/lib/CodeGen/AsmPrinter/EHStreamer.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/EHStreamer.cpp @@ -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_iterator @@ -107,23 +107,24 @@ void EHStreamer::computeActionsTable( const LandingPadInfo *LPI = *I; const std::vector &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) + - getSLEB128Size(Actions[PrevAction].ValueForTypeID); + 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