LLVM  8.0.0svn
BPFSubtarget.h
Go to the documentation of this file.
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"
23 #include "llvm/IR/DataLayout.h"
25 
26 #define GET_SUBTARGETINFO_HEADER
27 #include "BPFGenSubtargetInfo.inc"
28 
29 namespace llvm {
30 class StringRef;
31 
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
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
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 
64 
65  // ParseSubtargetFeatures - Parses features string setting specified
66  // subtarget options. Definition of function is auto generated by tblgen.
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
Compute iterated dominance frontiers using a linear time algorithm.
Definition: AllocatorList.h:24
void ParseSubtargetFeatures(StringRef CPU, StringRef FS)
const BPFTargetLowering * getTargetLowering() const override
Definition: BPFSubtarget.h:76
BPFSubtarget(const Triple &TT, const std::string &CPU, const std::string &FS, const TargetMachine &TM)
bool getUseDwarfRIS() const
Definition: BPFSubtarget.h:70
const BPFInstrInfo * getInstrInfo() const override
Definition: BPFSubtarget.h:72
BPFSubtarget & initializeSubtargetDependencies(StringRef CPU, StringRef FS)
const BPFRegisterInfo & getRegisterInfo() const
Definition: BPFInstrInfo.h:31
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
const TargetRegisterInfo * getRegisterInfo() const override
Definition: BPFSubtarget.h:82
Triple - Helper class for working with autoconf configuration names.
Definition: Triple.h:44
const BPFSelectionDAGInfo * getSelectionDAGInfo() const override
Definition: BPFSubtarget.h:79
const BPFFrameLowering * getFrameLowering() const override
Definition: BPFSubtarget.h:73
bool getHasAlu32() const
Definition: BPFSubtarget.h:69
Primary interface to the complete machine description for the target machine.
Definition: TargetMachine.h:59
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:49
bool getHasJmpExt() const
Definition: BPFSubtarget.h:68