This is an archive of the discontinued LLVM Phabricator instance.

[RISCV] Support 'generic' as a valid CPU name.
ClosedPublic

Authored by craig.topper on Mar 7 2022, 12:41 PM.

Details

Summary

Most other targets support 'generic', but RISCV issues an error.
This can require a special case in tools that use LLVM that aren't
clang.

This patch treats "generic" the same as an empty string and remaps
it to generic-rv/rv64 based on the triple. Unfortunately, it has to
be added to RISCV.td because MCSubtargetInfo is constructed and
parses the CPU before RISCVSubtarget's constructor gets a chance
to remap it. The CPU will then reparsed and the state in the
MCSubtargetInfo subclass will be updated again.

Fixes PR54146.

Diff Detail

Event Timeline

craig.topper created this revision.Mar 7 2022, 12:41 PM
craig.topper requested review of this revision.Mar 7 2022, 12:41 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 7 2022, 12:41 PM
khchen accepted this revision.Mar 8 2022, 6:04 AM

LGTM, thanks!
Should we have this patch in LLVM 14?

This revision is now accepted and ready to land.Mar 8 2022, 6:04 AM
This revision was landed with ongoing or failed builds.Mar 9 2022, 4:46 PM
This revision was automatically updated to reflect the committed changes.