This is an archive of the discontinued LLVM Phabricator instance.

[ARM] Tidy-up condition-code support functions
ClosedPublic

Authored by javed.absar on Aug 26 2017, 5:02 AM.

Details

Summary

Move condition code support functions to Utils and remove code duplication.

Diff Detail

Repository
rL LLVM

Event Timeline

javed.absar created this revision.Aug 26 2017, 5:02 AM
fhahn accepted this revision.Aug 27 2017, 3:19 AM

Thanks, LGTM.

This looks like a NFC to me and removes some unnecessary code duplication.

lib/Target/ARM/Utils/ARMBaseInfo.h
51 ↗(On Diff #112785)

While you are at it, would it make sense to remove the default case there and add the llvm_unreachable after the switch like in ARMCondCodeToString?

This would give the compiler a better chance to warn about missing patterns, but that's only a minor point, as it's unlikely that CondCodes will change.

This revision is now accepted and ready to land.Aug 27 2017, 3:19 AM
javed.absar added inline comments.Aug 27 2017, 6:29 AM
lib/Target/ARM/Utils/ARMBaseInfo.h
51 ↗(On Diff #112785)

Thanks. Will do so.

javed.absar added inline comments.Aug 27 2017, 12:26 PM
lib/Target/ARM/Utils/ARMBaseInfo.h
51 ↗(On Diff #112785)

Looking at it again, that does not seem a good idea. There is no 'OppositCondition' for 'AL' (Always). Taking out the default will just trigger sprurious compilation warning - enumeration value 'AL' not handled in switch

This revision was automatically updated to reflect the committed changes.