blob: c0aa21b97659577ff44955a61699455d135e500c [file] [log] [blame]
Tony Linthicum1213a7a2011-12-12 21:14:40 +00001//===- 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 "llvm/Support/CommandLine.h"
17#include "llvm/Support/ErrorHandling.h"
18using namespace llvm;
19
20#define GET_SUBTARGETINFO_MC_DESC
21#define GET_SUBTARGETINFO_CTOR
22#define GET_SUBTARGETINFO_TARGET_DESC
23#include "HexagonGenSubtargetInfo.inc"
24
25static cl::opt<bool>
26EnableV3("enable-hexagon-v3", cl::Hidden,
27 cl::desc("Enable Hexagon V3 instructions."));
28
29static cl::opt<bool>
30EnableMemOps(
31 "enable-hexagon-memops",
32 cl::Hidden, cl::ZeroOrMore, cl::ValueDisallowed,
33 cl::desc("Generate V4 MEMOP in code generation for Hexagon target"));
34
35HexagonSubtarget::HexagonSubtarget(StringRef TT, StringRef CPU, StringRef FS):
36 HexagonGenSubtargetInfo(TT, CPU, FS),
37 HexagonArchVersion(V1),
38 CPUString(CPU.str()) {
39 ParseSubtargetFeatures(CPU, FS);
40
41 switch(HexagonArchVersion) {
42 case HexagonSubtarget::V2:
43 break;
44 case HexagonSubtarget::V3:
45 EnableV3 = true;
46 break;
47 case HexagonSubtarget::V4:
48 break;
49 default:
50 llvm_unreachable("Unknown Architecture Version.");
51 }
52
53 // Initialize scheduling itinerary for the specified CPU.
54 InstrItins = getInstrItineraryForCPU(CPUString);
55
56 if (EnableMemOps)
57 UseMemOps = true;
58 else
59 UseMemOps = false;
60}