LLVM 18.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 "BPFSelectionDAGInfo.h"
22#include "llvm/IR/DataLayout.h"
24
25#define GET_SUBTARGETINFO_HEADER
26#include "BPFGenSubtargetInfo.inc"
27
28namespace llvm {
29class StringRef;
30
32 virtual void anchor();
33 BPFInstrInfo InstrInfo;
34 BPFFrameLowering FrameLowering;
35 BPFTargetLowering TLInfo;
37
38private:
39 void initializeEnvironment();
40 void initSubtargetFeatures(StringRef CPU, StringRef FS);
41
42protected:
43 // unused
45
46 // whether the cpu supports jmp ext
48
49 // whether the cpu supports jmp32 ext.
50 // NOTE: jmp32 is not enabled when alu32 enabled.
52
53 // whether the cpu supports alu32 instructions.
55
56 // whether we should enable MCAsmInfo DwarfUsesRelocationsAcrossSections
58
59 // whether cpu v4 insns are enabled.
61
62public:
63 // This constructor initializes the data members to match that
64 // of the specified triple.
65 BPFSubtarget(const Triple &TT, const std::string &CPU, const std::string &FS,
66 const TargetMachine &TM);
67
69
70 // ParseSubtargetFeatures - Parses features string setting specified
71 // subtarget options. Definition of function is auto generated by tblgen.
73 bool getHasJmpExt() const { return HasJmpExt; }
74 bool getHasJmp32() const { return HasJmp32; }
75 bool getHasAlu32() const { return HasAlu32; }
76 bool getUseDwarfRIS() const { return UseDwarfRIS; }
77 bool hasLdsx() const { return HasLdsx; }
78 bool hasMovsx() const { return HasMovsx; }
79 bool hasBswap() const { return HasBswap; }
80 bool hasSdivSmod() const { return HasSdivSmod; }
81 bool hasGotol() const { return HasGotol; }
82 bool hasStoreImm() const { return HasStoreImm; }
83
84 const BPFInstrInfo *getInstrInfo() const override { return &InstrInfo; }
85 const BPFFrameLowering *getFrameLowering() const override {
86 return &FrameLowering;
87 }
88 const BPFTargetLowering *getTargetLowering() const override {
89 return &TLInfo;
90 }
91 const BPFSelectionDAGInfo *getSelectionDAGInfo() const override {
92 return &TSInfo;
93 }
94 const TargetRegisterInfo *getRegisterInfo() const override {
95 return &InstrInfo.getRegisterInfo();
96 }
97};
98} // End llvm namespace
99
100#endif
const char LLVMTargetMachineRef TM
const BPFRegisterInfo & getRegisterInfo() const
Definition: BPFInstrInfo.h:30
bool getUseDwarfRIS() const
Definition: BPFSubtarget.h:76
bool hasSdivSmod() const
Definition: BPFSubtarget.h:80
const BPFInstrInfo * getInstrInfo() const override
Definition: BPFSubtarget.h:84
BPFSubtarget & initializeSubtargetDependencies(StringRef CPU, StringRef FS)
bool hasBswap() const
Definition: BPFSubtarget.h:79
const BPFFrameLowering * getFrameLowering() const override
Definition: BPFSubtarget.h:85
bool getHasJmpExt() const
Definition: BPFSubtarget.h:73
const BPFSelectionDAGInfo * getSelectionDAGInfo() const override
Definition: BPFSubtarget.h:91
const TargetRegisterInfo * getRegisterInfo() const override
Definition: BPFSubtarget.h:94
bool hasLdsx() const
Definition: BPFSubtarget.h:77
bool hasGotol() const
Definition: BPFSubtarget.h:81
bool hasMovsx() const
Definition: BPFSubtarget.h:78
bool getHasJmp32() const
Definition: BPFSubtarget.h:74
const BPFTargetLowering * getTargetLowering() const override
Definition: BPFSubtarget.h:88
void ParseSubtargetFeatures(StringRef CPU, StringRef TuneCPU, StringRef FS)
bool hasStoreImm() const
Definition: BPFSubtarget.h:82
bool getHasAlu32() const
Definition: BPFSubtarget.h:75
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:78
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
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