Change createAsmParser to take a MCSubtargetInfo instead of triple,
[oota-llvm.git] / lib / Target / Alpha / AlphaSubtarget.cpp
1 //===- AlphaSubtarget.cpp - Alpha Subtarget Information ---------*- C++ -*-===//
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 Alpha specific subclass of TargetSubtargetInfo.
11 //
12 //===----------------------------------------------------------------------===//
13
14 #include "AlphaSubtarget.h"
15 #include "Alpha.h"
16 #include "llvm/Target/TargetRegistry.h"
17
18 #define GET_SUBTARGETINFO_ENUM
19 #define GET_SUBTARGETINFO_MC_DESC
20 #define GET_SUBTARGETINFO_TARGET_DESC
21 #define GET_SUBTARGETINFO_CTOR
22 #include "AlphaGenSubtargetInfo.inc"
23
24 using namespace llvm;
25
26 AlphaSubtarget::AlphaSubtarget(const std::string &TT, const std::string &CPU,
27                                const std::string &FS)
28   : AlphaGenSubtargetInfo(TT, CPU, FS), HasCT(false) {
29   std::string CPUName = CPU;
30   if (CPUName.empty())
31     CPUName = "generic";
32
33   // Parse features string.
34   ParseSubtargetFeatures(CPUName, FS);
35
36   // Initialize scheduling itinerary for the specified CPU.
37   InstrItins = getInstrItineraryForCPU(CPUName);
38 }
39
40 MCSubtargetInfo *createAlphaMCSubtargetInfo(StringRef TT, StringRef CPU,
41                                             StringRef FS) {
42   MCSubtargetInfo *X = new MCSubtargetInfo();
43   InitAlphaMCSubtargetInfo(X, CPU, FS);
44   return X;
45 }
46
47 extern "C" void LLVMInitializeAlphaMCSubtargetInfo() {
48   TargetRegistry::RegisterMCSubtargetInfo(TheAlphaTarget,
49                                           createAlphaMCSubtargetInfo);
50 }