LLVM  9.0.0svn
RISCVSubtarget.h
Go to the documentation of this file.
1 //===-- RISCVSubtarget.h - Define Subtarget for the RISCV -------*- 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 RISCV specific subclass of TargetSubtargetInfo.
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #ifndef LLVM_LIB_TARGET_RISCV_RISCVSUBTARGET_H
14 #define LLVM_LIB_TARGET_RISCV_RISCVSUBTARGET_H
15 
16 #include "RISCVFrameLowering.h"
17 #include "RISCVISelLowering.h"
18 #include "RISCVInstrInfo.h"
19 #include "Utils/RISCVBaseInfo.h"
22 #include "llvm/IR/DataLayout.h"
24 
25 #define GET_SUBTARGETINFO_HEADER
26 #include "RISCVGenSubtargetInfo.inc"
27 
28 namespace llvm {
29 class StringRef;
30 
32  virtual void anchor();
33  bool HasStdExtM = false;
34  bool HasStdExtA = false;
35  bool HasStdExtF = false;
36  bool HasStdExtD = false;
37  bool HasStdExtC = false;
38  bool HasRV64 = false;
39  bool IsRV32E = false;
40  bool EnableLinkerRelax = false;
41  unsigned XLen = 32;
42  MVT XLenVT = MVT::i32;
44  RISCVFrameLowering FrameLowering;
45  RISCVInstrInfo InstrInfo;
46  RISCVRegisterInfo RegInfo;
47  RISCVTargetLowering TLInfo;
49 
50  /// Initializes using the passed in CPU and feature strings so that we can
51  /// use initializer lists for subtarget initialization.
52  RISCVSubtarget &initializeSubtargetDependencies(const Triple &TT,
53  StringRef CPU, StringRef FS,
54  StringRef ABIName);
55 
56 public:
57  // Initializes the data members to match that of the specified triple.
58  RISCVSubtarget(const Triple &TT, StringRef CPU, StringRef FS,
59  StringRef ABIName, const TargetMachine &TM);
60 
61  // Parses features string setting specified subtarget options. The
62  // definition of this function is auto-generated by tblgen.
64 
65  const RISCVFrameLowering *getFrameLowering() const override {
66  return &FrameLowering;
67  }
68  const RISCVInstrInfo *getInstrInfo() const override { return &InstrInfo; }
69  const RISCVRegisterInfo *getRegisterInfo() const override {
70  return &RegInfo;
71  }
72  const RISCVTargetLowering *getTargetLowering() const override {
73  return &TLInfo;
74  }
75  const SelectionDAGTargetInfo *getSelectionDAGInfo() const override {
76  return &TSInfo;
77  }
78  bool hasStdExtM() const { return HasStdExtM; }
79  bool hasStdExtA() const { return HasStdExtA; }
80  bool hasStdExtF() const { return HasStdExtF; }
81  bool hasStdExtD() const { return HasStdExtD; }
82  bool hasStdExtC() const { return HasStdExtC; }
83  bool is64Bit() const { return HasRV64; }
84  bool isRV32E() const { return IsRV32E; }
85  bool enableLinkerRelax() const { return EnableLinkerRelax; }
86  MVT getXLenVT() const { return XLenVT; }
87  unsigned getXLen() const { return XLen; }
88  RISCVABI::ABI getTargetABI() const { return TargetABI; }
89 };
90 } // End llvm namespace
91 
92 #endif
RISCVABI::ABI getTargetABI() const
This class represents lattice values for constants.
Definition: AllocatorList.h:23
const RISCVRegisterInfo * getRegisterInfo() const override
const SelectionDAGTargetInfo * getSelectionDAGInfo() const override
unsigned getXLen() const
bool isRV32E() const
bool hasStdExtA() const
bool enableLinkerRelax() const
Machine Value Type.
bool hasStdExtF() const
const RISCVTargetLowering * getTargetLowering() const override
bool hasStdExtM() const
Targets can subclass this to parameterize the SelectionDAG lowering and instruction selection process...
Triple - Helper class for working with autoconf configuration names.
Definition: Triple.h:43
bool hasStdExtD() const
const RISCVFrameLowering * getFrameLowering() const override
bool is64Bit() const
RISCVSubtarget(const Triple &TT, StringRef CPU, StringRef FS, StringRef ABIName, const TargetMachine &TM)
bool hasStdExtC() const
const RISCVInstrInfo * getInstrInfo() const override
Primary interface to the complete machine description for the target machine.
Definition: TargetMachine.h:65
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:48
void ParseSubtargetFeatures(StringRef CPU, StringRef FS)