LLVM  7.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"
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;
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 alu32 instructions.
51  bool HasAlu32;
52 
53  // whether we should enable MCAsmInfo DwarfUsesRelocationsAcrossSections
55 
56 public:
57  // This constructor initializes the data members to match that
58  // of the specified triple.
59  BPFSubtarget(const Triple &TT, const std::string &CPU, const std::string &FS,
60  const TargetMachine &TM);
61 
63 
64  // ParseSubtargetFeatures - Parses features string setting specified
65  // subtarget options. Definition of function is auto generated by tblgen.
67  bool getHasJmpExt() const { return HasJmpExt; }
68  bool getHasAlu32() const { return HasAlu32; }
69  bool getUseDwarfRIS() const { return UseDwarfRIS; }
70 
71  const BPFInstrInfo *getInstrInfo() const override { return &InstrInfo; }
72  const BPFFrameLowering *getFrameLowering() const override {
73  return &FrameLowering;
74  }
75  const BPFTargetLowering *getTargetLowering() const override {
76  return &TLInfo;
77  }
78  const SelectionDAGTargetInfo *getSelectionDAGInfo() const override {
79  return &TSInfo;
80  }
81  const TargetRegisterInfo *getRegisterInfo() const override {
82  return &InstrInfo.getRegisterInfo();
83  }
84 };
85 } // End llvm namespace
86 
87 #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:75
BPFSubtarget(const Triple &TT, const std::string &CPU, const std::string &FS, const TargetMachine &TM)
bool getUseDwarfRIS() const
Definition: BPFSubtarget.h:69
const BPFInstrInfo * getInstrInfo() const override
Definition: BPFSubtarget.h:71
BPFSubtarget & initializeSubtargetDependencies(StringRef CPU, StringRef FS)
const BPFRegisterInfo & getRegisterInfo() const
Definition: BPFInstrInfo.h:31
Targets can subclass this to parameterize the SelectionDAG lowering and instruction selection process...
TargetRegisterInfo base class - We assume that the target defines a static array of TargetRegisterDes...
const TargetRegisterInfo * getRegisterInfo() const override
Definition: BPFSubtarget.h:81
Triple - Helper class for working with autoconf configuration names.
Definition: Triple.h:44
const BPFFrameLowering * getFrameLowering() const override
Definition: BPFSubtarget.h:72
bool getHasAlu32() const
Definition: BPFSubtarget.h:68
const SelectionDAGTargetInfo * getSelectionDAGInfo() const override
Definition: BPFSubtarget.h:78
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:67