This is an archive of the discontinued LLVM Phabricator instance.

[ARM] Do not test for CPUs, use SubtargetFeatures (Part 2). NFCI
ClosedPublic

Authored by rovka on Jun 24 2016, 8:09 AM.

Details

Summary

This is a follow-up for r273544.

The end goal is to get rid of the isSwift / isCortexXY / isWhatever methods.

Since the ARM backend seems to have quite a lot of calls to these methods, I intend to submit 5-6 subtarget features at a time, instead of one big lump.

Diff Detail

Repository
rL LLVM

Event Timeline

rovka updated this revision to Diff 61791.Jun 24 2016, 8:09 AM
rovka retitled this revision from to [ARM] Do not test for CPUs, use SubtargetFeatures (Part 2). NFCI.
rovka updated this object.
rovka added a subscriber: llvm-commits.
echristo edited edge metadata.Jun 24 2016, 2:28 PM

One inline comment/question. If the answer is "no ideas come to mind" then feel free to commit from my perspective.

-eric

lib/Target/ARM/ARMSubtarget.h
61 ↗(On Diff #61791)

This feels a little awkward, but I guess not terrible. I'm not sure I like it more than just having it all explicit in routines. Nothing binding here, just commentary of "is there something better here?"

MatzeB accepted this revision.Jun 24 2016, 3:08 PM
MatzeB edited edge metadata.

Looks good from my side.

I share Eric's feelings of some functions looking strange. However we already do have a better thing: New-style scheduling models ("MCSchedule.h") instead of the itineraries ("MCInstrItineraries.h"). A lot of the information computed by those strange functions will be pulled from the scheduling model directly. However this would mean rewriting a bunch of scheduling definitions which is out of scope for this patch.

lib/Target/ARM/ARMSubtarget.h
61 ↗(On Diff #61791)

I share the sentiment of this looking strange. And there is something better: Using new-style scheduling models ("MCSchedule.h") instead of the itineraries ("MCInstrItineraries.h") will make those functions go away and the information comes directly out of the scheduling model. However this would mean rewriting a bunch of scheduling definitions which is out of scope for this patch.

This revision is now accepted and ready to land.Jun 24 2016, 3:08 PM
compnerd accepted this revision.Jun 24 2016, 5:44 PM
compnerd edited edge metadata.
compnerd added inline comments.
lib/Target/ARM/ARM.td
154 ↗(On Diff #61791)

I believe the proper prefix would be un rather than non.

lib/Target/ARM/ARMBaseInstrInfo.cpp
3029 ↗(On Diff #61791)

The NumRegs identifies that you are adding 1 for each of the registers, the comment tail doesn't add much.

rovka added a comment.Jun 27 2016, 2:04 AM

Thanks for reviewing.

lib/Target/ARM/ARM.td
154 ↗(On Diff #61791)

I took the prefix from the Cortex-A8 TRM. Although, now that you mention it, they seem to use "nonpipelined" as a single word, so I'm going to switch to that.

e.g. "The VFP coprocessor is a nonpipelined floating-point execution engine that blah".

lib/Target/ARM/ARMBaseInstrInfo.cpp
3029 ↗(On Diff #61791)

Ok, got rid of it.

lib/Target/ARM/ARMSubtarget.h
61 ↗(On Diff #61791)

That's good news, because some of the code around itineraries is really messy. E.g. ARMBaseInstrInfo::getOperandLatency and the static adjustDefLatency seem to contain some copy-pasted code that has grown just slightly different over time.

rovka updated this revision to Diff 61946.Jun 27 2016, 2:05 AM
rovka edited edge metadata.

Addressed review comments.

This revision was automatically updated to reflect the committed changes.