1 //===-- HexagonSubtarget.cpp - Hexagon Subtarget Information --------------===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file implements the Hexagon specific subclass of TargetSubtarget.
12 //===----------------------------------------------------------------------===//
14 #include "HexagonSubtarget.h"
16 #include "HexagonRegisterInfo.h"
17 #include "llvm/Support/CommandLine.h"
18 #include "llvm/Support/ErrorHandling.h"
21 #define GET_SUBTARGETINFO_CTOR
22 #define GET_SUBTARGETINFO_TARGET_DESC
23 #include "HexagonGenSubtargetInfo.inc"
26 EnableV3("enable-hexagon-v3", cl::Hidden,
27 cl::desc("Enable Hexagon V3 instructions."));
31 "enable-hexagon-memops",
32 cl::Hidden, cl::ZeroOrMore, cl::ValueDisallowed,
33 cl::desc("Generate V4 memop instructions."));
37 "enable-hexagon-ieee-rnd-near",
38 cl::Hidden, cl::ZeroOrMore, cl::init(false),
39 cl::desc("Generate non-chopped conversion from fp to int."));
41 HexagonSubtarget::HexagonSubtarget(StringRef TT, StringRef CPU, StringRef FS):
42 HexagonGenSubtargetInfo(TT, CPU, FS),
43 CPUString(CPU.str()) {
45 // If the programmer has not specified a Hexagon version, default to -mv4.
46 if (CPUString.empty())
47 CPUString = "hexagonv4";
49 if (CPUString == "hexagonv2") {
50 HexagonArchVersion = V2;
51 } else if (CPUString == "hexagonv3") {
53 HexagonArchVersion = V3;
54 } else if (CPUString == "hexagonv4") {
55 HexagonArchVersion = V4;
56 } else if (CPUString == "hexagonv5") {
57 HexagonArchVersion = V5;
59 llvm_unreachable("Unrecognized Hexagon processor version");
62 ParseSubtargetFeatures(CPUString, FS);
64 // Initialize scheduling itinerary for the specified CPU.
65 InstrItins = getInstrItineraryForCPU(CPUString);
72 if (EnableIEEERndNear)
73 ModeIEEERndNear = true;
75 ModeIEEERndNear = false;