This is an archive of the discontinued LLVM Phabricator instance.

Extract the method to begin and end a fragment in AsmPrinterHandler in their own method. NFC
ClosedPublic

Authored by deadalnix on Feb 24 2016, 1:07 PM.

Diff Detail

Repository
rL LLVM

Event Timeline

deadalnix updated this revision to Diff 48970.Feb 24 2016, 1:07 PM
deadalnix retitled this revision from to Extract the method to begin and end a fragment in AsmPrinterHandler in their own method. NFC.
deadalnix updated this object.
deadalnix added reviewers: davidxl, reames, sanjoy, MatzeB, pete.
deadalnix added a subscriber: llvm-commits.
davidxl added inline comments.Feb 25 2016, 9:24 AM
lib/CodeGen/AsmPrinter/DwarfCFIException.cpp
46 ↗(On Diff #48970)

If this is the final override, you can probably call it with

DwarfCFIExeptionBase::endFragment();

88 ↗(On Diff #48970)

nit: remove Regular

136 ↗(On Diff #48970)

unnecessary code movement -- move endFunction down after endFragment

158 ↗(On Diff #48970)

Move this assertion up and make it assert (F->hasPersonalityFn() && "Expect ... ");

lib/CodeGen/AsmPrinter/DwarfException.h
67 ↗(On Diff #48970)

Should this and the end function be declared in DwarfCFIExceptionBase? Note that there are two overrider classes to the Base class.

deadalnix added inline comments.Feb 25 2016, 11:09 AM
lib/CodeGen/AsmPrinter/DwarfCFIException.cpp
136 ↗(On Diff #48970)

I did not move this. It always was just after beginFunction. I can reorder to keep this out of the diff.

158 ↗(On Diff #48970)

P is used down the road, so I'm not sure this makes sense.

lib/CodeGen/AsmPrinter/DwarfException.h
67 ↗(On Diff #48970)

There are defined as doing nothing in AsmPrinterHandler, so we are good here.

deadalnix updated this revision to Diff 49099.Feb 25 2016, 11:12 AM

Address various comments

davidxl added inline comments.Feb 25 2016, 11:27 AM
lib/CodeGen/AsmPrinter/DwarfCFIException.cpp
149 ↗(On Diff #49099)

if you do not assert F->hasPersonalityFn(), can F->getPersonalityFn() possibly return NULL -- then you will get segfault which is less desirable than asserting.

lib/CodeGen/AsmPrinter/DwarfException.h
67 ↗(On Diff #49099)

./lib/CodeGen/AsmPrinter/ARMException.cpp:39:ARMException::ARMException

ARMException::ARMException(AsmPrinter *A) : DwarfCFIExceptionBase(A) { ..)

ARMException class also derives from DwarfExceptionBase. If beginFragment()/endFragment() is not pushed into the base class, this class will have inherited the empty definition which is wrong.

Correction -- only endFragment part is wrong -- endFragment is called in the base class implementation ...

deadalnix added inline comments.Feb 25 2016, 1:34 PM
lib/CodeGen/AsmPrinter/DwarfCFIException.cpp
149 ↗(On Diff #49099)

shouldEmitPersonality already gates this, see line 115

lib/CodeGen/AsmPrinter/DwarfException.h
67 ↗(On Diff #49099)

Good catch. Let em fix this.

deadalnix updated this revision to Diff 49112.Feb 25 2016, 1:39 PM

Move endFragment to DwarfCFIExceptionBase

davidxl accepted this revision.Feb 26 2016, 11:32 AM
davidxl edited edge metadata.

looks like a good NFC clean up. LGTM

lib/CodeGen/AsmPrinter/DwarfCFIException.cpp
61 ↗(On Diff #49112)

add forceEmitPersonality field here.

This revision is now accepted and ready to land.Feb 26 2016, 11:32 AM
This revision was automatically updated to reflect the committed changes.