1 //===-- BPFSubtarget.h - Define Subtarget for the BPF -----------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file declares the BPF specific subclass of TargetSubtargetInfo.
12 //===----------------------------------------------------------------------===//
14 #ifndef LLVM_LIB_TARGET_BPF_BPFSUBTARGET_H
15 #define LLVM_LIB_TARGET_BPF_BPFSUBTARGET_H
17 #include "BPFFrameLowering.h"
18 #include "BPFISelLowering.h"
19 #include "BPFInstrInfo.h"
20 #include "BPFSelectionDAGInfo.h"
21 #include "llvm/CodeGen/SelectionDAGTargetInfo.h"
22 #include "llvm/CodeGen/TargetSubtargetInfo.h"
23 #include "llvm/IR/DataLayout.h"
24 #include "llvm/Target/TargetMachine.h"
26 #define GET_SUBTARGETINFO_HEADER
27 #include "BPFGenSubtargetInfo.inc"
32 class BPFSubtarget : public BPFGenSubtargetInfo {
33 virtual void anchor();
34 BPFInstrInfo InstrInfo;
35 BPFFrameLowering FrameLowering;
36 BPFTargetLowering TLInfo;
37 BPFSelectionDAGInfo TSInfo;
40 void initializeEnvironment();
41 void initSubtargetFeatures(StringRef CPU, StringRef FS);
48 // whether the cpu supports jmp ext
51 // whether the cpu supports alu32 instructions.
54 // whether we should enable MCAsmInfo DwarfUsesRelocationsAcrossSections
58 // This constructor initializes the data members to match that
59 // of the specified triple.
60 BPFSubtarget(const Triple &TT, const std::string &CPU, const std::string &FS,
61 const TargetMachine &TM);
63 BPFSubtarget &initializeSubtargetDependencies(StringRef CPU, StringRef FS);
65 // ParseSubtargetFeatures - Parses features string setting specified
66 // subtarget options. Definition of function is auto generated by tblgen.
67 void ParseSubtargetFeatures(StringRef CPU, StringRef FS);
68 bool getHasJmpExt() const { return HasJmpExt; }
69 bool getHasAlu32() const { return HasAlu32; }
70 bool getUseDwarfRIS() const { return UseDwarfRIS; }
72 const BPFInstrInfo *getInstrInfo() const override { return &InstrInfo; }
73 const BPFFrameLowering *getFrameLowering() const override {
74 return &FrameLowering;
76 const BPFTargetLowering *getTargetLowering() const override {
79 const BPFSelectionDAGInfo *getSelectionDAGInfo() const override {
82 const TargetRegisterInfo *getRegisterInfo() const override {
83 return &InstrInfo.getRegisterInfo();
86 } // End llvm namespace