LLVM 19.0.0git
BPFSubtarget.h
Go to the documentation of this file.
1//===-- BPFSubtarget.h - Define Subtarget for the BPF -----------*- 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 BPF specific subclass of TargetSubtargetInfo.
10//
11//===----------------------------------------------------------------------===//
12
13#ifndef LLVM_LIB_TARGET_BPF_BPFSUBTARGET_H
14#define LLVM_LIB_TARGET_BPF_BPFSUBTARGET_H
15
16#include "BPFFrameLowering.h"
17#include "BPFISelLowering.h"
18#include "BPFInstrInfo.h"
19#include "BPFRegisterInfo.h"
20#include "BPFSelectionDAGInfo.h"
27#include "llvm/IR/DataLayout.h"
29
30#define GET_SUBTARGETINFO_HEADER
31#include "BPFGenSubtargetInfo.inc"
32
33namespace llvm {
34class StringRef;
35
37 virtual void anchor();
38 BPFInstrInfo InstrInfo;
39 BPFFrameLowering FrameLowering;
40 BPFTargetLowering TLInfo;
42
43private:
44 void initializeEnvironment();
45 void initSubtargetFeatures(StringRef CPU, StringRef FS);
46
47protected:
48 // unused
50
52
53 // whether the cpu supports jmp ext
55
56 // whether the cpu supports jmp32 ext.
57 // NOTE: jmp32 is not enabled when alu32 enabled.
59
60 // whether the cpu supports alu32 instructions.
62
63 // whether we should enable MCAsmInfo DwarfUsesRelocationsAcrossSections
65
66 // whether cpu v4 insns are enabled.
68
69 std::unique_ptr<CallLowering> CallLoweringInfo;
70 std::unique_ptr<InstructionSelector> InstSelector;
71 std::unique_ptr<LegalizerInfo> Legalizer;
72 std::unique_ptr<RegisterBankInfo> RegBankInfo;
73
74public:
75 // This constructor initializes the data members to match that
76 // of the specified triple.
77 BPFSubtarget(const Triple &TT, const std::string &CPU, const std::string &FS,
78 const TargetMachine &TM);
79
81
82 // ParseSubtargetFeatures - Parses features string setting specified
83 // subtarget options. Definition of function is auto generated by tblgen.
85 bool getHasJmpExt() const { return HasJmpExt; }
86 bool getHasJmp32() const { return HasJmp32; }
87 bool getHasAlu32() const { return HasAlu32; }
88 bool getUseDwarfRIS() const { return UseDwarfRIS; }
89 bool hasLdsx() const { return HasLdsx; }
90 bool hasMovsx() const { return HasMovsx; }
91 bool hasBswap() const { return HasBswap; }
92 bool hasSdivSmod() const { return HasSdivSmod; }
93 bool hasGotol() const { return HasGotol; }
94 bool hasStoreImm() const { return HasStoreImm; }
95
96 bool isLittleEndian() const { return IsLittleEndian; }
97
98 const BPFInstrInfo *getInstrInfo() const override { return &InstrInfo; }
99 const BPFFrameLowering *getFrameLowering() const override {
100 return &FrameLowering;
101 }
102 const BPFTargetLowering *getTargetLowering() const override {
103 return &TLInfo;
104 }
105 const BPFSelectionDAGInfo *getSelectionDAGInfo() const override {
106 return &TSInfo;
107 }
108 const BPFRegisterInfo *getRegisterInfo() const override {
109 return &InstrInfo.getRegisterInfo();
110 }
111
112 const CallLowering *getCallLowering() const override;
114 const LegalizerInfo *getLegalizerInfo() const override;
115 const RegisterBankInfo *getRegBankInfo() const override;
116};
117} // End llvm namespace
118
119#endif
This file describes how to lower LLVM calls to machine code calls.
Interface for Targets to specify which operations they can successfully select and how the others sho...
const char LLVMTargetMachineRef TM
const BPFRegisterInfo & getRegisterInfo() const
Definition: BPFInstrInfo.h:30
InstructionSelector * getInstructionSelector() const override
bool getUseDwarfRIS() const
Definition: BPFSubtarget.h:88
bool hasSdivSmod() const
Definition: BPFSubtarget.h:92
const BPFInstrInfo * getInstrInfo() const override
Definition: BPFSubtarget.h:98
BPFSubtarget & initializeSubtargetDependencies(StringRef CPU, StringRef FS)
std::unique_ptr< InstructionSelector > InstSelector
Definition: BPFSubtarget.h:70
bool hasBswap() const
Definition: BPFSubtarget.h:91
const BPFFrameLowering * getFrameLowering() const override
Definition: BPFSubtarget.h:99
std::unique_ptr< LegalizerInfo > Legalizer
Definition: BPFSubtarget.h:71
bool getHasJmpExt() const
Definition: BPFSubtarget.h:85
std::unique_ptr< CallLowering > CallLoweringInfo
Definition: BPFSubtarget.h:69
const BPFSelectionDAGInfo * getSelectionDAGInfo() const override
Definition: BPFSubtarget.h:105
const CallLowering * getCallLowering() const override
bool hasLdsx() const
Definition: BPFSubtarget.h:89
bool hasGotol() const
Definition: BPFSubtarget.h:93
bool hasMovsx() const
Definition: BPFSubtarget.h:90
bool getHasJmp32() const
Definition: BPFSubtarget.h:86
std::unique_ptr< RegisterBankInfo > RegBankInfo
Definition: BPFSubtarget.h:72
const BPFRegisterInfo * getRegisterInfo() const override
Definition: BPFSubtarget.h:108
const RegisterBankInfo * getRegBankInfo() const override
const BPFTargetLowering * getTargetLowering() const override
Definition: BPFSubtarget.h:102
bool isLittleEndian() const
Definition: BPFSubtarget.h:96
const LegalizerInfo * getLegalizerInfo() const override
void ParseSubtargetFeatures(StringRef CPU, StringRef TuneCPU, StringRef FS)
bool hasStoreImm() const
Definition: BPFSubtarget.h:94
bool getHasAlu32() const
Definition: BPFSubtarget.h:87
Holds all the information related to register banks.
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