LLVM 22.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.
69
70 std::unique_ptr<CallLowering> CallLoweringInfo;
71 std::unique_ptr<InstructionSelector> InstSelector;
72 std::unique_ptr<LegalizerInfo> Legalizer;
73 std::unique_ptr<RegisterBankInfo> RegBankInfo;
74
75public:
76 // This constructor initializes the data members to match that
77 // of the specified triple.
78 BPFSubtarget(const Triple &TT, const std::string &CPU, const std::string &FS,
79 const TargetMachine &TM);
80
82
83 // ParseSubtargetFeatures - Parses features string setting specified
84 // subtarget options. Definition of function is auto generated by tblgen.
86 bool getHasJmpExt() const { return HasJmpExt; }
87 bool getHasJmp32() const { return HasJmp32; }
88 bool getHasAlu32() const { return HasAlu32; }
89 bool getUseDwarfRIS() const { return UseDwarfRIS; }
90 bool hasLdsx() const { return HasLdsx; }
91 bool hasMovsx() const { return HasMovsx; }
92 bool hasBswap() const { return HasBswap; }
93 bool hasSdivSmod() const { return HasSdivSmod; }
94 bool hasGotol() const { return HasGotol; }
95 bool hasStoreImm() const { return HasStoreImm; }
96 bool hasLoadAcqStoreRel() const { return HasLoadAcqStoreRel; }
97
98 bool isLittleEndian() const { return IsLittleEndian; }
99
100 const BPFInstrInfo *getInstrInfo() const override { return &InstrInfo; }
101 const BPFFrameLowering *getFrameLowering() const override {
102 return &FrameLowering;
103 }
104 const BPFTargetLowering *getTargetLowering() const override {
105 return &TLInfo;
106 }
107 const BPFSelectionDAGInfo *getSelectionDAGInfo() const override {
108 return &TSInfo;
109 }
110 const BPFRegisterInfo *getRegisterInfo() const override {
111 return &InstrInfo.getRegisterInfo();
112 }
113
114 const CallLowering *getCallLowering() const override;
116 const LegalizerInfo *getLegalizerInfo() const override;
117 const RegisterBankInfo *getRegBankInfo() const override;
118};
119} // End llvm namespace
120
121#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...
BPFSubtarget(const Triple &TT, const std::string &CPU, const std::string &FS, const TargetMachine &TM)
InstructionSelector * getInstructionSelector() const override
bool hasLoadAcqStoreRel() const
bool getUseDwarfRIS() const
bool hasSdivSmod() const
const BPFInstrInfo * getInstrInfo() const override
BPFSubtarget & initializeSubtargetDependencies(StringRef CPU, StringRef FS)
std::unique_ptr< InstructionSelector > InstSelector
bool hasBswap() const
const BPFFrameLowering * getFrameLowering() const override
std::unique_ptr< LegalizerInfo > Legalizer
bool getHasJmpExt() const
std::unique_ptr< CallLowering > CallLoweringInfo
const BPFSelectionDAGInfo * getSelectionDAGInfo() const override
const CallLowering * getCallLowering() const override
bool hasLdsx() const
bool hasGotol() const
bool hasMovsx() const
bool getHasJmp32() const
std::unique_ptr< RegisterBankInfo > RegBankInfo
const BPFRegisterInfo * getRegisterInfo() const override
const RegisterBankInfo * getRegBankInfo() const override
const BPFTargetLowering * getTargetLowering() const override
bool isLittleEndian() const
const LegalizerInfo * getLegalizerInfo() const override
void ParseSubtargetFeatures(StringRef CPU, StringRef TuneCPU, StringRef FS)
bool hasStoreImm() const
bool getHasAlu32() const
Holds all the information related to register banks.
StringRef - Represent a constant reference to a string, i.e.
Definition StringRef.h:55
Primary interface to the complete machine description for the target machine.
Triple - Helper class for working with autoconf configuration names.
Definition Triple.h:47
This is an optimization pass for GlobalISel generic memory operations.