LLVM 19.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
18#include "LoongArchInstrInfo.h"
23#include "llvm/IR/DataLayout.h"
25
26#define GET_SUBTARGETINFO_HEADER
27#include "LoongArchGenSubtargetInfo.inc"
28
29namespace llvm {
30class StringRef;
31
33 virtual void anchor();
34
35#define GET_SUBTARGETINFO_MACRO(ATTRIBUTE, DEFAULT, GETTER) \
36 bool ATTRIBUTE = DEFAULT;
37#include "LoongArchGenSubtargetInfo.inc"
38
39 unsigned GRLen = 32;
40 MVT GRLenVT = MVT::i32;
42 LoongArchFrameLowering FrameLowering;
43 LoongArchInstrInfo InstrInfo;
47
48 Align PrefFunctionAlignment;
49 Align PrefLoopAlignment;
50 unsigned MaxBytesForAlignment;
51
52 /// Initializes using the passed in CPU and feature strings so that we can
53 /// use initializer lists for subtarget initialization.
54 LoongArchSubtarget &initializeSubtargetDependencies(const Triple &TT,
55 StringRef CPU,
56 StringRef TuneCPU,
57 StringRef FS,
58 StringRef ABIName);
59
60 /// Initialize properties based on the selected processor family.
61 void initializeProperties(StringRef TuneCPU);
62
63public:
64 // Initializes the data members to match that of the specified triple.
65 LoongArchSubtarget(const Triple &TT, StringRef CPU, StringRef TuneCPU,
66 StringRef FS, StringRef ABIName, const TargetMachine &TM);
67
68 // Parses features string setting specified subtarget options. The
69 // definition of this function is auto-generated by tblgen.
71
72 const LoongArchFrameLowering *getFrameLowering() const override {
73 return &FrameLowering;
74 }
75 const LoongArchInstrInfo *getInstrInfo() const override { return &InstrInfo; }
76 const LoongArchRegisterInfo *getRegisterInfo() const override {
77 return &RegInfo;
78 }
80 return &TLInfo;
81 }
83 return &TSInfo;
84 }
85
86#define GET_SUBTARGETINFO_MACRO(ATTRIBUTE, DEFAULT, GETTER) \
87 bool GETTER() const { return ATTRIBUTE; }
88#include "LoongArchGenSubtargetInfo.inc"
89
90 bool is64Bit() const { return HasLA64; }
91 MVT getGRLenVT() const { return GRLenVT; }
92 unsigned getGRLen() const { return GRLen; }
93 LoongArchABI::ABI getTargetABI() const { return TargetABI; }
94 bool isXRaySupported() const override { return is64Bit(); }
95 Align getPrefFunctionAlignment() const { return PrefFunctionAlignment; }
96 Align getPrefLoopAlignment() const { return PrefLoopAlignment; }
97 unsigned getMaxBytesForAlignment() const { return MaxBytesForAlignment; }
98 bool enableMachineScheduler() const override { return true; }
99};
100} // end namespace llvm
101
102#endif // LLVM_LIB_TARGET_LOONGARCH_LOONGARCHSUBTARGET_H
const char LLVMTargetMachineRef TM
const LoongArchRegisterInfo * getRegisterInfo() const override
const LoongArchTargetLowering * getTargetLowering() const override
const SelectionDAGTargetInfo * getSelectionDAGInfo() const override
const LoongArchInstrInfo * getInstrInfo() const override
unsigned getMaxBytesForAlignment() const
bool enableMachineScheduler() const override
bool isXRaySupported() const override
void ParseSubtargetFeatures(StringRef CPU, StringRef TuneCPU, StringRef FS)
LoongArchABI::ABI getTargetABI() const
Align getPrefFunctionAlignment() const
const LoongArchFrameLowering * getFrameLowering() const override
Align getPrefLoopAlignment() const
Machine Value Type.
Targets can subclass this to parameterize the SelectionDAG lowering and instruction selection process...
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:50
Primary interface to the complete machine description for the target machine.
Definition: TargetMachine.h:76
Triple - Helper class for working with autoconf configuration names.
Definition: Triple.h:44
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
This struct is a compact representation of a valid (non-zero power of two) alignment.
Definition: Alignment.h:39