Alexei Starovoitov | e4c8c80 | 2015-01-24 17:51:26 +0000 | [diff] [blame] | 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" |
Benjamin Kramer | f9172fd4 | 2016-01-27 16:32:26 +0000 | [diff] [blame] | 20 | #include "llvm/CodeGen/SelectionDAGTargetInfo.h" |
Alexei Starovoitov | e4c8c80 | 2015-01-24 17:51:26 +0000 | [diff] [blame] | 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(); |
Alexei Starovoitov | e4c8c80 | 2015-01-24 17:51:26 +0000 | [diff] [blame] | 33 | BPFInstrInfo InstrInfo; |
| 34 | BPFFrameLowering FrameLowering; |
| 35 | BPFTargetLowering TLInfo; |
Benjamin Kramer | f9172fd4 | 2016-01-27 16:32:26 +0000 | [diff] [blame] | 36 | SelectionDAGTargetInfo TSInfo; |
Alexei Starovoitov | e4c8c80 | 2015-01-24 17:51:26 +0000 | [diff] [blame] | 37 | |
| 38 | public: |
| 39 | // This constructor initializes the data members to match that |
| 40 | // of the specified triple. |
Daniel Sanders | a73f1fd | 2015-06-10 12:11:26 +0000 | [diff] [blame] | 41 | BPFSubtarget(const Triple &TT, const std::string &CPU, const std::string &FS, |
| 42 | const TargetMachine &TM); |
Alexei Starovoitov | e4c8c80 | 2015-01-24 17:51:26 +0000 | [diff] [blame] | 43 | |
| 44 | // ParseSubtargetFeatures - Parses features string setting specified |
| 45 | // subtarget options. Definition of function is auto generated by tblgen. |
| 46 | void ParseSubtargetFeatures(StringRef CPU, StringRef FS); |
| 47 | |
| 48 | const BPFInstrInfo *getInstrInfo() const override { return &InstrInfo; } |
| 49 | const BPFFrameLowering *getFrameLowering() const override { |
| 50 | return &FrameLowering; |
| 51 | } |
| 52 | const BPFTargetLowering *getTargetLowering() const override { |
| 53 | return &TLInfo; |
| 54 | } |
Benjamin Kramer | f9172fd4 | 2016-01-27 16:32:26 +0000 | [diff] [blame] | 55 | const SelectionDAGTargetInfo *getSelectionDAGInfo() const override { |
Alexei Starovoitov | e4c8c80 | 2015-01-24 17:51:26 +0000 | [diff] [blame] | 56 | return &TSInfo; |
| 57 | } |
| 58 | const TargetRegisterInfo *getRegisterInfo() const override { |
| 59 | return &InstrInfo.getRegisterInfo(); |
| 60 | } |
Alexei Starovoitov | e4c8c80 | 2015-01-24 17:51:26 +0000 | [diff] [blame] | 61 | }; |
Alexander Kornienko | f00654e | 2015-06-23 09:49:53 +0000 | [diff] [blame] | 62 | } // End llvm namespace |
Alexei Starovoitov | e4c8c80 | 2015-01-24 17:51:26 +0000 | [diff] [blame] | 63 | |
| 64 | #endif |