[RISCV] Give an explicit error if 'generic' CPU is passed instead of 'generic-rv32...
authorCraig Topper <craig.topper@sifive.com>
Mon, 15 Mar 2021 00:17:50 +0000 (17:17 -0700)
committerCraig Topper <craig.topper@sifive.com>
Mon, 15 Mar 2021 00:21:31 +0000 (17:21 -0700)
commitfcdf7f6224610a51dc2ff47f2f1e3377329b64a7
treed1f603d4461fb0c4870ffc0d97010925219f67e1
parent12dac66f6b33dd14b72076800726817f682ab785
[RISCV] Give an explicit error if 'generic' CPU is passed instead of 'generic-rv32' or 'generic-rv64'. Validate 64Bit feature against the triple.

I encountered a project that uses llvm that passes "generic" by
default. While I could fix that project, I wouldn't be surprised
if other projects did something similar. So it seems like
a good idea to provide a better error here.

I've also added validation of the 64Bit feature against the
triple so that we can catch a mismatched CPU before failing in
a mysterious way. We can make it pretty far in isel because we
calculate XLenVT from the triple and use that to set up the legal
integer type.

Reviewed By: luismarques, khchen

Differential Revision: https://reviews.llvm.org/D98307
llvm/lib/Target/RISCV/MCTargetDesc/RISCVBaseInfo.cpp
llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCTargetDesc.cpp
llvm/lib/Target/RISCV/RISCVSubtarget.cpp