LLVM  7.0.0
Nios2Subtarget.cpp
Go to the documentation of this file.
1 //===-- Nios2Subtarget.cpp - Nios2 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 Nios2 specific subclass of TargetSubtargetInfo.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #include "Nios2Subtarget.h"
15 #include "Nios2.h"
16 
17 using namespace llvm;
18 
19 #define DEBUG_TYPE "nios2-subtarget"
20 
21 #define GET_SUBTARGETINFO_TARGET_DESC
22 #define GET_SUBTARGETINFO_CTOR
23 #include "Nios2GenSubtargetInfo.inc"
24 
25 void Nios2Subtarget::anchor() {}
26 
27 Nios2Subtarget::Nios2Subtarget(const Triple &TT, const std::string &CPU,
28  const std::string &FS, const TargetMachine &TM)
29  :
30 
31  // Nios2GenSubtargetInfo will display features by llc -march=nios2
32  // -mcpu=help
33  Nios2GenSubtargetInfo(TT, CPU, FS), TargetTriple(TT),
34  InstrInfo(initializeSubtargetDependencies(CPU, FS)), TLInfo(TM, *this),
35  FrameLowering(*this) {}
36 
38  StringRef FS) {
40  if (CPU != "nios2r2") {
41  CPU = "nios2r1";
43  } else {
45  }
46  } else {
47  errs() << "!!!Error, TargetTriple.getArch() = " << TargetTriple.getArch()
48  << "CPU = " << CPU << "\n";
49  exit(0);
50  }
51 
52  // Parse features string.
53  ParseSubtargetFeatures(CPU, FS);
54 
55  return *this;
56 }
raw_ostream & errs()
This returns a reference to a raw_ostream for standard error.
Compute iterated dominance frontiers using a linear time algorithm.
Definition: AllocatorList.h:24
Nios2Subtarget & initializeSubtargetDependencies(StringRef CPU, StringRef FS)
Nios2InstrInfo InstrInfo
Nios2FrameLowering FrameLowering
ArchType getArch() const
getArch - Get the parsed architecture type of this triple.
Definition: Triple.h:285
Triple - Helper class for working with autoconf configuration names.
Definition: Triple.h:44
void ParseSubtargetFeatures(StringRef CPU, StringRef FS)
ParseSubtargetFeatures - Parses features string setting specified subtarget options.
Primary interface to the complete machine description for the target machine.
Definition: TargetMachine.h:59
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:49
Nios2Subtarget(const Triple &TT, const std::string &CPU, const std::string &FS, const TargetMachine &TM)
This constructor initializes the data members to match that of the specified triple.
Nios2TargetLowering TLInfo
Nios2ArchEnum Nios2ArchVersion