LLVM  16.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  bool HasLaGlobalWithPcrel = false;
42  bool HasLaGlobalWithAbs = false;
43  bool HasLaLocalWithAbs = false;
44  unsigned GRLen = 32;
45  MVT GRLenVT = MVT::i32;
47  LoongArchFrameLowering FrameLowering;
48  LoongArchInstrInfo InstrInfo;
52 
53  /// Initializes using the passed in CPU and feature strings so that we can
54  /// use initializer lists for subtarget initialization.
55  LoongArchSubtarget &initializeSubtargetDependencies(const Triple &TT,
56  StringRef CPU,
57  StringRef TuneCPU,
58  StringRef FS,
59  StringRef ABIName);
60 
61 public:
62  // Initializes the data members to match that of the specified triple.
63  LoongArchSubtarget(const Triple &TT, StringRef CPU, StringRef TuneCPU,
64  StringRef FS, StringRef ABIName, const TargetMachine &TM);
65 
66  // Parses features string setting specified subtarget options. The
67  // definition of this function is auto-generated by tblgen.
69 
70  const LoongArchFrameLowering *getFrameLowering() const override {
71  return &FrameLowering;
72  }
73  const LoongArchInstrInfo *getInstrInfo() const override { return &InstrInfo; }
74  const LoongArchRegisterInfo *getRegisterInfo() const override {
75  return &RegInfo;
76  }
77  const LoongArchTargetLowering *getTargetLowering() const override {
78  return &TLInfo;
79  }
80  const SelectionDAGTargetInfo *getSelectionDAGInfo() const override {
81  return &TSInfo;
82  }
83  bool is64Bit() const { return HasLA64; }
84  bool hasBasicF() const { return HasBasicF; }
85  bool hasBasicD() const { return HasBasicD; }
86  bool hasExtLSX() const { return HasExtLSX; }
87  bool hasExtLASX() const { return HasExtLASX; }
88  bool hasExtLVZ() const { return HasExtLVZ; }
89  bool hasExtLBT() const { return HasExtLBT; }
90  bool hasLaGlobalWithPcrel() const { return HasLaGlobalWithPcrel; }
91  bool hasLaGlobalWithAbs() const { return HasLaGlobalWithAbs; }
92  bool hasLaLocalWithAbs() const { return HasLaLocalWithAbs; }
93  MVT getGRLenVT() const { return GRLenVT; }
94  unsigned getGRLen() const { return GRLen; }
95  LoongArchABI::ABI getTargetABI() const { return TargetABI; }
96 };
97 } // end namespace llvm
98 
99 #endif // LLVM_LIB_TARGET_LOONGARCH_LOONGARCHSUBTARGET_H
llvm::LoongArchSubtarget::getRegisterInfo
const LoongArchRegisterInfo * getRegisterInfo() const override
Definition: LoongArchSubtarget.h:74
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:18
llvm::LoongArchSubtarget::getGRLen
unsigned getGRLen() const
Definition: LoongArchSubtarget.h:94
LoongArchRegisterInfo.h
llvm::LoongArchSubtarget::hasExtLVZ
bool hasExtLVZ() const
Definition: LoongArchSubtarget.h:88
llvm::Triple
Triple - Helper class for working with autoconf configuration names.
Definition: Triple.h:44
llvm::LoongArchSubtarget::is64Bit
bool is64Bit() const
Definition: LoongArchSubtarget.h:83
LoongArchFrameLowering.h
llvm::LoongArchSubtarget::hasLaGlobalWithAbs
bool hasLaGlobalWithAbs() const
Definition: LoongArchSubtarget.h:91
llvm::LoongArchSubtarget::LoongArchSubtarget
LoongArchSubtarget(const Triple &TT, StringRef CPU, StringRef TuneCPU, StringRef FS, StringRef ABIName, const TargetMachine &TM)
Definition: LoongArchSubtarget.cpp:47
InstrInfo
return InstrInfo
Definition: RISCVInsertVSETVLI.cpp:670
TargetMachine.h
llvm::LoongArchFrameLowering
Definition: LoongArchFrameLowering.h:21
LoongArchISelLowering.h
llvm::SelectionDAGTargetInfo
Targets can subclass this to parameterize the SelectionDAG lowering and instruction selection process...
Definition: SelectionDAGTargetInfo.h:31
llvm::LoongArchSubtarget::hasBasicF
bool hasBasicF() const
Definition: LoongArchSubtarget.h:84
llvm::LoongArchRegisterInfo
Definition: LoongArchRegisterInfo.h:24
LoongArchGenSubtargetInfo
llvm::LoongArchSubtarget::getTargetLowering
const LoongArchTargetLowering * getTargetLowering() const override
Definition: LoongArchSubtarget.h:77
llvm::LoongArchSubtarget::hasLaGlobalWithPcrel
bool hasLaGlobalWithPcrel() const
Definition: LoongArchSubtarget.h:90
llvm::LoongArchSubtarget::hasBasicD
bool hasBasicD() const
Definition: LoongArchSubtarget.h:85
llvm::LoongArchABI::ABI_Unknown
@ ABI_Unknown
Definition: LoongArchBaseInfo.h:54
llvm::LoongArchSubtarget::hasExtLSX
bool hasExtLSX() const
Definition: LoongArchSubtarget.h:86
llvm::LoongArchSubtarget
Definition: LoongArchSubtarget.h:32
llvm::LoongArchABI::ABI
ABI
Definition: LoongArchBaseInfo.h:47
llvm::TargetMachine
Primary interface to the complete machine description for the target machine.
Definition: TargetMachine.h:76
llvm::X86AS::FS
@ FS
Definition: X86.h:200
llvm::MVT
Machine Value Type.
Definition: MachineValueType.h:31
llvm::LoongArchSubtarget::getFrameLowering
const LoongArchFrameLowering * getFrameLowering() const override
Definition: LoongArchSubtarget.h:70
llvm::LoongArchTargetLowering
Definition: LoongArchISelLowering.h:80
llvm::LoongArchSubtarget::getGRLenVT
MVT getGRLenVT() const
Definition: LoongArchSubtarget.h:93
llvm::LoongArchSubtarget::getSelectionDAGInfo
const SelectionDAGTargetInfo * getSelectionDAGInfo() const override
Definition: LoongArchSubtarget.h:80
RegInfo
Definition: AMDGPUAsmParser.cpp:2578
DataLayout.h
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:50
TargetSubtargetInfo.h
llvm::LoongArchSubtarget::getTargetABI
LoongArchABI::ABI getTargetABI() const
Definition: LoongArchSubtarget.h:95
LoongArchBaseInfo.h
LoongArchInstrInfo.h
llvm::MVT::i32
@ i32
Definition: MachineValueType.h:48
llvm::LoongArchSubtarget::hasExtLBT
bool hasExtLBT() const
Definition: LoongArchSubtarget.h:89
llvm::LoongArchSubtarget::hasExtLASX
bool hasExtLASX() const
Definition: LoongArchSubtarget.h:87
llvm::LoongArchSubtarget::getInstrInfo
const LoongArchInstrInfo * getInstrInfo() const override
Definition: LoongArchSubtarget.h:73
SelectionDAGTargetInfo.h
llvm::LoongArchSubtarget::hasLaLocalWithAbs
bool hasLaLocalWithAbs() const
Definition: LoongArchSubtarget.h:92
TM
const char LLVMTargetMachineRef TM
Definition: PassBuilderBindings.cpp:47
llvm::LoongArchInstrInfo
Definition: LoongArchInstrInfo.h:26