Page MenuHomePhabricator

[mips] Add a 'generic' Mips CPU
ClosedPublic

Authored by mstojanovic on Nov 20 2019, 6:39 AM.

Details

Summary

Having a generic CPU removes a warning when creating a subtarget without the CPU being explicitly specified.

Diff Detail

Event Timeline

mstojanovic created this revision.Nov 20 2019, 6:39 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 20 2019, 6:39 AM

removes a warning when creating a subtarget without the CPU being explicitly specified

Without this patch llc -mtriple=mips -filetype=obj < cpus.ll shows no error for me. How reproduce the initial problem?

llvm/lib/Target/Mips/Mips.td
235

I think we need to explicitly specify a feature set enabled by default. In our case it's FeatureMips32. Otherwise it looks like the "generic" CPU has no features.

Added FeatureMips32 feature.

I came across this while running llvm-exegesis on a mips board, e.g.:

llvm-exegesis -mode latency -snippets-file /dev/null

It gets the 'generic' CPU name with sys::getHostCPUName() and calls createTargetMachine(), which then emits a warning:

'generic' is not a recognized processor for this target (ignoring processor)

Should I add a unittest that recreates this process?

It gets the 'generic' CPU name with sys::getHostCPUName() and calls createTargetMachine(), which then emits a warning:

'generic' is not a recognized processor for this target (ignoring processor)

Should I add a unittest that recreates this process?

Is it possible already to add any useful test case to the llvm/test/tools/llvm-exegesis/Mips? If so, let's add. Otherwise changes in the cpus.ll are good enough.

It's possible to run some tests manually but the test mentioned above, which will be part of lit.local.cfg and which checks whether lit can run llvm-exegesis tests on Mips, is encountering a segfault so I'm working on fixing that first.

atanasyan accepted this revision.Nov 21 2019, 6:08 AM

LGTM

Thanks.

This revision is now accepted and ready to land.Nov 21 2019, 6:08 AM
This revision was automatically updated to reflect the committed changes.