BPF backend
[oota-llvm.git] / 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 "llvm/Target/TargetSelectionDAGInfo.h"
21 #include "llvm/IR/DataLayout.h"
22 #include "llvm/Target/TargetMachine.h"
23 #include "llvm/Target/TargetSubtargetInfo.h"
24
25 #define GET_SUBTARGETINFO_HEADER
26 #include "BPFGenSubtargetInfo.inc"
27
28 namespace llvm {
29 class StringRef;
30
31 class BPFSubtarget : public BPFGenSubtargetInfo {
32   virtual void anchor();
33   const DataLayout DL; // Calculates type size & alignment
34   BPFInstrInfo InstrInfo;
35   BPFFrameLowering FrameLowering;
36   BPFTargetLowering TLInfo;
37   TargetSelectionDAGInfo TSInfo;
38
39 public:
40   // This constructor initializes the data members to match that
41   // of the specified triple.
42   BPFSubtarget(const std::string &TT, const std::string &CPU,
43                const std::string &FS, const TargetMachine &TM);
44
45   // ParseSubtargetFeatures - Parses features string setting specified
46   // subtarget options.  Definition of function is auto generated by tblgen.
47   void ParseSubtargetFeatures(StringRef CPU, StringRef FS);
48
49   const BPFInstrInfo *getInstrInfo() const override { return &InstrInfo; }
50   const BPFFrameLowering *getFrameLowering() const override {
51     return &FrameLowering;
52   }
53   const BPFTargetLowering *getTargetLowering() const override {
54     return &TLInfo;
55   }
56   const TargetSelectionDAGInfo *getSelectionDAGInfo() const override {
57     return &TSInfo;
58   }
59   const TargetRegisterInfo *getRegisterInfo() const override {
60     return &InstrInfo.getRegisterInfo();
61   }
62   const DataLayout *getDataLayout() const override { return &DL; }
63 };
64 } // End llvm namespace
65
66 #endif