LLVM  14.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 
28 namespace llvm {
29 class StringRef;
30 
32  virtual void anchor();
33  BPFInstrInfo InstrInfo;
34  BPFFrameLowering FrameLowering;
35  BPFTargetLowering TLInfo;
36  BPFSelectionDAGInfo TSInfo;
37 
38 private:
39  void initializeEnvironment();
40  void initSubtargetFeatures(StringRef CPU, StringRef FS);
41  bool probeJmpExt();
42 
43 protected:
44  // unused
46 
47  // whether the cpu supports jmp ext
48  bool HasJmpExt;
49 
50  // whether the cpu supports jmp32 ext.
51  // NOTE: jmp32 is not enabled when alu32 enabled.
52  bool HasJmp32;
53 
54  // whether the cpu supports alu32 instructions.
55  bool HasAlu32;
56 
57  // whether we should enable MCAsmInfo DwarfUsesRelocationsAcrossSections
59 
60 public:
61  // This constructor initializes the data members to match that
62  // of the specified triple.
63  BPFSubtarget(const Triple &TT, const std::string &CPU, const std::string &FS,
64  const TargetMachine &TM);
65 
67 
68  // ParseSubtargetFeatures - Parses features string setting specified
69  // subtarget options. Definition of function is auto generated by tblgen.
71  bool getHasJmpExt() const { return HasJmpExt; }
72  bool getHasJmp32() const { return HasJmp32; }
73  bool getHasAlu32() const { return HasAlu32; }
74  bool getUseDwarfRIS() const { return UseDwarfRIS; }
75 
76  const BPFInstrInfo *getInstrInfo() const override { return &InstrInfo; }
77  const BPFFrameLowering *getFrameLowering() const override {
78  return &FrameLowering;
79  }
80  const BPFTargetLowering *getTargetLowering() const override {
81  return &TLInfo;
82  }
83  const BPFSelectionDAGInfo *getSelectionDAGInfo() const override {
84  return &TSInfo;
85  }
86  const TargetRegisterInfo *getRegisterInfo() const override {
87  return &InstrInfo.getRegisterInfo();
88  }
89 };
90 } // End llvm namespace
91 
92 #endif
llvm::BPFInstrInfo
Definition: BPFInstrInfo.h:24
llvm
---------------------— PointerInfo ------------------------------------—
Definition: AllocatorList.h:23
llvm::BPFSubtarget::HasAlu32
bool HasAlu32
Definition: BPFSubtarget.h:55
llvm::BPFSubtarget::getHasJmp32
bool getHasJmp32() const
Definition: BPFSubtarget.h:72
llvm::BPFSubtarget::getRegisterInfo
const TargetRegisterInfo * getRegisterInfo() const override
Definition: BPFSubtarget.h:86
BPFISelLowering.h
llvm::BPFSubtarget::getUseDwarfRIS
bool getUseDwarfRIS() const
Definition: BPFSubtarget.h:74
llvm::Triple
Triple - Helper class for working with autoconf configuration names.
Definition: Triple.h:45
llvm::TargetRegisterInfo
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
Definition: TargetRegisterInfo.h:233
llvm::BPFSubtarget::initializeSubtargetDependencies
BPFSubtarget & initializeSubtargetDependencies(StringRef CPU, StringRef FS)
Definition: BPFSubtarget.cpp:28
llvm::BPFSubtarget::ParseSubtargetFeatures
void ParseSubtargetFeatures(StringRef CPU, StringRef TuneCPU, StringRef FS)
llvm::BPFSubtarget::UseDwarfRIS
bool UseDwarfRIS
Definition: BPFSubtarget.h:58
TargetMachine.h
BPFGenSubtargetInfo
llvm::BPFSubtarget::BPFSubtarget
BPFSubtarget(const Triple &TT, const std::string &CPU, const std::string &FS, const TargetMachine &TM)
Definition: BPFSubtarget.cpp:60
llvm::BPFSubtarget::getTargetLowering
const BPFTargetLowering * getTargetLowering() const override
Definition: BPFSubtarget.h:80
llvm::BPFSubtarget::getFrameLowering
const BPFFrameLowering * getFrameLowering() const override
Definition: BPFSubtarget.h:77
llvm::BPFSubtarget::getSelectionDAGInfo
const BPFSelectionDAGInfo * getSelectionDAGInfo() const override
Definition: BPFSubtarget.h:83
llvm::TargetMachine
Primary interface to the complete machine description for the target machine.
Definition: TargetMachine.h:79
llvm::X86AS::FS
@ FS
Definition: X86.h:188
BPFSelectionDAGInfo.h
DataLayout.h
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:58
llvm::BPFFrameLowering
Definition: BPFFrameLowering.h:21
TargetSubtargetInfo.h
llvm::BPFInstrInfo::getRegisterInfo
const BPFRegisterInfo & getRegisterInfo() const
Definition: BPFInstrInfo.h:30
llvm::BPFSubtarget::HasJmp32
bool HasJmp32
Definition: BPFSubtarget.h:52
llvm::BPFSubtarget::getHasAlu32
bool getHasAlu32() const
Definition: BPFSubtarget.h:73
llvm::BPFTargetLowering
Definition: BPFISelLowering.h:35
SelectionDAGTargetInfo.h
BPFFrameLowering.h
llvm::BPFSubtarget::isDummyMode
bool isDummyMode
Definition: BPFSubtarget.h:45
TM
const char LLVMTargetMachineRef TM
Definition: PassBuilderBindings.cpp:47
llvm::BPFSubtarget::getHasJmpExt
bool getHasJmpExt() const
Definition: BPFSubtarget.h:71
llvm::BPFSelectionDAGInfo
Definition: BPFSelectionDAGInfo.h:20
llvm::BPFSubtarget::getInstrInfo
const BPFInstrInfo * getInstrInfo() const override
Definition: BPFSubtarget.h:76
BPFInstrInfo.h
llvm::BPFSubtarget
Definition: BPFSubtarget.h:31
llvm::BPFSubtarget::HasJmpExt
bool HasJmpExt
Definition: BPFSubtarget.h:48