xref: /llvm-project/llvm/lib/Target/CSKY/CSKYSubtarget.cpp (revision d8e4170b0a1431edee939efc16b60b409affcb4d)
1 //===-- CSKYSubtarget.h - Define Subtarget for the CSKY----------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file declares the CSKY specific subclass of TargetSubtargetInfo.
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #include "CSKYSubtarget.h"
14 
15 using namespace llvm;
16 
17 #define DEBUG_TYPE "csky-subtarget"
18 #define GET_SUBTARGETINFO_TARGET_DESC
19 #define GET_SUBTARGETINFO_CTOR
20 #include "CSKYGenSubtargetInfo.inc"
21 
22 void CSKYSubtarget::anchor() {}
23 
24 CSKYSubtarget &CSKYSubtarget::initializeSubtargetDependencies(
25     const Triple &TT, StringRef CPUName, StringRef TuneCPUName, StringRef FS) {
26 
27   if (CPUName.empty())
28     CPUName = "generic";
29   if (TuneCPUName.empty())
30     TuneCPUName = CPUName;
31 
32   HasE1 = false;
33   HasE2 = false;
34   Has2E3 = false;
35   HasMP = false;
36   Has3E3r1 = false;
37   Has3r1E3r2 = false;
38   Has3r2E3r3 = false;
39   Has3E7 = false;
40   HasMP1E2 = false;
41   Has7E10 = false;
42   Has10E60 = false;
43 
44   ParseSubtargetFeatures(CPUName, TuneCPUName, FS);
45   return *this;
46 }
47 
48 CSKYSubtarget::CSKYSubtarget(const Triple &TT, StringRef CPU, StringRef TuneCPU,
49                              StringRef FS, const TargetMachine &TM)
50     : CSKYGenSubtargetInfo(TT, CPU, TuneCPU, FS),
51       FrameLowering(initializeSubtargetDependencies(TT, CPU, TuneCPU, FS)),
52       InstrInfo(*this), RegInfo(), TLInfo(TM, *this) {}
53