Hexagon V5 FP Support.
[oota-llvm.git] / lib / Target / Hexagon / HexagonSubtarget.cpp
1 //===-- HexagonSubtarget.cpp - Hexagon Subtarget Information --------------===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file implements the Hexagon specific subclass of TargetSubtarget.
11 //
12 //===----------------------------------------------------------------------===//
13
14 #include "HexagonSubtarget.h"
15 #include "Hexagon.h"
16 #include "HexagonRegisterInfo.h"
17 #include "llvm/Support/CommandLine.h"
18 #include "llvm/Support/ErrorHandling.h"
19 using namespace llvm;
20
21 #define GET_SUBTARGETINFO_CTOR
22 #define GET_SUBTARGETINFO_TARGET_DESC
23 #include "HexagonGenSubtargetInfo.inc"
24
25 static cl::opt<bool>
26 EnableV3("enable-hexagon-v3", cl::Hidden,
27          cl::desc("Enable Hexagon V3 instructions."));
28
29 static cl::opt<bool>
30 EnableMemOps(
31     "enable-hexagon-memops",
32     cl::Hidden, cl::ZeroOrMore, cl::ValueDisallowed,
33     cl::desc("Generate V4 memop instructions."));
34
35 static cl::opt<bool>
36 EnableIEEERndNear(
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."));
40
41 HexagonSubtarget::HexagonSubtarget(StringRef TT, StringRef CPU, StringRef FS):
42   HexagonGenSubtargetInfo(TT, CPU, FS),
43   HexagonArchVersion(V1),
44   CPUString(CPU.str()) {
45   ParseSubtargetFeatures(CPU, FS);
46
47   switch(HexagonArchVersion) {
48   case HexagonSubtarget::V2:
49     break;
50   case HexagonSubtarget::V3:
51     EnableV3 = true;
52     break;
53   case HexagonSubtarget::V4:
54     break;
55   case HexagonSubtarget::V5:
56     break;
57   default:
58     llvm_unreachable("Unknown Architecture Version.");
59   }
60
61   // Initialize scheduling itinerary for the specified CPU.
62   InstrItins = getInstrItineraryForCPU(CPUString);
63
64   // Max issue per cycle == bundle width.
65   InstrItins.IssueWidth = 4;
66
67   if (EnableMemOps)
68     UseMemOps = true;
69   else
70     UseMemOps = false;
71
72   if (EnableIEEERndNear)
73     ModeIEEERndNear = true;
74   else
75     ModeIEEERndNear = false;
76 }
77