1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-01-31 12:41:49 +01:00

[Hexagon] Add -mv.. options to override CPU selection

This is for compatibility with scripts that use -mv5, etc. with the
assembler.

llvm-svn: 266918
This commit is contained in:
Krzysztof Parzyszek 2016-04-20 21:17:40 +00:00
parent 9e2408123d
commit d8b3e72047

View File

@ -48,10 +48,46 @@ cl::opt<bool> llvm::HexagonDisableDuplex
("mno-pairing",
cl::desc("Disable looking for duplex instructions for Hexagon"));
static cl::opt<bool> HexagonV4ArchVariant("mv4", cl::Hidden, cl::init(false),
cl::desc("Build for Hexagon V4"));
static cl::opt<bool> HexagonV5ArchVariant("mv5", cl::Hidden, cl::init(false),
cl::desc("Build for Hexagon V5"));
static cl::opt<bool> HexagonV55ArchVariant("mv55", cl::Hidden, cl::init(false),
cl::desc("Build for Hexagon V55"));
static cl::opt<bool> HexagonV60ArchVariant("mv60", cl::Hidden, cl::init(false),
cl::desc("Build for Hexagon V60"));
static StringRef DefaultArch = "hexagonv60";
static StringRef HexagonGetArchVariant() {
if (HexagonV4ArchVariant)
return "hexagonv4";
if (HexagonV5ArchVariant)
return "hexagonv5";
if (HexagonV55ArchVariant)
return "hexagonv55";
if (HexagonV60ArchVariant)
return "hexagonv60";
return "";
}
StringRef HEXAGON_MC::selectHexagonCPU(const Triple &TT, StringRef CPU) {
if (CPU.empty())
CPU = "hexagonv60";
return CPU;
StringRef ArchV = HexagonGetArchVariant();
if (!ArchV.empty() && !CPU.empty()) {
if (ArchV != CPU)
report_fatal_error("conflicting architectures specified.");
return CPU;
}
if (ArchV.empty()) {
if (CPU.empty())
CPU = DefaultArch;
return CPU;
}
return ArchV;
}
MCInstrInfo *llvm::createHexagonMCInstrInfo() {