This is an archive of the discontinued LLVM Phabricator instance.

Add MCContext argument to MCAsmBackend::applyFixup for error reporting
ClosedPublic

Authored by asb on Feb 22 2017, 11:40 AM.

Details

Summary

A number of backends (AArch64, MIPS, ARM) have been using MCContext::reportError to report issues such as out-of-range fixup values in their TgtAsmBackend. This is great, but because MCContext couldn't easily be threaded through to the adjustFixupValue helper function from its usual callsite (applyFixup), these backends ended up adding an MCContext* argument and adding another call to applyFixup to processFixupValue. If we just add an MCContext parameter to applyFixup, this is unnecessary, and even better - applyFixup can take a reference to MCContext rather than a potentially null pointer.

See D18402 for some relevant discussion.

Diff Detail

Repository
rL LLVM

Event Timeline

asb created this revision.Feb 22 2017, 11:40 AM
asb added a comment.Mar 2 2017, 6:53 AM

I've just verified this patch still applies cleanly to HEAD and, as before, all tests pass. Any comments? I think this is a useful cleanup for backends that already report errors for out-of-range fixups, and will make it easier to improve other backends with similar error reporting.

asb updated this revision to Diff 93278.Mar 28 2017, 12:56 PM

Refreshed the patch for current HEAD and double-checked all tests still pass. I'd really appreciate a review so we can get this committed.

t.p.northover accepted this revision.Mar 28 2017, 3:17 PM

Looks like a nice cleanup to me. Go for it!

This revision is now accepted and ready to land.Mar 28 2017, 3:17 PM
This revision was automatically updated to reflect the committed changes.