]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/lib/Target/BPF/BPFSubtarget.h
Merge clang 7.0.1 and several follow-up changes
[FreeBSD/FreeBSD.git] / contrib / llvm / lib / Target / BPF / BPFSubtarget.h
1 //===-- BPFSubtarget.h - Define Subtarget for the BPF -----------*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file declares the BPF specific subclass of TargetSubtargetInfo.
11 //
12 //===----------------------------------------------------------------------===//
13
14 #ifndef LLVM_LIB_TARGET_BPF_BPFSUBTARGET_H
15 #define LLVM_LIB_TARGET_BPF_BPFSUBTARGET_H
16
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"
25
26 #define GET_SUBTARGETINFO_HEADER
27 #include "BPFGenSubtargetInfo.inc"
28
29 namespace llvm {
30 class StringRef;
31
32 class BPFSubtarget : public BPFGenSubtargetInfo {
33   virtual void anchor();
34   BPFInstrInfo InstrInfo;
35   BPFFrameLowering FrameLowering;
36   BPFTargetLowering TLInfo;
37   BPFSelectionDAGInfo TSInfo;
38
39 private:
40   void initializeEnvironment();
41   void initSubtargetFeatures(StringRef CPU, StringRef FS);
42   bool probeJmpExt();
43
44 protected:
45   // unused
46   bool isDummyMode;
47
48   // whether the cpu supports jmp ext
49   bool HasJmpExt;
50
51   // whether the cpu supports alu32 instructions.
52   bool HasAlu32;
53
54   // whether we should enable MCAsmInfo DwarfUsesRelocationsAcrossSections
55   bool UseDwarfRIS;
56
57 public:
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);
62
63   BPFSubtarget &initializeSubtargetDependencies(StringRef CPU, StringRef FS);
64
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; }
71
72   const BPFInstrInfo *getInstrInfo() const override { return &InstrInfo; }
73   const BPFFrameLowering *getFrameLowering() const override {
74     return &FrameLowering;
75   }
76   const BPFTargetLowering *getTargetLowering() const override {
77     return &TLInfo;
78   }
79   const BPFSelectionDAGInfo *getSelectionDAGInfo() const override {
80     return &TSInfo;
81   }
82   const TargetRegisterInfo *getRegisterInfo() const override {
83     return &InstrInfo.getRegisterInfo();
84   }
85 };
86 } // End llvm namespace
87
88 #endif