LLVM  15.0.0git
LoongArchSubtarget.h
Go to the documentation of this file.
1 //===- LoongArchSubtarget.h - Define Subtarget for the LoongArch -*- 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 LoongArch specific subclass of TargetSubtargetInfo.
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #ifndef LLVM_LIB_TARGET_LOONGARCH_LOONGARCHSUBTARGET_H
14 #define LLVM_LIB_TARGET_LOONGARCH_LOONGARCHSUBTARGET_H
15 
16 #include "LoongArchFrameLowering.h"
17 #include "LoongArchISelLowering.h"
18 #include "LoongArchInstrInfo.h"
19 #include "LoongArchRegisterInfo.h"
23 #include "llvm/IR/DataLayout.h"
25 
26 #define GET_SUBTARGETINFO_HEADER
27 #include "LoongArchGenSubtargetInfo.inc"
28 
29 namespace llvm {
30 class StringRef;
31 
33  virtual void anchor();
34  bool HasLA64 = false;
35  bool HasBasicF = false;
36  bool HasBasicD = false;
37  bool HasExtLSX = false;
38  bool HasExtLASX = false;
39  bool HasExtLVZ = false;
40  bool HasExtLBT = false;
41  unsigned GRLen = 32;
42  MVT GRLenVT = MVT::i32;
44  LoongArchFrameLowering FrameLowering;
45  LoongArchInstrInfo InstrInfo;
48 
49  /// Initializes using the passed in CPU and feature strings so that we can
50  /// use initializer lists for subtarget initialization.
51  LoongArchSubtarget &initializeSubtargetDependencies(const Triple &TT,
52  StringRef CPU,
53  StringRef TuneCPU,
54  StringRef FS,
55  StringRef ABIName);
56 
57 public:
58  // Initializes the data members to match that of the specified triple.
59  LoongArchSubtarget(const Triple &TT, StringRef CPU, StringRef TuneCPU,
60  StringRef FS, StringRef ABIName, const TargetMachine &TM);
61 
62  // Parses features string setting specified subtarget options. The
63  // definition of this function is auto-generated by tblgen.
65 
66  const LoongArchFrameLowering *getFrameLowering() const override {
67  return &FrameLowering;
68  }
69  const LoongArchInstrInfo *getInstrInfo() const override { return &InstrInfo; }
70  const LoongArchRegisterInfo *getRegisterInfo() const override {
71  return &RegInfo;
72  }
73  const LoongArchTargetLowering *getTargetLowering() const override {
74  return &TLInfo;
75  }
76  bool is64Bit() const { return HasLA64; }
77  bool hasBasicF() const { return HasBasicF; }
78  bool hasBasicD() const { return HasBasicD; }
79  bool hasExtLSX() const { return HasExtLSX; }
80  bool hasExtLASX() const { return HasExtLASX; }
81  bool hasExtLVZ() const { return HasExtLVZ; }
82  bool hasExtLBT() const { return HasExtLBT; }
83  MVT getGRLenVT() const { return GRLenVT; }
84  unsigned getGRLen() const { return GRLen; }
85  LoongArchABI::ABI getTargetABI() const { return TargetABI; }
86 };
87 } // namespace llvm
88 
89 #endif // LLVM_LIB_TARGET_LOONGARCH_LOONGARCHSUBTARGET_H
llvm::LoongArchSubtarget::getRegisterInfo
const LoongArchRegisterInfo * getRegisterInfo() const override
Definition: LoongArchSubtarget.h:70
llvm::LoongArchSubtarget::ParseSubtargetFeatures
void ParseSubtargetFeatures(StringRef CPU, StringRef TuneCPU, StringRef FS)
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:17
llvm::LoongArchSubtarget::getGRLen
unsigned getGRLen() const
Definition: LoongArchSubtarget.h:84
LoongArchRegisterInfo.h
llvm::LoongArchSubtarget::hasExtLVZ
bool hasExtLVZ() const
Definition: LoongArchSubtarget.h:81
llvm::Triple
Triple - Helper class for working with autoconf configuration names.
Definition: Triple.h:44
llvm::LoongArchSubtarget::is64Bit
bool is64Bit() const
Definition: LoongArchSubtarget.h:76
LoongArchFrameLowering.h
llvm::LoongArchSubtarget::LoongArchSubtarget
LoongArchSubtarget(const Triple &TT, StringRef CPU, StringRef TuneCPU, StringRef FS, StringRef ABIName, const TargetMachine &TM)
Definition: LoongArchSubtarget.cpp:47
TargetMachine.h
llvm::LoongArchFrameLowering
Definition: LoongArchFrameLowering.h:21
LoongArchISelLowering.h
llvm::LoongArchSubtarget::hasBasicF
bool hasBasicF() const
Definition: LoongArchSubtarget.h:77
llvm::LoongArchRegisterInfo
Definition: LoongArchRegisterInfo.h:24
LoongArchGenSubtargetInfo
llvm::LoongArchSubtarget::getTargetLowering
const LoongArchTargetLowering * getTargetLowering() const override
Definition: LoongArchSubtarget.h:73
llvm::LoongArchSubtarget::hasBasicD
bool hasBasicD() const
Definition: LoongArchSubtarget.h:78
llvm::LoongArchABI::ABI_Unknown
@ ABI_Unknown
Definition: LoongArchBaseInfo.h:33
llvm::LoongArchSubtarget::hasExtLSX
bool hasExtLSX() const
Definition: LoongArchSubtarget.h:79
llvm::LoongArchSubtarget
Definition: LoongArchSubtarget.h:32
llvm::LoongArchABI::ABI
ABI
Definition: LoongArchBaseInfo.h:26
llvm::TargetMachine
Primary interface to the complete machine description for the target machine.
Definition: TargetMachine.h:77
llvm::X86AS::FS
@ FS
Definition: X86.h:196
llvm::MVT
Machine Value Type.
Definition: MachineValueType.h:31
llvm::LoongArchSubtarget::getFrameLowering
const LoongArchFrameLowering * getFrameLowering() const override
Definition: LoongArchSubtarget.h:66
llvm::LoongArchTargetLowering
Definition: LoongArchISelLowering.h:50
llvm::LoongArchSubtarget::getGRLenVT
MVT getGRLenVT() const
Definition: LoongArchSubtarget.h:83
RegInfo
Definition: AMDGPUAsmParser.cpp:2534
DataLayout.h
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:58
TargetSubtargetInfo.h
llvm::LoongArchSubtarget::getTargetABI
LoongArchABI::ABI getTargetABI() const
Definition: LoongArchSubtarget.h:85
LoongArchBaseInfo.h
LoongArchInstrInfo.h
llvm::MVT::i32
@ i32
Definition: MachineValueType.h:48
llvm::LoongArchSubtarget::hasExtLBT
bool hasExtLBT() const
Definition: LoongArchSubtarget.h:82
llvm::LoongArchSubtarget::hasExtLASX
bool hasExtLASX() const
Definition: LoongArchSubtarget.h:80
llvm::LoongArchSubtarget::getInstrInfo
const LoongArchInstrInfo * getInstrInfo() const override
Definition: LoongArchSubtarget.h:69
SelectionDAGTargetInfo.h
TM
const char LLVMTargetMachineRef TM
Definition: PassBuilderBindings.cpp:47
llvm::LoongArchInstrInfo
Definition: LoongArchInstrInfo.h:26